29 #ifndef _util_misc_property_h
30 #define _util_misc_property_h
46 template <
typename ClassType,
typename MemberType>
50 typedef MemberType (ClassType::*getter_type)()
const;
51 typedef void (ClassType::*setter_type)(
const MemberType&);
58 getter_type aGetter = NULL,
59 setter_type aSetter = NULL) :
64 throw std::logic_error(
"Cannot have a NULL getter function for a property!");
69 self& operator=(
self&) =
delete;
70 self& operator=(
const self&) =
delete;
79 (target->*setter)(value);
86 operator MemberType()
const {
87 return (target->*getter)();
90 void set_target(ClassType* a) { target = a; }
91 void set_getter(getter_type g){ getter = g; }
92 void set_setter(setter_type s){ setter = s; }
93 void set_target_getter_setter(ClassType* a, getter_type g, setter_type s = NULL) {