Changes between Version 2 and Version 3 of Documentation/Serialization


Ignore:
Timestamp:
Feb 4, 2010, 6:27:47 PM (14 years ago)
Author:
Christoph Mayer
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/Serialization

    v2 v3  
    6666As you can see above, CLASSNAME is in the case of the !PingPong sample the complate namespace with the class name {{{ariba::application::pingpong::PingPongMessage}}}. Furthermore the variables that are meant for serialization are combined to the {{{X}}} using the {{{&&}}} operator. This operator is invoked both when serializing and when deserializing. Therefore, this is the only special code handling required.
    6767
     68The actual code from !PingPongMessage looks as follows:
     69{{{
     70#!cpp
     71sznBeginDefault( ariba::application::pingpong::PingPongMessage, X ) {
     72        X && id && T(name);
     73} sznEnd();
     74}}}
     75Note the {{{T()}}} macro that is used for serialization of {{{std::string}}} objects. The following special handlers are provided:
     76 * integer support - I( value, length )
     77 * const int support - cI( uintmax_t )
     78 * const char* support - cT( const char* )
     79 * string and char* support, T( char* | std::string )
     80
     81It is always best to use types that have a specified length, e.g. {{{uint8_t}}}, {{{uint16_t}}}, ... etc. If you are serializing through a
     82
     83
    6884In your {*.cpp} class you  require a further macro. In case of the !PingPong sample this is simply:
    6985{{{
     
    7187vsznDefault(PingPongMessage);
    7288}}}
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
    7399
    74100