cisst-saw
Loading...
Searching...
No Matches
cmnAccessorMacros.h File Reference

Accessor macros. More...

Go to the source code of this file.

Macros

#define _cmnAccessorMacros_h
#define CMN_DECLARE_MEMBER_AND_ACCESSORS_INTERNAL(memberType, memberName)
#define CMN_DECLARE_MEMBER_AND_ACCESSORS(memberType, memberName)

Detailed Description

Accessor macros.

Macro Definition Documentation

◆ _cmnAccessorMacros_h

#define _cmnAccessorMacros_h

◆ CMN_DECLARE_MEMBER_AND_ACCESSORS

#define CMN_DECLARE_MEMBER_AND_ACCESSORS ( memberType,
memberName )
Value:
#define CMN_DECLARE_MEMBER_AND_ACCESSORS_INTERNAL(memberType, memberName)
Definition cmnAccessorMacros.h:33

Macro to declare a data member and implement accessor methods. This macro creates 4 different accessors, two to read and two to write. For example, the following call:

#define CMN_DECLARE_MEMBER_AND_ACCESSORS(memberType, memberName)
Definition cmnAccessorMacros.h:69

will create the 4 following methods:

double & Timestamp(void);
const double & Timestamp(void);
void SetTimestamp(double newValue);
void GetTimestamp(double & placeHolder) const;

Finally, when used in conjunction with SWIG, the method Get is modified to return a value by const reference.

◆ CMN_DECLARE_MEMBER_AND_ACCESSORS_INTERNAL

#define CMN_DECLARE_MEMBER_AND_ACCESSORS_INTERNAL ( memberType,
memberName )
Value:
protected: \
memberType memberName##Member; \
public: \
inline void Set##memberName(const memberType & newValue) { \
this->memberName##Member = newValue; \
} \
inline void Get##memberName(memberType & placeHolder) const { \
placeHolder = this->memberName##Member; \
} \
inline const memberType & memberName(void) const { \
return this->memberName##Member; \
} \
inline memberType & memberName(void) { \
return this->memberName##Member; \
} \
protected:

Macro used to declare a data member and implement accessor methods in a standard way. This macro should not be used, use CMN_DECLARE_MEMBER_AND_ACCESSORS instead.