Prev: inlining of functions returning an unwindable object
Next: Templated return value "is being used without being initialized"
From: Brian on 29 Nov 2009 02:04 Release 1.10 of the C++ Middleware Writer is now available on line. This release has the following changes: 1. Support added for stream constructors. Previously types were required to have default constructors in order to be (de)marshalled by the C++ Midddle Writer. A function named Receive was then called to demarshall the object. Below is an example of how the code has changed in this area. The old version is shown first with some added comments to indicate how things have changed in the new version. inline void Base::BuildPolyInstance(Buffer* buf, Base*& p) { unsigned short type_num; // --> uint16_t buf->PersistentRead(&type_num, sizeof(type_num)); switch (type_num) { case Base_num: p = new Base; // --> p = new Base(buf); break; case Derived_num: p = new Derived; // --> p = new Derived(buf); break; default: throw failure("Base::BuildPolyInstance: Unknown type"); } p->Receive(buf); // This typically virtual function call } // is no longer needed. // new version as of release 1.10. inline void Base::BuildPolyInstance(Buffer* buf, Base*& p) { uint16_t type_num; buf->PersistentRead(&type_num, sizeof(type_num)); switch (type_num) { case Base_num: p = new Base(buf); break; case Derived_num: p = new Derived(buf); break; default: throw failure("Base::BuildPolyInstance: Unknown type"); } } 2. Support added for int8_t, int16_t, int32_t, uint8_t, uint16_t and uint32_t. 3. The command line interface to the C++ Middleware Writer -- http://webEbenezer.net/build_integration.html -- has been tested on a big-endian Mac. The program also works on little-endian machines. I'm interested in hearing what your thoughts are on the C++ Middleware Writer. Shalom Brian Wood http://webEbenezer.net -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |