Overview
C API (Core)
struct EventContent { UINT8* stream; UINT64 bytes; };
Notes
  • In this event, the Component is expected to provide the data structure that is pointed to by Event::data.

The process should marshal its content into a binary stream, and return a pointer to that stream. This call is used to propagate data between processes in non-shared-memory environments, so, for efficiency, data objects should maintain their content ready-marshaled to respond to this event, if that does not introduce overhead internally.

The stream returned must have empty space reserved at the head for the framework to insert a message header before dispatch. This should be of size systemInfo.contentHeaderBytes. This header will not be passed back to the object on a call to EVENT_CONTENT_SET (it will have been stripped off by the framework). Note that this header should not be counted in the byte count returned.

Fields

UINT8* stream OUT
Where the object should place a pointer to its marshaled content (including space reserved for a header).
UINT64 bytes OUT
Where the object should place the length in bytes of its marshaled content (minus the header).

Action

  • If not already done, marshal content into a single binary stream. The stream need only be readable by this release of this component, since it will be used only in a call to EVENT_CONTENT_SET. The stream must have systemInfo.contentHeaderBytes bytes reserved at the front for use by the framework.
  • Return marshaled content as a binary stream, setting the two output fields specified above.

Example

C++ Source Code (against 1199)
// extract data EventContent* ec = (EventContent*)event->data; // marshal content VBYTE content; content.resize(systemInfo->contentHeaderBytes + myContentBytes); for (UINT32 b=0; b<myContentBytes; b++) { UINT32 c = b + systemInfo->contentHeaderBytes; content[c] = myBytes[b]; } // pass stream ec->stream = &content[0]; ec->bytes = myContentBytes;