The states are added to the class definition at the various levels of protection. They are set to these variables in the Constructor. The states themselves are actually defined in the parent class CO. The state entry functions are set to the states in the Builder initialization.
This is important for two reasons. First, because the entry functions are on the Builder, the entry functions can be overridden by extending Builders. Secondly, since the methods themselves can be virtual and thus overridden, they have to have their method pointers given AFTER all the Builder has been instantiated so it has to be set outside of the constructor.
The following defines are used:
CHASMDECLARESTATES_PUBLIC
CHASMDECLARESTATES_PROTECTED
CHASMDECLARESTATES_PRIVATE
CHASMASSIGNSTATES
CHASMASSIGNENTRYFUNCS
this generates the following code for a concept with states named 'first' and 'second'.
State *first, *second;
the following code is generated:
first = findState("first");
second = findState("second");
For setting the state entry functions, the following code is generated in the Builder::builderInitialization() method:
DIRECTOR->createEntryFunction("first",(CO_m)&CHASMCONCEPTBuilder::do_first);
DIRECTOR->createEntryFunction("second",(CO_m)&CHASMCONCEPTBuilder::do_second);
NOTE: The state entry function is assumed to be do_<state>.