SYNOPSIS

#include <Inventor/scxml/ScXMLTransitionElt.h>

Inherits ScXMLElt.

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 run-time 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

Static Public Member Functions

static ScXMLEltReader * getElementReader (void)

static SoType getClassTypeId (void)

static void * createInstance (void)

static void initClass (void)

static void cleanClass (void)

Protected Attributes

char * event

char * cond

char * target

char * anchor

SbBool needprefixmatching

SbName eventkey

SbName targetkey

Additional Inherited Members

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

\fBSoType\fP ScXMLTransitionElt::getTypeId (void) const\fC [virtual]\fP

Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and 'downward' casting.

See also:

SoBase::getTypeId() const

Implements ScXMLElt.

SbBool ScXMLTransitionElt::handleXMLAttributes (void)\fC [virtual]\fP

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.

const \fBScXMLElt\fP * ScXMLTransitionElt::search (const char *attrname, const char *attrvalue) const\fC [virtual]\fP

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

Returns NULL if nothing was found.

This function needs to be reimplemented to traverse child elements.

Reimplemented from ScXMLElt.

SbBool ScXMLTransitionElt::isConditionLess (void) const

Returns whether this is a conditionless SCXML transition or not.

A conditionless transition should always be taken.

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.

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.

SbBool ScXMLTransitionElt::isEventMatch (const \fBScXMLEvent\fP *eventobj) const\fC [virtual]\fP

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

SbBool ScXMLTransitionElt::evaluateCondition (\fBScXMLStateMachine\fP *statemachine)\fC [virtual]\fP

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.

void ScXMLTransitionElt::execute (\fBScXMLStateMachine\fP *statemachine) const\fC [virtual]\fP

Calls invoke on all the ScXMLInvoke children.

Author

Generated automatically by Doxygen for Coin from the source code.