Computer Assited Medical Intervention Tool Kit  version 5.0
ActionState Class Reference

The state (in a state machine point of view) corresponding to the current processed action. More...

#include <ActionState.h>

+ Inheritance diagram for ActionState:
+ Collaboration diagram for ActionState:

Public Member Functions

 ActionState (QState *parent, QString name, QString description, QTextStream *logStream=nullptr)
 
ActionTransitionaddActionTransition (QString transitionName, QAbstractState *nextState, bool applyAction=true, QVector< camitk::Action::ApplyStatus > disableConditions=QVector< camitk::Action::ApplyStatus >())
 Adds a possible transition from this action. More...
 
virtual camitk::Action::ApplyStatus applyAction ()
 apply the action encapsulated by this action state More...
 
void autoNextEntry ()
 programmatically call the onEntry() method (used during autonext) More...
 
void autoNextExit ()
 programmatically call the onExit() method (used during autonext) More...
 
QString getDescription ()
 Returns the description of the action state (may be different from the description of the actual action) More...
 
const QMap< QString, QString > & getInputComponents ()
 get the names and type of all input components More...
 
QString getName ()
 Returns the name of the action state (may be different from the name of the actual action) More...
 
const QMap< QString, QString > & getOutputComponents ()
 get the names and type of all output components More...
 
ActionStateWidgetgetWidget ()
 
void setAction (camitk::Action *action, QMap< QString, QVariant > parameters, QMap< QString, QString > inputComponentNames, QMap< QString, QString > outputComponentNames)
 
void setAlternativeDesc (QString altDescText, QVector< camitk::Action::ApplyStatus > statusList)
 May change its description according to the previous action result. More...
 
void setPreviousActionStatus (camitk::Action::ApplyStatus status)
 

Protected Member Functions

void onEntry (QEvent *event) override
 Reimplemented from QState. More...
 
void onExit (QEvent *event) override
 

Protected Attributes

QMap< camitk::Action::ApplyStatus, QVector< QPushButton * > > conditionalButtons
 Buttons that should be disabled if the previous aciton state did not happen correctly. More...
 
QMap< camitk::Action::ApplyStatus, QString > conditionalDescriptions
 Descriptions that should be displaied if the previous action state did not happen correctly. More...
 
QString description
 Description of the state action may not be the same as the action's description but complementary. More...
 
QMap< QString, QString > inputComponentNames
 names of all the input compenent, this is a map <name, type> More...
 
QTextStream * logStream
 Log stream to write report on logFile. More...
 
camitk::ActionmyAction
 Actual CamiTK action. More...
 
ActionStateWidgetmyStateWidget
 Widget containing: More...
 
QString name
 Name of the state action (may not be the same as the action's name) More...
 
QMap< QString, QString > outputComponentNames
 names of all the output compenent, this is a map <name, type> More...
 
QMap< QString, QVariant > parameters
 name and value of preset parameters More...
 
QTime * startTime
 Keep track of time... More...
 

Detailed Description

The state (in a state machine point of view) corresponding to the current processed action.

By default an ActionState is not defined as being the initial state.

Constructor & Destructor Documentation

◆ ActionState()

ActionState::ActionState ( QState *  parent,
QString  name,
QString  description,
QTextStream *  logStream = nullptr 
)

Member Function Documentation

◆ addActionTransition()

ActionTransition * ActionState::addActionTransition ( QString  transitionName,
QAbstractState *  nextState,
bool  applyAction = true,
QVector< camitk::Action::ApplyStatus disableConditions = QVector<camitk::Action::ApplyStatus>() 
)

Adds a possible transition from this action.

References ActionStateWidget::addTransitionButton(), applyAction(), conditionalButtons, logStream, and myStateWidget.

Referenced by ActionStateMachine::createTransitions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyAction()

Action::ApplyStatus ActionState::applyAction ( )
virtual

apply the action encapsulated by this action state

Reimplemented in SaveActionState.

References camitk::Action::applyInPipeline(), camitk::Action::getOutputComponents(), logStream, myAction, outputComponentNames, and camitk::refresh().

Referenced by addActionTransition(), and ActionTransition::onTransition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ autoNextEntry()

void ActionState::autoNextEntry ( )

programmatically call the onEntry() method (used during autonext)

References onEntry().

+ Here is the call graph for this function:

◆ autoNextExit()

void ActionState::autoNextExit ( )

programmatically call the onExit() method (used during autonext)

References onExit().

+ Here is the call graph for this function:

◆ getDescription()

QString ActionState::getDescription ( )

Returns the description of the action state (may be different from the description of the actual action)

References description.

Referenced by ActionStateWidget::ActionStateWidget().

+ Here is the caller graph for this function:

◆ getInputComponents()

const QMap< QString, QString > & ActionState::getInputComponents ( )

get the names and type of all input components

References inputComponentNames.

◆ getName()

QString ActionState::getName ( )

Returns the name of the action state (may be different from the name of the actual action)

References name.

Referenced by ActionStateWidget::ActionStateWidget(), ActionStateMachine::createTransitions(), and ActionTransition::onTransition().

+ Here is the caller graph for this function:

◆ getOutputComponents()

const QMap< QString, QString > & ActionState::getOutputComponents ( )

get the names and type of all output components

References outputComponentNames.

◆ getWidget()

ActionStateWidget * ActionState::getWidget ( )

References myStateWidget.

Referenced by SaveActionState::applyAction(), and ActionStateViewer::setState().

+ Here is the caller graph for this function:

◆ onEntry()

void ActionState::onEntry ( QEvent *  event)
overrideprotected

Reimplemented from QState.

References camitk::Action::getName(), camitk::Action::getWidget(), inputComponentNames, logStream, myAction, myStateWidget, name, camitk::Action::name, parameters, ActionStateWidget::setActionWidget(), camitk::ActionWidget::setButtonVisibility(), camitk::Action::setInputComponents(), camitk::Component::setModified(), and startTime.

Referenced by autoNextEntry().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onExit()

void ActionState::onExit ( QEvent *  event)
overrideprotected

References logStream, name, and startTime.

Referenced by autoNextExit().

+ Here is the caller graph for this function:

◆ setAction()

void ActionState::setAction ( camitk::Action action,
QMap< QString, QVariant >  parameters,
QMap< QString, QString >  inputComponentNames,
QMap< QString, QString >  outputComponentNames 
)

References inputComponentNames, myAction, outputComponentNames, parameters, and camitk::Action::setAutoUpdateProperties().

Referenced by ActionStateMachine::setCamiTKAction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAlternativeDesc()

void ActionState::setAlternativeDesc ( QString  altDescText,
QVector< camitk::Action::ApplyStatus statusList 
)

May change its description according to the previous action result.

References conditionalDescriptions.

Referenced by ActionStateMachine::createAllActionStates().

+ Here is the caller graph for this function:

◆ setPreviousActionStatus()

void ActionState::setPreviousActionStatus ( camitk::Action::ApplyStatus  status)

References conditionalButtons, conditionalDescriptions, description, myStateWidget, and ActionStateWidget::setDescription().

Referenced by ActionTransition::onTransition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ conditionalButtons

QMap<camitk::Action::ApplyStatus, QVector<QPushButton* > > ActionState::conditionalButtons
protected

Buttons that should be disabled if the previous aciton state did not happen correctly.

Referenced by addActionTransition(), and setPreviousActionStatus().

◆ conditionalDescriptions

QMap<camitk::Action::ApplyStatus, QString> ActionState::conditionalDescriptions
protected

Descriptions that should be displaied if the previous action state did not happen correctly.

Referenced by setAlternativeDesc(), and setPreviousActionStatus().

◆ description

QString ActionState::description
protected

Description of the state action may not be the same as the action's description but complementary.

Referenced by ActionState(), getDescription(), and setPreviousActionStatus().

◆ inputComponentNames

QMap<QString, QString> ActionState::inputComponentNames
protected

names of all the input compenent, this is a map <name, type>

Referenced by getInputComponents(), onEntry(), and setAction().

◆ logStream

QTextStream* ActionState::logStream
protected

Log stream to write report on logFile.

Referenced by ActionState(), addActionTransition(), SaveActionState::applyAction(), applyAction(), onEntry(), and onExit().

◆ myAction

camitk::Action* ActionState::myAction
protected

◆ myStateWidget

ActionStateWidget* ActionState::myStateWidget
protected

Widget containing:

  • the name of the state action
  • the description of the action
  • the action's widget
  • the buttons linking to the transitions

Referenced by ActionState(), addActionTransition(), getWidget(), onEntry(), and setPreviousActionStatus().

◆ name

QString ActionState::name
protected

Name of the state action (may not be the same as the action's name)

Referenced by ActionState(), getName(), onEntry(), and onExit().

◆ outputComponentNames

QMap<QString, QString> ActionState::outputComponentNames
protected

names of all the output compenent, this is a map <name, type>

Referenced by applyAction(), getOutputComponents(), and setAction().

◆ parameters

QMap<QString, QVariant> ActionState::parameters
protected

name and value of preset parameters

Referenced by onEntry(), and setAction().

◆ startTime

QTime* ActionState::startTime
protected

Keep track of time...

Referenced by onEntry(), and onExit().


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