ScXMLTransitionElt Class Reference
State Chart XML Classes

the `<transition>` SCXML element. More...

`#include <Inventor/scxml/ScXMLTransitionElt.h>`

Inheritance diagram for ScXMLTransitionElt:

## Public Member Functions

virtual SoType | getTypeId (void) const
| Returns the type identification of an object derived from a class inheriting SoBase. This is used for runtime type checking and "downward" casting.
virtual void | setEventAttribute (const char *event)
const char * | getEventAttribute (void) const
virtual void | setCondAttribute (const char *cond)
const char * | getCondAttribute (void) const
virtual void | setTargetAttribute (const char *target)
const char * | getTargetAttribute (void) const
virtual void | setAnchorAttribute (const char *anchor)
const char * | getAnchorAttribute (void) const
virtual SbBool | handleXMLAttributes (void)
virtual void | copyContents (const ScXMLElt *rhs)
virtual const ScXMLElt * | search (const char *attrname, const char *attrvalue) const
SbBool | isConditionLess (void) const
SbBool | isTargetLess (void) const
SbBool | isSelfReferencing (void) const
virtual SbBool | isEventMatch (const ScXMLEvent *event) const
virtual SbBool | evaluateCondition (ScXMLStateMachine *statemachine)
virtual int | getNumExecutables (void) const
virtual ScXMLExecutableElt * | getExecutable (int idx) const
virtual void | addExecutable (ScXMLExecutableElt *executable)
virtual void | removeExecutable (ScXMLExecutableElt *executable)
virtual void | clearAllExecutables (void)
virtual void | execute (ScXMLStateMachine *statemachine) const
Public Member Functions inherited from ScXMLElt
void | setXMLAttribute (const char *attribute, const char *value)
const char * | getXMLAttribute (const char *attribute) const
ScXMLElt * | clone (void) const
virtual void | setContainer (ScXMLElt *container)
ScXMLElt * | getContainer (void) const
SbBool | isContainedIn (const ScXMLElt *object) const
Public Member Functions inherited from ScXMLObject
SbBool | isOfType (SoType type) const
| Returns `TRUE` if the type of this object is either of the same type or inherited from type.

## Static Public Member Functions

static ScXMLEltReader * | getElementReader (void)
static SoType | getClassTypeId (void)
static void * | createInstance (void)
static void | initClass (void)
static void | cleanClass (void)
Static Public Member Functions inherited from ScXMLElt
static SoType | getClassTypeId (void)
static void | initClass (void)
static void | cleanClass (void)
Static Public Member Functions inherited from ScXMLObject
static SoType | getClassTypeId (void)
| This static method returns the SoType object associated with objects of this class.
static void | initClass (void)
| Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.
static void | cleanClass (void)
| Does the opposite of initClass, deallocates any class specific resources and resets the class to an uninitialized state with respect to the Coin type system.

## Protected Attributes

char * | event
char * | cond
char * | target
char * | anchor
SbBool | needprefixmatching
SbName | eventkey
SbName | targetkey

## Additional Inherited Members

Static Protected Member Functions inherited from ScXMLElt
static void | registerClassType (const char *xmlns, const char *classname, SoType type)
static void | registerInvokeClassType (const char *xmlns, const char *targettype, const char *source, SoType type)
Static Protected Member Functions inherited from ScXMLObject
static void | registerClassType (const char *xmlns, const char *classname, SoType type)
static void | registerInvokeClassType (const char *xmlns, const char *targettype, const char *source, SoType type)

## Detailed Description

the `<transition>` SCXML element.

The `<transition>` element is used for invoking executable code and transition from the current active states in a state machine to a new set of active states.

By plural active states, it is meant that all the parent states of active states are also active at the same time, which is helpful when organizing common event triggered `<transition>` transitions. Putting transitions in the root `<scxml>` element means that they are always active.

You also have the concept of parallel states in SCXML. This is not yet supported in Coin SCXML.

The following attributes are accepted:

- `event`
- `cond`
- `target`
- `anchor` - not supported

The `event` attribute specifies the event that the transition will trigger for, if the `<transition>` element is in an active state. The event attribute can be specified with wildcard matching using `"*"`, but with the following restrictions:

- `"*"` must be at the end of the event name match.
- `"*"` must match full dot-separated words.

Example 1: `event="*"`

Example 2: `event="error.*"`

The `cond` attribute can be used to specify additional conditions that must be met for the `<transition>` to be triggered. The condition expression language depends on which profile the SCXML state machine uses.

The `"minimum"` profile only specifies one function, which is the `In`({ID}) function. In() evaluates to TRUE if the state machine is currently in the state with the given ID.

The `"x-coin"` profile implements a number of expressions that evaluates to a truth value. While in development, documenting the expression language seems like too much overhead, so that part will have to wait. The source code can do the talking. See Coin/src/scxml/eval-coin-tab.y.

The `target` attribute specifies the target states to transition to. If parallel states had been implemented, you would be able to specify multiple states in this attribute, but for now you can only specify one target state. If `target` is dropped, then the transition does not change what the active state is and will just execute the executable parts it contains. If `target` is the `id` of the `state` the `<transition>` is in, the state will be left/exited and then reentered again. For active substates, this means they will also be exited of course.

The `anchor` attribute is not supported.

`<transition>` elements can contain executable SCXML elements as XML children, meaning `<if>` /`<elseif>` / `<else>`, `<assign>`, `<send>`, `<event>`, `<log>`.

Since
  Coin 3.0

See also
  ScXMLIfElt, ScXMLAssignElt, ScXMLSendElt, ScXMLEventElt, ScXMLLogElt

## Member Function Documentation

## getTypeId()

SoType ScXMLTransitionElt::getTypeId | ( | void |  | ) | const

virtual

Returns the type identification of an object derived from a class inheriting SoBase. This is used for runtime type checking and "downward" casting.

See also
  SoBase::getTypeId() const

Implements ScXMLElt.

## handleXMLAttributes()

SbBool ScXMLTransitionElt::handleXMLAttributes | ( | void |  | ) |

virtual

This method is called when the file reader has set all the XML attributes on the object, and wants the object to handle them and report if the values were OK or if a read error should be produced.

Returns
  TRUE if the attributes are OK, and FALSE on error.

This base class implementation does nothing and just returns TRUE.

Reimplemented from ScXMLElt.

## copyContents()

void ScXMLTransitionElt::copyContents | ( | const ScXMLElt * | rhs | ) |

virtual

Reimplemented from ScXMLElt.

## search()

const ScXMLElt * ScXMLTransitionElt::search | ( | const char * | attrname,
|  | const char * | attrvalue ) const

virtual

This method searches the SCXML structure for an element with the given attribute value for the given attribute.

Returns NULL if nothing was found.

This function needs to be reimplemented to traverse child elements.

Reimplemented from ScXMLElt.

## isConditionLess()

SbBool ScXMLTransitionElt::isConditionLess | ( | void |  | ) | const

Returns whether this is a conditionless SCXML transition or not.

A conditionless transition should always be taken.

## isTargetLess()

SbBool ScXMLTransitionElt::isTargetLess | ( | void |  | ) | const

Returns whether this is a transition without a target setting or not.

When a targetless transition is taken, the state machine's state does not change. This differs from setting the target to its own state, which will cause the state machine to leave the state and reenter it again.

## isSelfReferencing()

SbBool ScXMLTransitionElt::isSelfReferencing | ( | void |  | ) | const

Returns whether this transition is referencing its container or not.

If TRUE, this means you should end up in the same state as you started with when doing this transition. Note however that as opposed to a targetless transition, this transition should actually exit the state and then reenter it again. Executable content will be invoked after exiting the state, before reentering.

## isEventMatch()

SbBool ScXMLTransitionElt::isEventMatch | ( | const ScXMLEvent * | eventobj | ) | const

virtual

This function returns TRUE if the transition matches the given eventobj object and FALSE otherwise.

## evaluateCondition()

SbBool ScXMLTransitionElt::evaluateCondition | ( | ScXMLStateMachine * | statemachine | ) |

virtual

This function uses the statemachine evaluator to evaluate its condition expression, and returns TRUE or FALSE based on the evaluation.

On expression error, error events are emit'ed to the SCXML state machine.

If the transition is conditionless, this function will return TRUE.

## execute()

void ScXMLTransitionElt::execute | ( | ScXMLStateMachine * | statemachine | ) | const

virtual

Calls invoke on all the ScXMLInvoke children.

The documentation for this class was generated from the following files:

- ScXMLTransitionElt.h
- ScXMLTransitionElt.cpp