P
Perry St-Germain
Typically C++ persistence implementations, (from the little I've seen),
boils down to something like this:
myclass {
int ivar;
float fvar;
...
saveyourself( file )
{
file.write(ivar);
file.write(fvar);
...
}
};
With this approach we always have to write the code to unwind the variables
to or from the storage media. This can be a big job for objects that involve
complex class hierarchies, and it could impact performance as well.
Another approach is to write/read binary chunks and then use inplace
activation techniques. This is better but what happens when the structure
changes ..., then you need to write conversion functions and you end up
writing code similar to the above where you need to unwind the variables
again.
I'm thinking there must be a better way. After all isn't this exactly what
COM and Corba or XML does to marshal an interface or data structure. With
these frameworks you generally don't have to do the unwinding code yourself
there is typically a tool that does it for you. Is there a way to leverage
these tools to solve the C++ persistence problem, or perhaps there is some
other code available? Am I missing something here?
Any suggestions or links?
Thanks,
Perry.
boils down to something like this:
myclass {
int ivar;
float fvar;
...
saveyourself( file )
{
file.write(ivar);
file.write(fvar);
...
}
};
With this approach we always have to write the code to unwind the variables
to or from the storage media. This can be a big job for objects that involve
complex class hierarchies, and it could impact performance as well.
Another approach is to write/read binary chunks and then use inplace
activation techniques. This is better but what happens when the structure
changes ..., then you need to write conversion functions and you end up
writing code similar to the above where you need to unwind the variables
again.
I'm thinking there must be a better way. After all isn't this exactly what
COM and Corba or XML does to marshal an interface or data structure. With
these frameworks you generally don't have to do the unwinding code yourself
there is typically a tool that does it for you. Is there a way to leverage
these tools to solve the C++ persistence problem, or perhaps there is some
other code available? Am I missing something here?
Any suggestions or links?
Thanks,
Perry.