Consider the following statechart:

When you implement this statechart using the flat scheme, you expect the following methods to be added to the class and called through a series of a few function calls from rootState_dispatchEvent():
int MyClass::s2TakeNull() {
int res = eventNotConsumed;
s2_exit();
//#[ transition 2
f2();
f2();
//#]
s3_entDef();
res = eventConsumed;
return res;
};
int MyClass::s1TakeNull() {
int res = eventNotConsumed;
s1_exit();
//#[ transition 1
f1();
f1();
//#]
s2_entDef();
res = eventConsumed;
return res;
};
In fact, what happens is that the transition code (between the //#[ and //#] brackets) is immediately inlined (embedded) inside rootState_dispatchEvent(), as follows:
int MyClass::rootState_dispatchEvent(short id) {
int res = eventNotConsumed;
switch(rootState_active) {
case s1:
{
if(id == Null_id)
{
popNullConfig();
//#[ transition 1
f1();
f1();
//#]
pushNullConfig();
rootState_subState = s2;
rootState_active = s2;
res = eventConsumed;
}
break;
};
case s2:
{
if(id == Null_id)
{
popNullConfig();
//#[ transition 2
f2();
f2();
//#]
rootState_subState = s3;
rootState_active = s3;
res = eventConsumed;
}
break;
};
};
return res;
};
This code is more efficient because it saves a few function calls using inlining of code. Inlining is available using the CG::Class::ComplexityForInlining property of the class, which is set to 3 by default. This means that if the user code (the action part of the transition) is shorter than three lines, it is inlined (or embedded) where the function call used to be instead of the function call. To get the "expected" result (not inlined), set this property to 0.