29#ifndef _util_misc_property_h
30#define _util_misc_property_h
46template <
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) {
Helper class to connect a 'property' in a c++ class to getter/setter methods.
Definition property.h:47
self & operator=(const MemberType &value)
assignment operator.
Definition property.h:77
property(ClassType *aTarget, getter_type aGetter=NULL, setter_type aSetter=NULL)
ctor NOTE: Avoid using leading underscores, technically, the C++ standard forbids them.
Definition property.h:57
SpinCase1 other(SpinCase1 S)
given 1-spin return the other 1-spin
Contains all MPQC code up to version 3.
Definition mpqcin.h:14