Sending events across address spaces serializedBufferSize - the size of the parameter serializedBuffer Example of serialization/unserialization functions The example refers to the event evStart , which is defined as follows:
struct evStart { RiCEvent ric_event; /*** User explicit entries ***/ }; char* msg; RhpAddress evStartSerialize(struct RiCEvent* const ev, const RhpAddress buffer, RhpPositive bufferSize, RhpPositive* resultBufferSize) { evStart* castedEv = (evStart*)ev; RhpPositive msgLength = strlen(castedEv->msg); /* Testing the size of the message parameter against the size of local buffer */ if (bufferSize { /* buffer too small - serialization is aborted */ return NULL; } /* copy the message string + the null terminating */ memcpy(buffer, castedEv->msg, msgLength + 1); *resultBufferSize = msgLength + 1; return buffer; } The function below uses a local buffer called receivedBuffer to store the string of the event evStart which was passed as a parameter.
RiCEvent* evStartUnserialize(RhpAddress const serializedBuffer, RhpPositive serializedBufferSize) { /* copy the message to a local buffer */ memcpy(receivedBuffer, serializedBuffer, serializedBufferSize); return (RiCEvent*)RiC_Create_evStart(receivedBuffer); } Rational Rhapsody 755