[GCC-XML] Xrtti.h

Balasubramanyam, Shivakumar sbalasub at qualcomm.com
Thu Apr 26 02:15:37 EDT 2007


> BTW, I have been thinking on working on the C++ object serialization of
> data as well. In my case the specification would be in the XSD.

Yes, there is considerable interest I think in serializing C++ objects to
XML.  I personally have no interest in XML and prefer compact binary
formats.  There already exist some projects to do C++ serialization into
XML (and other formats), such as Boost::Serialization, and s11n.  But
these all require that the developer essentially implement serialization
manually for each class using macros provided by the tool.

As you have probably already decided for yourself, it would be much nicer
if a tool took care of all of this for you, so that there is no effort
needed on the part of the programmer (aside from running an extra program
during build time) to have serialization of C++ objects.

[Shiva]
**
 I may have not been clear earlier. XSD definitions would be used to only provide 
data type declarations. This the main entry point. The generated code would contain C++ 
classes and provide serialization in binary form for efficiency reasons.
 
As you correctly intrepeted, I would have the generated code to mostly reflect 
Boost::Serialization framework though actually use boost code.
 
My motivation to use XSD is to be used for documentation as well. This would also
refer as a interface spec for syseng/developmenttools/testing/ etc.
 
Our differences as far as I undersand.
 
Your scheme,
1. Define CPP_Interface through class definitions and using basic types.
2. Use GCCXML to generate CPP_Interface_XML
3. Use CPP_Interface_XML to generate serialization code.
 
My scheme,
1. Define Basic Types and User Defined types in XSD.
2. a.  A parser would understand and generate the CPP or Python or Perl classes for class declarations
    b. The parser would also generate Serialization methods which will be say in binary form.
 
I understand with your dislike of XML for serialization output, but I see no reason why C++ class
would win over XSD for interface specification.
 
Infact, in your scheme XML is indeed in one of the steps before feeding to your code generator.
 
I also had much debate to seperate the data classes with serialization methods for layering code.
 
I do have one trick problem with defining interface, how do you handle conditional definitions?
 
In example,
class response
{
        bool status;
         UserDefinedTypeSuccessRecord record;
}
If we want to define UserDefinedTypeSuccessRecord is valid or serialized only if status is set to true.
 
I had not thought about to combine your C++ Reflection library with Serialization framework, 
though I see why not.
 
We can continue the conversation in private if we are boring the rest of the group :-) My id is shiva at qualcomm.com
 
**
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/gccxml/attachments/20070425/ef132510/attachment.html>


More information about the gccxml mailing list