D
David Resnick
Given this code fragment:
#define IFV(func, number) \
incomingFunctVal<CVxicBridgedXferIncomingAction> val##number
( \
number, &CVxicBridgedXferIncomingAction::func); \
m_transFnMap.insert(fnMap::value_type(#func, val##number));
IFV( DoJoin, 1 );
IFV( DoJoinRestartReco, 2 );
IFV( DummyAction, 3 );
IFV( RestartReco, 4 );
....
IFV( SomeFunc, 100 );
I'm wondering if there is a way to have the numbers in the function
macro increment automatically?
The code in the macro isn't really subject to change (it is the way to
use a state machine
implementation that I can't modify). I'm just finding it to be a
maintenance pain when
I want to delete a function with a middle number. I've been swapping
the last
function into the place of the deleted one to avoid renumbering the
rest, which is
OK in that order doesn't matter, but is there a better way? The fact
that ## is
used to glue the number into an identifier makes me doubt that this
can be repaired,
but I'd be very happy to be proved wrong.
Thanks!
-David
#define IFV(func, number) \
incomingFunctVal<CVxicBridgedXferIncomingAction> val##number
( \
number, &CVxicBridgedXferIncomingAction::func); \
m_transFnMap.insert(fnMap::value_type(#func, val##number));
IFV( DoJoin, 1 );
IFV( DoJoinRestartReco, 2 );
IFV( DummyAction, 3 );
IFV( RestartReco, 4 );
....
IFV( SomeFunc, 100 );
I'm wondering if there is a way to have the numbers in the function
macro increment automatically?
The code in the macro isn't really subject to change (it is the way to
use a state machine
implementation that I can't modify). I'm just finding it to be a
maintenance pain when
I want to delete a function with a middle number. I've been swapping
the last
function into the place of the deleted one to avoid renumbering the
rest, which is
OK in that order doesn't matter, but is there a better way? The fact
that ## is
used to glue the number into an identifier makes me doubt that this
can be repaired,
but I'd be very happy to be proved wrong.
Thanks!
-David