rad
5.2.0
|
#include <Helper.h>
Public Member Functions | |
Helper () | |
~Helper () | |
const std::string | printStateType (State *s) |
const std::string | printTransition (Transition *t) |
const std::string | printTransitions (std::list< Transition * > &transitions) |
const std::string | printTargetState (Transition *transitions) |
const std::string | printTargetStates (std::list< Transition * > &transitions) |
const std::string | printActions (std::list< Action * > &actions) |
const std::string | printActivities (std::list< Activity * > &activities) |
const std::string | printStates (State *s) |
const std::string | printStateMachine (StateMachine &) |
const std::string | formatStatus (std::set< State * > &status, const bool usefullyqualified=false) |
const std::string | formatStatus (std::list< State * > &status, const bool usefullyqualified=false) |
bool | compareStateDocOrder (State *s1, State *s2) |
void | sortAtomicStates (std::set< State * > &status, std::vector< State * > &sortedStatus) |
bool | isInState (const std::set< State * > &status, const std::list< std::string > &stateNames) |
bool | isInState (const std::list< State * > &status, const std::list< std::string > &stateNames) |
int | countParents (State *s) |
bool | isDescendant (State *s, State *p) |
std::set< State * > | getAncestors (std::list< State * > &states) |
std::set< State * > | getAncestors (State *state) |
std::list< State * > | getAncestorsList (std::set< State * > &states) |
std::list< State * > | getAncestorsList (State *) |
std::list< State * > | getAncestorsList (std::list< State * > &states) |
std::list< State * > | getProperAncestors (State *state, State *upperBound) |
State * | findLeastCommonAncestor (State *s1, State *s2) |
bool | eventMatch (const Event &e1, const Event &e2) |
std::list< State * > | getAtomicStates (std::set< State * > &states) |
std::list< State * > | getAtomicStates (std::list< State * > &states) |
bool | isPreempted (State *s, std::list< Transition * > &transitions) |
Static Public Attributes | |
static const std::string | LEAF_STATE_SEPARATOR = ";" |
static const std::string | COMP_STATE_SEPARATOR = "/" |
(Very old style) Helper class containing utilities functions. TODO could be replaced by free functions in a name space.
scxml4cpp::Helper::Helper | ( | ) |
Empty constructor.
scxml4cpp::Helper::~Helper | ( | ) |
Empty destructor.
Compare two states considering the location of the states in the SCXML document.
s1 | First state to compare. |
s2 | Second state to compare. |
Compare the position of states in the model: s1 < s2 if s1 appears in the model before s2.
This practically means that, in the list of substates maintained by the common ancestor, s1 is positioned before s2.
A nullptr is considered to be always before a non-null state.
s1 | First state to compare |
s2 | Second state to compare |
int scxml4cpp::Helper::countParents | ( | State * | s | ) |
Counts the number of parent states (ancestors) of a given state starting from 1. TODO change name to the method.
s | State given to start counting. |
This method is used by the StateComparator class to provide a way to compare states based on the number of parents (i.e. level in the state composition tree).
Checks whether two events match by comparing the identifers and the type.
e1 | First event. |
e2 | Second event. |
Finds the least common ancestor state of two given states. In other words it looks for the first parent state which is common to both given states.
s1 | First state. |
s2 | Second state. |
const std::string scxml4cpp::Helper::formatStatus | ( | std::list< State * > & | status, |
const bool | usefullyqualified = false |
||
) |
Creates a textual description of the given state.
status | List of states. |
usefullyqualified | if false it concatenates the parent states IDs. |
const std::string scxml4cpp::Helper::formatStatus | ( | std::set< State * > & | status, |
const bool | usefullyqualified = false |
||
) |
Obsolete method replaced by formatStatus() with std::list to retrieve the textual description of the given states. This method does not preserve the document order because the std::set is ordered on the pointer values which depends on the memory allocation.
status | Set of states. |
usefullyqualified | if false it concatenates the parent states IDs. |
Retrieves the ancestor states of a given state.
state | State to look for the parents. |
Retrieves the ancestor states of the given list of states.
states | List of states to look for the parents. |
Retrieves the ancestor states of the given state.
state | State to look for the parents. |
Retrieves the ancestor states of the given list of states.
states | List of states to look for the parents. |
Retrieves the ancestor states of the given set of states.
states | Set of states to look for the parents. |
Given a list of states, returns the atomic ones.
states | List of states. |
Given a set of states, returns the atomic ones.
states | Set of states. |
Retrieves the 'proper' ancestor states i.e. without the state itself.
state | State to look for the parents. |
upperBound | for the search, if NULL it searches till the very top state. |
Checks whether a state 's' descends from 'p'. In other words it checks whether 'p' is a parent of 's'.
s | State to check. |
p | Supposed parent state of s. |
This method verifies whether a state 's' is descendant from a state 'p'.
s | State to check. |
p | Supposed parent state of s. |
bool scxml4cpp::Helper::isInState | ( | const std::list< State * > & | status, |
const std::list< std::string > & | stateNames | ||
) |
Check whether the given state identifier(s) are in the given list of states.
status | List of states (usually the current active state configuration). |
stateNames | List of state identifiers to be checked. |
bool scxml4cpp::Helper::isInState | ( | const std::set< State * > & | status, |
const std::list< std::string > & | stateNames | ||
) |
Check whether the given state identifier(s) are in the given set of states.
status | Set of states (usually the current active state configuration). |
stateNames | List of state identifiers to be checked. |
bool scxml4cpp::Helper::isPreempted | ( | State * | s, |
std::list< Transition * > & | transitions | ||
) |
Checks whether there is a transition from the given list that has as source state the given 's' or one of its ancestors.
In this case, taking 't' will pull the state machine out of 's' and we say that it preempts the selection of a transition from 's'. Such preemption will occur only if 's' is a descendant of a parallel region and 't' exits that region. If we did not do this preemption check, we could end up in an illegal configuration, namely one in which there were multiple active states that were not all descendants of a common parallel ancestor.
s | State to be exited. |
transitions | List of transitions to check for preemption. |
const std::string scxml4cpp::Helper::printActions | ( | std::list< Action * > & | actions | ) |
const std::string scxml4cpp::Helper::printActivities | ( | std::list< Activity * > & | activities | ) |
const std::string scxml4cpp::Helper::printStateMachine | ( | StateMachine & | sm | ) |
const std::string scxml4cpp::Helper::printStates | ( | State * | s | ) |
const std::string scxml4cpp::Helper::printStateType | ( | State * | s | ) |
const std::string scxml4cpp::Helper::printTargetState | ( | Transition * | transitions | ) |
const std::string scxml4cpp::Helper::printTargetStates | ( | std::list< Transition * > & | transitions | ) |
const std::string scxml4cpp::Helper::printTransition | ( | Transition * | t | ) |
const std::string scxml4cpp::Helper::printTransitions | ( | std::list< Transition * > & | transitions | ) |
void scxml4cpp::Helper::sortAtomicStates | ( | std::set< State * > & | status, |
std::vector< State * > & | sortedStatus | ||
) |
Sort the set of states according to SCXML document order.
status | Given set of states. |
sortedStatus | Sorted vector of states. |
|
inlinestatic |
|
inlinestatic |