MoochoPack: Miscellaneous Utilities for MOOCHO  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Macros
Macros that add <<std aggr>> members for an association.

For example, if you want to include a <<std aggr>="">> association with an object of type MyClass of the name my_object you would include the macro in the public section of YourClass declaration as follows: More...

Macros

#define STANDARD_AGGREGATION_MEMBERS(TYPE, NAME)
 Insert class members for a non-const association. More...
 
#define STANDARD_CONST_AGGREGATION_MEMBERS(TYPE, NAME)
 Insert class members for a constant association. More...
 

Detailed Description

For example, if you want to include a <<std aggr>="">> association with an object of type MyClass of the name my_object you would include the macro in the public section of YourClass declaration as follows:

 class YourClass {
 public:
   STANDARD_AGGREGATION_MEMBERS( MyClass, my_object )
 };

Note that the macro addes the private member #TYPE* NAME_# to the class declaration and therefore the member NAME_ is available for direct access (in a constructor for example).

In order to have a const only association use:

 class YourClass {
 public:
   STANDARD_CONST_AGGREGATION_MEMBERS( MyClass, my_object )
 };

Macro Definition Documentation

#define STANDARD_AGGREGATION_MEMBERS (   TYPE,
  NAME 
)
Value:
public: \
void set_ ## NAME ( TYPE* NAME ) \
{ NAME ## _ = NAME; } \
TYPE* get_ ## NAME() \
{ return NAME ## _; } \
const TYPE* get_ ## NAME() const \
{ return NAME ## _; } \
TYPE& NAME() \
{ \
return StandardCompositionRelationshipsPack::role_name( \
NAME ## _, false, " ## NAME ## " ); \
} \
const TYPE& NAME() const \
{ \
return StandardCompositionRelationshipsPack::role_name( \
NAME ## _, false, " ## NAME ## " ); \
} \
private: \
TYPE* NAME ## _; \
public:

Insert class members for a non-const association.

Definition at line 77 of file StandardAggregationMacros.hpp.

#define STANDARD_CONST_AGGREGATION_MEMBERS (   TYPE,
  NAME 
)
Value:
public: \
void set_ ## NAME ( const TYPE* NAME ) \
{ NAME ## _ = NAME; } \
const TYPE* get_ ## NAME() const \
{ return NAME ## _; } \
const TYPE& NAME() const \
{ \
return StandardCompositionRelationshipsPack::const_role_name( \
NAME ## _, false, " ## NAME ## " ); \
} \
private: \
const TYPE* NAME ## _; \
public:

Insert class members for a constant association.

Definition at line 100 of file StandardAggregationMacros.hpp.