Accessing stored structures for which I have xml description
I created a kind of introspection that allows a C ++ library that allows, using minimal macros and a fair amount of templating tricks, to declare structures and classes that are enriched with some meta information.
This meta-information captures all the important information about each field of the declared structure / class and at the end of the history you can, for each structure / class, enriched in this way to create an XML file that dumps, for each field, its name, type, len , offset, etc. etc.
For my problem, I don't need to support fields that are pointers, but only primitive types, arrays, and STL containers (vectors, lists, etc.).
The code that populates these meta-designated structures / classes ("producer") serializes them at some point (for now, this is a simple binary dump of all primitive types and all "buffers" used by STL containers, if any).
Now I need to start developing a "reader" that is capable at runtime , starting from the xml description that was generated by the "producer" to access the various fields of the stored data.
I think this is a problem with dynamically interpreting data dictionaries, but all I have found to know has to do with reading the xml data, while I have the binary data and its xml description ...
What's the best way to start with this? Is there something out there similar to this problem that I can get some inspiration for?
source to share
/ * smarc kept it simple * /
class xmlstream
{
...
};
class ibase
{
void read( xmlstream& rStream ) = 0;
void write( xmlstream& rStream ) = 0;
};
class classfactory
{
void produce( xmlstream& rStream );
void consume( xmlstream& rStream );
ibase* create( xmlstream& rStream );
void destroy( ibase* pBase );
};
class class1 : public ibase
{
static class1* create( );
static void destroy( class1* pObject );
void read( xmlstream& rStream );
void write( xmlstream& rStream );
};
class class2 : public ibase
{
static class1* create( );
static void destroy( class1* pObject );
void read( xmlstream& rStream );
void write( xmlstream& rStream );
};
Let me if it's not clear.