T
toton
Hi,
I have an enum as
enum DitectionType{
X,Y,XD,YD
} ;
Now I want to wrap it with a class which returns orthogonal direction
for it. i.e X -> Y , Y-> X, XD-> YD, YD->XD mapping should be there.
I can think of an static array which stores this mapping, and returns
the value based on index, rather than doing some if else.
Can anybody hint a good way to do it ( the primitive way is an global
static array of 4 element which can return the map like DirectionType
ortho[4] = {Y, X,YD,XD }; But I want a more descent and full proof
solution)
A second thing separately ,not for the above one, I want to make or or
some this enum. So instead of specifing an int, I need so specify a
set among those or / and values (may be using a set )
like I want X|Y to specify either X or Y direction, which should also
be a valid parameter type.
Thanks
abir
I have an enum as
enum DitectionType{
X,Y,XD,YD
} ;
Now I want to wrap it with a class which returns orthogonal direction
for it. i.e X -> Y , Y-> X, XD-> YD, YD->XD mapping should be there.
I can think of an static array which stores this mapping, and returns
the value based on index, rather than doing some if else.
Can anybody hint a good way to do it ( the primitive way is an global
static array of 4 element which can return the map like DirectionType
ortho[4] = {Y, X,YD,XD }; But I want a more descent and full proof
solution)
A second thing separately ,not for the above one, I want to make or or
some this enum. So instead of specifing an int, I need so specify a
set among those or / and values (may be using a set )
like I want X|Y to specify either X or Y direction, which should also
be a valid parameter type.
Thanks
abir