I'm trying to figure out what is the best approach here. Basically I have a system where I receive external requests in order to set/get values in my model. The problem is that my model consists on C++ classes, which can be nested, whereas the requests are simple (key, value) pairs.
For example:
struct Foo {
void setX(int x);
int getX() const;
struct Boo {
void setY(float y);
float getY() const;
}:
};
If I receive a request that says set(y, 21)
for a given element e, then the actions I need to perform will be different depending on whether or not foo and boo already exist. Having to take care of the different possibilities for each property would end up in writing a lot of code.
Before reinventing the wheel, I was wondering if there is already a library or a well-known technique in C++ that allows mapping this flat actions into changes in C++ structures (which can be nested) in a generic way.
Thanks