Connection of two states. More...
#include <mitkTransition.h>
Public Types | |
typedef std::vector < mitk::Action::Pointer > | ActionVectorType |
typedef ActionVectorType::iterator | ActionVectorIterator |
typedef const ActionVectorIterator | ActionVectorConstIterator |
Public Member Functions | |
void | AddAction (Action *action) |
Add the action to this object. | |
std::string | GetName () const |
Return the name of this object. | |
State * | GetNextState () const |
Get the next state of this object. | |
int | GetNextStateId () const |
Get the Id of the next state of this object. | |
int | GetEventId () const |
Get the eventId of this object. | |
unsigned int | GetActionCount () const |
Get the number of actions. | |
ActionVectorIterator | GetActionBeginIterator () const |
Get an interator on the first action in list. | |
ActionVectorConstIterator | GetActionEndIterator () const |
Get an interator behind the last action in list. | |
bool | IsEvent (int eventId) const |
Returns true if the given eventId is equal to this eventId. | |
void | SetNextState (State *state) |
Set the next state of this object. | |
Transition (std::string name, int nextStateId, int eventId) | |
Default Constructor Sets the necessary informations name (to enhance readability during debug), nextStateId (the Id of the next state) and eventId (the Id of the event that causes the statechange). | |
~Transition () | |
Default Denstructor. |
Connection of two states.
A transition connects two states. Several actions are stored, that have to be executed after the statechange.
Definition at line 39 of file mitkTransition.h.
Definition at line 45 of file mitkTransition.h.
typedef ActionVectorType::iterator mitk::Transition::ActionVectorIterator |
Definition at line 44 of file mitkTransition.h.
typedef std::vector< mitk::Action::Pointer > mitk::Transition::ActionVectorType |
Definition at line 43 of file mitkTransition.h.
mitk::Transition::Transition | ( | std::string | name, |
int | nextStateId, | ||
int | eventId | ||
) |
Default Constructor Sets the necessary informations name (to enhance readability during debug), nextStateId (the Id of the next state) and eventId (the Id of the event that causes the statechange).
Definition at line 22 of file mitkTransition.cpp.
: m_Name(name), m_NextState(NULL), m_NextStateId(nextStateId), m_EventId(eventId) {}
mitk::Transition::~Transition | ( | ) |
Default Denstructor.
Definition at line 26 of file mitkTransition.cpp.
{
//needed for correct reference counting of mitkState
m_NextState = NULL;
m_Actions.clear();
}
void mitk::Transition::AddAction | ( | Action * | action ) |
Add the action to this object.
Definition at line 33 of file mitkTransition.cpp.
Referenced by mitkStateMachineFactoryTest().
{ m_Actions.push_back( action ); }
mitk::Transition::ActionVectorIterator mitk::Transition::GetActionBeginIterator | ( | ) | const |
Get an interator on the first action in list.
Definition at line 64 of file mitkTransition.cpp.
Referenced by mitk::StateMachine::HandleEvent().
{
return m_Actions.begin();
}
unsigned int mitk::Transition::GetActionCount | ( | ) | const |
Get the number of actions.
Definition at line 58 of file mitkTransition.cpp.
{ return static_cast<unsigned int>(m_Actions.size()); }
mitk::Transition::ActionVectorConstIterator mitk::Transition::GetActionEndIterator | ( | ) | const |
Get an interator behind the last action in list.
Definition at line 69 of file mitkTransition.cpp.
Referenced by mitk::StateMachine::HandleEvent().
{
return m_Actions.end();
}
int mitk::Transition::GetEventId | ( | ) | const |
Get the eventId of this object.
Definition at line 53 of file mitkTransition.cpp.
Referenced by mitk::State::AddTransition().
{
return m_EventId;
}
std::string mitk::Transition::GetName | ( | ) | const |
Return the name of this object.
Definition at line 38 of file mitkTransition.cpp.
{
return m_Name;
}
mitk::State * mitk::Transition::GetNextState | ( | ) | const |
Get the next state of this object.
Definition at line 43 of file mitkTransition.cpp.
Referenced by mitk::StateMachine::HandleEvent().
{
return m_NextState.GetPointer();
}
int mitk::Transition::GetNextStateId | ( | ) | const |
Get the Id of the next state of this object.
Definition at line 48 of file mitkTransition.cpp.
{
return m_NextStateId;
}
bool mitk::Transition::IsEvent | ( | int | eventId ) | const |
Returns true if the given eventId is equal to this eventId.
Definition at line 74 of file mitkTransition.cpp.
{
return (eventId == m_EventId);
}
void mitk::Transition::SetNextState | ( | State * | state ) |
Set the next state of this object.
Definition at line 79 of file mitkTransition.cpp.
Referenced by mitkStateMachineFactoryTest(), and mitkStateTest().
{ m_NextState = state; }