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. Here's an example of how the code has changed in this area. The old version is shown first with added comments to indicate some of the changes 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.
template <typename B>
Base* 
Base::BuildPolyInstance(B* buf)
{
  uint16_t type_num;

  buf->Give(type_num);
  switch (type_num) {
  case Base_num:
        return new Base(buf);
        break;

  case Derived_num:
        return new Derived(buf);
        break;

  default:
    throw failure("Base::BuildPolyInstance: Unknown type");
  }
}

2. Support added for int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t and uint64_t.


Home