|
MoochoPack: Miscellaneous Utilities for MOOCHO
Version of the Day
|
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...
Defines | |
| #define | STANDARD_AGGREGATION_MEMBERS(TYPE, NAME) |
| Insert class members for a non-const association. | |
| #define | STANDARD_CONST_AGGREGATION_MEMBERS(TYPE, NAME) |
| Insert class members for a constant 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:
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 )
};
| #define STANDARD_AGGREGATION_MEMBERS | ( | TYPE, | |
| NAME | |||
| ) |
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 | |||
| ) |
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.
1.7.6.1