Changes between Version 2 and Version 3 of Documentation/Serialization
- Timestamp:
- Feb 4, 2010, 6:27:47 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Documentation/Serialization
v2 v3 66 66 As 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. 67 67 68 The actual code from !PingPongMessage looks as follows: 69 {{{ 70 #!cpp 71 sznBeginDefault( ariba::application::pingpong::PingPongMessage, X ) { 72 X && id && T(name); 73 } sznEnd(); 74 }}} 75 Note 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 81 It 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 68 84 In your {*.cpp} class you require a further macro. In case of the !PingPong sample this is simply: 69 85 {{{ … … 71 87 vsznDefault(PingPongMessage); 72 88 }}} 89 90 91 92 93 94 95 96 97 98 73 99 74 100