62 template<
typename ValueType>
69 virtual void set(ValueType b) = 0;
70 virtual ValueType
get()
const = 0;
72 virtual bool isNull()
const = 0;
82 Memory(ValueType* value) : value(value) {}
84 virtual void set(ValueType v) {
88 virtual ValueType
get()
const {
101 template<
typename GetMethod,
typename SetMethod>
110 FcnAccessor(GetMethod getMethod, SetMethod setMethod) : getMethod(getMethod), setMethod(setMethod) {
113 virtual void set(ValueType v) {
119 virtual ValueType
get()
const {
120 return (*getMethod)();
127 virtual bool isNull()
const {
return false; }
130 template<
class T,
typename GetMethod,
typename SetMethod>
142 SetMethod setMethod) : object(object), getMethod(getMethod), setMethod(setMethod) {
146 virtual void set(ValueType v) {
152 virtual ValueType
get()
const {
153 return (object->*getMethod)();
157 return new Accessor(
object, getMethod, setMethod);
161 return object ==
NULL;
166 template<
class T,
typename GetMethod,
typename SetMethod>
177 (
const shared_ptr<T>&
object,
184 virtual void set(ValueType v) {
190 virtual ValueType
get()
const {
213 return (m_interface ==
NULL) || m_interface->
isNull();
233 template<
class Class>
235 ValueType (Class::*getMethod)()
const,
236 void (Class::*setMethod)(ValueType)) :
237 m_interface(new
SharedAccessor<Class, ValueType (Class::*)()
const, void (Class::*)(ValueType)>(object, getMethod, setMethod)) {}
240 template<
class Class>
242 const ValueType& (Class::*getMethod)()
const,
243 void (Class::*setMethod)(ValueType)) :
244 m_interface(new
SharedAccessor<Class,
const ValueType& (Class::*)()
const, void (Class::*)(ValueType)>(object, getMethod, setMethod)) {}
249 void (*setMethod)(ValueType)) :
250 m_interface(new
FcnAccessor<ValueType (*)(), void (*)(ValueType)>(getMethod, setMethod)) {}
254 void (*setMethod)(ValueType)) :
255 m_interface(new
FcnAccessor<
const ValueType& (*)(), void (*)(ValueType)>(getMethod, setMethod)) {}
259 template<
class Class>
261 ValueType (Class::*getMethod)()
const,
262 void (Class::*setMethod)(
const ValueType&)) :
263 m_interface(new
SharedAccessor<Class, ValueType (Class::*)()
const, void (Class::*)(
const ValueType&)>(object, getMethod, setMethod)) {}
266 template<
class Class>
268 const ValueType& (Class::*getMethod)()
const,
269 void (Class::*setMethod)(
const ValueType&)) :
270 m_interface(new
SharedAccessor<Class,
const ValueType& (Class::*)()
const, void (Class::*)(
const ValueType&)>(object, getMethod, setMethod)) {}
273 template<
class Class>
275 const ValueType& (Class::*getMethod)()
const,
276 void (Class::*setMethod)(
const ValueType&)) :
277 m_interface(new
Accessor<Class,
const ValueType& (Class::*)()
const, void (Class::*)(
const ValueType&)>(object, getMethod, setMethod)) {}
280 template<
class Class>
282 ValueType (Class::*getMethod)()
const,
283 void (Class::*setMethod)(
const ValueType&)) :
284 m_interface(new
Accessor<Class, ValueType (Class::*)()
const, void (Class::*)(
const ValueType&)>(object, getMethod, setMethod)) {}
287 template<
class Class>
289 const ValueType& (Class::*getMethod)()
const,
290 void (Class::*setMethod)(ValueType)) :
291 m_interface(new
Accessor<Class,
const ValueType& (Class::*)()
const, void (Class::*)(ValueType)>(object, getMethod, setMethod)) {}
294 template<
class Class>
296 ValueType (Class::*getMethod)()
const,
297 void (Class::*setMethod)(ValueType)) :
298 m_interface(new
Accessor<Class, ValueType (Class::*)()
const, void (Class::*)(ValueType)>(object, getMethod, setMethod)) {}
306 return m_interface->
get();
329 operator ValueType()
const {
Pointer(Class *object, const ValueType &(Class::*getMethod)() const, void(Class::*setMethod)(ValueType))
Definition: Pointer.h:288
const ValueType getValue() const
Definition: Pointer.h:304
SetMethod setMethod
Definition: Pointer.h:172
Pointer(const shared_ptr< Class > &object, const ValueType &(Class::*getMethod)() const, void(Class::*setMethod)(const ValueType &))
Definition: Pointer.h:267
IndirectValue operator*()
Definition: Pointer.h:335
Definition: Pointer.h:316
Definition: Pointer.h:102
GetMethod getMethod
Definition: Pointer.h:135
bool notNull(const Pointer< T > &p)
Definition: Pointer.h:350
Pointer(ValueType *v)
Definition: Pointer.h:210
Definition: Pointer.h:131
virtual ~Interface()
Definition: Pointer.h:68
Pointer(const shared_ptr< Class > &object, ValueType(Class::*getMethod)() const, void(Class::*setMethod)(ValueType))
Definition: Pointer.h:234
SharedAccessor(const shared_ptr< T > &object, GetMethod getMethod, SetMethod setMethod)
Definition: Pointer.h:177
virtual bool isNull() const
Definition: Pointer.h:198
SetMethod setMethod
Definition: Pointer.h:106
virtual Interface * clone() const =0
Accessor(T *object, GetMethod getMethod, SetMethod setMethod)
Definition: Pointer.h:140
SetMethod setMethod
Definition: Pointer.h:136
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Pointer.h:167
const ValueType operator*() const
Definition: Pointer.h:339
virtual Interface * clone() const
Definition: Pointer.h:92
virtual bool isNull() const =0
virtual ValueType get() const =0
virtual Interface * clone() const
Definition: Pointer.h:194
ValueType * value
Definition: Pointer.h:78
IndirectValue(Pointer *p)
Definition: Pointer.h:321
#define debugAssert(exp)
Definition: debugAssert.h:160
virtual void set(ValueType v)
Definition: Pointer.h:184
void setValue(const ValueType &v)
Assign a value to the referenced element. If this Pointer was initialized with a NULL setMethod...
Definition: Pointer.h:311
Pointer(Class *object, ValueType(Class::*getMethod)() const, void(Class::*setMethod)(ValueType))
Definition: Pointer.h:295
Pointer(const ValueType &(*getMethod)(), void(*setMethod)(ValueType))
Definition: Pointer.h:253
Pointer(Class *object, const ValueType &(Class::*getMethod)() const, void(Class::*setMethod)(const ValueType &))
Definition: Pointer.h:274
Pointer()
Definition: Pointer.h:207
Pointer(const shared_ptr< Class > &object, ValueType(Class::*getMethod)() const, void(Class::*setMethod)(const ValueType &))
Definition: Pointer.h:260
Pointer(ValueType(*getMethod)(), void(*setMethod)(ValueType))
Definition: Pointer.h:248
virtual bool isNull() const
Definition: Pointer.h:160
GetMethod getMethod
Definition: Pointer.h:171
virtual bool isNull() const
Definition: Pointer.h:127
Pointer(Class *object, ValueType(Class::*getMethod)() const, void(Class::*setMethod)(const ValueType &))
Definition: Pointer.h:281
shared_ptr< T > object
Definition: Pointer.h:170
Interface * m_interface
Definition: Pointer.h:203
bool isNull(const Pointer< T > &p)
Definition: Pointer.h:345
Pointer * pointer
Definition: Pointer.h:320
Pointer & operator=(const Pointer &r)
Definition: Pointer.h:217
virtual void set(ValueType v)
Definition: Pointer.h:84
Pointer(const Pointer &p)
Definition: Pointer.h:227
void operator=(const ValueType &v)
Definition: Pointer.h:325
virtual void set(ValueType v)
Definition: Pointer.h:146
Pointer(const shared_ptr< Class > &object, const ValueType &(Class::*getMethod)() const, void(Class::*setMethod)(ValueType))
Definition: Pointer.h:241
~Pointer()
Definition: Pointer.h:300
FcnAccessor(GetMethod getMethod, SetMethod setMethod)
Definition: Pointer.h:110
virtual Interface * clone() const
Definition: Pointer.h:123
#define const
Definition: zconf.h:217
virtual void set(ValueType v)
Definition: Pointer.h:113
virtual Interface * clone() const
Definition: Pointer.h:156
T * object
Definition: Pointer.h:134
virtual void set(ValueType b)=0
bool isNull() const
Definition: Pointer.h:212
Memory(ValueType *value)
Definition: Pointer.h:82
GetMethod getMethod
Definition: Pointer.h:105
virtual bool isNull() const
Definition: Pointer.h:96