Overview
C API (Component Interface)
struct EventStateGet { UINT32 flags; Symbol state; INT32 precision; };

This event requires the component to return its complete state as a SystemML State node. This must include enough information for the component to reconstruct its state completely from what has been stored at a later time.

If the passed state is S_NULL, the component should create a new state node and return it. If not, the passed node will be the most recent state of the component known to the framework (i.e. the value of state at the most recent call to either EVENT_STATE_GET or EVENT_STATE_SET). In this case, the component is free either to update the passed state, or to create a new node and return that (in which case, the passed-in state can be ignored, and its value overwritten - the framework will take care of deleting it).

Context

This event may be fired at any time (it is used to serialize components during system termination, to pass components between voices during dynamic load-balancing, and to pass data objects between voices during INITPHASE_CONNECT).

Fields

UINT32 flags IN
None currently defined.
Symbol state IN/OUT
The latest Process State node (originally from the System File), or S_NULL.
INT32 precision IN
See EVENT_LOG_INIT.

Action

Return complete component state as SystemML State node in state. If precision is equal to PRECISION_NOT_SET, the component should store itself at maximal precision (no loss of information); otherwise, the component should store itself at (or at a precision that is analagous to) precision significant figures.

Example

From std/data/numeric

C++ Source Code (against 1199)
case EVENT_STATE_GET: { EventStateGet* esg = (EventStateGet*)event->data; // create brand new <State> node and lay it in for return XMLNode xmlNode(hComponent, (const char*) NULL); esg->state = xmlNode.element; // wrap it in a DataMLNode interface DataMLNode state(&xmlNode); state.precision(esg->precision); // write it state.setRaw(structure.dims, structure.type, p_state.real, p_state.imag); // ok return C_OK; }

From std/source/numeric

C++ Source Code (against 1199)
case EVENT_STATE_GET: { EventStateGet* esg = (EventStateGet*)event->data; // TODO: when source/numeric implements this event, fill this in // ok return C_OK; }