Suppose i have a structure or a similar class(C++) like this :
struct str
{
int a = 5;
char b = 'x';
};
Is there a way to enumerate its members.I want to find the names of the members, the values and if possible the datatypes.
My purpose is to build a config file. So i basically have to represent command packet structures in some way. When the actual data comes i want to compare the packet with this config file and then process it. So there are different command types. So each time when a packet comes, i have to take its opcode and check it with the names of the structures and return the appropriate structure that represents the format of that packet.
My thinking is to represent the command packet format in structures. If you can recommend other data structure to hold this, then also it is ok. The languages can be C or C++. Performance is top priority so xml and similar types are discouraged. In memory data structures are preferred. Any help is highly appreciated. Thank you