48 #ifndef _MIRA_GETTERSETTER_H_ 49 #define _MIRA_GETTERSETTER_H_ 51 #include <type_traits> 54 #include <boost/function.hpp> 106 template<
typename Reflector>
114 boost::function<value_type ()> fn;
119 template <
typename T,
typename SerializerTag>
175 template<
typename T,
typename Class>
178 return Getter<T>( boost::bind( f, boost::ref(*obj) ) );
196 template<
typename T,
typename Class>
199 return Getter<T>( boost::bind( f, boost::ref(*obj) ) );
218 template<
typename T,
typename Class>
219 Getter<T>
getter( T (Class::*f) ()
const, Class* obj)
221 return Getter<T>( boost::bind( f, boost::ref(*obj) ) );
239 template<
typename T,
typename Class>
240 Getter<T>
getter(
const T& (Class::*f) ()
const, Class* obj)
242 return Getter<T>( boost::bind( f, boost::ref(*obj) ) );
254 template<
typename T,
typename LambdaFn>
279 template <
typename T,
typename TObject>
280 class GetterWithObject
284 GetterWithObject(boost::function<T (
const TObject&)> f,
const TObject& obj) :
285 fn(f), object(obj) {}
289 T operator()() {
return fn(
object); }
293 boost::function<T (const TObject&)> fn;
294 const TObject& object;
327 template<
typename T,
typename TObject>
330 return Getter<T>(GetterWithObject<T,TObject>(f,object));
340 template<
typename T,
typename TObject>
343 return Getter<T>(GetterWithObject<T,TObject>(f,object));
353 template<
typename T,
typename TObject>
356 return Getter<T>(GetterWithObject<T,TObject>(f,object));
366 template<
typename T,
typename TObject>
369 return Getter<T>(GetterWithObject<T,TObject>(f,object));
413 template<
typename Reflector>
423 boost::function<void (const value_type&)> fn;
426 template <
typename T,
typename SerializerTag>
476 template<
typename T,
typename LambdaFn>
495 template<
typename T,
typename Class>
498 return Setter<T>( boost::bind( f, boost::ref(*obj), _1 ) );
516 template<
typename T,
typename Class>
519 return Setter<T>( boost::bind( f, boost::ref(*obj), _1 ) );
540 template <
typename T,
typename TObject>
541 class SetterWithObject
545 SetterWithObject(boost::function<TObject (
const T&)> f, TObject& obj) :
546 fn(f), object(obj) {}
550 void operator()(
const T& value) {
object = fn(value); }
554 boost::function<TObject (const T&)> fn;
586 template<
typename T,
typename TObject>
589 return Setter<T>(SetterWithObject<T,TObject>(f,object));
599 template<
typename T,
typename TObject>
602 return Setter<T>(SetterWithObject<T,TObject>(f,object));
612 template<
typename T,
typename TObject>
615 return Setter<T>(SetterWithObject<T,TObject>(f,object));
625 template<
typename T,
typename TObject>
628 return Setter<T>(SetterWithObject<T,TObject>(f,object));
This object can use object tracking internally, but the object tracking system's state remains unchan...
Definition: ReflectControlFlags.h:82
Type trait that indicates whether a type should be serialized "transparently", i.e.
Definition: IsTransparentSerializable.h:81
Setter & operator=(const value_type &value)
mimic the assignment behavior of underlying type, e.g. mysetter = 1234;
Definition: GetterSetter.h:407
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
Getter(boost::function< value_type()> f)
Definition: GetterSetter.h:95
Class object which supports some kind of class reflection.
Definition: Class.h:97
Setter< T > setter(void(*f)(const T &))
Creates a Setter for global or static class methods taking the argument by const reference.
Definition: GetterSetter.h:443
Holds a boost::function object to a special setter function that must meet the signature "void method...
Definition: GetterSetter.h:395
Provides type trait that indicates whether a type should be serialized "transparently".
Flags controlling reflector behaviour.
Getter< T > getter(T(*f)())
Creates a Getter for global or static class methods returning the result by value.
Definition: GetterSetter.h:136
Setter(boost::function< void(const value_type &)> f)
Definition: GetterSetter.h:401
Holds a boost::function object to a special getter function that must meet the signature "T method()"...
Definition: GetterSetter.h:87
T value_type
Definition: GetterSetter.h:91
void reflect(Reflector &r)
Definition: GetterSetter.h:414
T value_type
Definition: GetterSetter.h:398
void reflect(Reflector &r)
Definition: GetterSetter.h:107