Methods provided for implementing serialization

When the properties are set to generate the relevant code, the following public virtual member functions are generated for reactive classes:

Note: For the C functions, the prefix <class name> refers to the "class" in the model, for which the statechart was created.
  • virtual int getStatechartSize() for C++

    int <class name>_getStatechartSize(<class name>* me) for C

    Returns the number of variables that the statechart uses. Use this function to allocate the state vector that is passed to the function getStatechartStates.

  • virtual void getStatechartStates(int stateVector[], unsigned long& oxfReactiveState) const for C++

    void <class name>_getStatechartStates(const <class name>* const me, int stateVector[], unsigned long* oxfReactiveState) for C

    Fills stateVector with the current statechart state, and sets oxfReactiveState based on the OMReactive internal state.

    The type of oxfReactiveState is taken from the [C][CPP]_CG::Framework::ReactiveStateType property.

    The type of stateVector is taken from the CG::Statechart::FlatStateType (default value is int) property.

    In WithoutReactive mode, the last argument is eliminated and the function prototypes become:

    • virtual void getStatechartStates(int stateVector[])
      for C++
    • void <class name>_getStatechartStates(const <class name>* const me, int stateVector[]) for C
  • virtual void setStatechartStates(int stateVector[], unsigned long* oxfReactiveState) for C++

    void <class name>_setStatechartStates(<class name>* const me, int stateVector[], unsigned long* oxfReactiveState) for C

    Set the reactive instance states as well as the OMReactive internal state.

    The type of oxfReactiveState is taken from the [C][CPP]_CG::Framework::ReactiveStateType property.

    The type of stateVector is taken from the CG::Statechart::FlatStateType (default value is int) property.

Note: If setStatechartState is used during animation, then the instance statechart will not display new states. In order to "refresh" the statechart, you can switch to Silent animation mode, run the animation, and then switch back to Watch animation mode.