Overview
C API (Component Interface)
struct EventStateSet { UINT32 flags; Symbol state; };

This event requires the component to set its state completely from the SystemML State node passed in state. This should leave the component in a state that is completely predictable from the passed information (i.e. all previous state information must be erased), and the component should raise an error if this is not possible.

Context

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

Fields

UINT32 flags IN
For a data object, either F_UNDEFINED or F_ZERO may be set. If neither is set, a Data object should, as other Components, set its state from the state field.
Symbol state IN
The component State from a SystemML document.

Flags

F_UNDEFINED
State should be set to "undefined", whatever that means to this Data class.
F_ZERO
State should be set to "zero", whatever that means to this Data class.

Action

  • Set state
    • IF F_UNDEFINED or F_ZERO is set, set state appropriately.
    • ELSE set state from state.
  • For a process only, create all input and output sets.

Example

From std/data/numeric

C++ Source Code (against 1199)
case EVENT_STATE_SET: { EventStateSet* ess = (EventStateSet*)event->data; if (ess->flags & F_UNDEFINED) { // set everything to NaNs ... DOUBLE undef = numeric_limits<DOUBLE>::quiet_NaN(); DOUBLE* p_content = (DOUBLE*) p_state.real; for (UINT32 i=0; i<structure.numberOfElementsTotal; i++) p_content[i] = undef; ... } else if (ess->flags & F_ZERO) { // set everything to zero memset((void*)p_state.real, 0, structure.numberOfBytesTotal); } else { // expect DataML node XMLNode xmlNode(hComponent, ess->state); DataMLNode node(&xmlNode); ... node.getRaw((BYTE*)p_state.real, (BYTE*)p_state.imag); } // ok return C_OK; }

From std/source/numeric

C++ Source Code (against 1199)
case EVENT_STATE_SET: { EventStateSet* ess = (EventStateSet*)event->data; // TODO: when source/numeric is updated to 1199, fill this in // ok return C_OK; }