SMACC2
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions
smacc2 Namespace Reference

Namespaces

namespace  client_bases
 
namespace  client_behaviors
 
namespace  components
 
namespace  default_events
 
namespace  default_transition_tags
 
namespace  event_generators
 
namespace  introspection
 
namespace  state_reactors
 
namespace  utils
 

Classes

struct  AddTEventTypeStateReactor
 
struct  AddTEventTypeStateReactorInfo
 
class  CallbackCounterSemaphore
 
class  CbServiceServerCallbackBase
 
class  ClientHandler
 
struct  ComponentKey
 
struct  EvCbFailure
 
struct  EvCbFinished
 
struct  EvCbSuccess
 
class  HasSpecificNamedOnExit
 
class  HasStandardOnExit
 
class  ISmaccClient
 
class  ISmaccClientBehavior
 
class  ISmaccComponent
 
class  ISmaccOrthogonal
 
class  ISmaccState
 
class  ISmaccStateMachine
 
class  ISmaccUpdatable
 
class  Orthogonal
 
class  SignalDetector
 
class  SmaccAsyncClientBehavior
 
class  SmaccClientBehavior
 
class  SmaccEventGenerator
 
class  SmaccSignal
 
class  SmaccState
 
struct  SmaccStateMachineBase
 State Machine. More...
 
struct  SmExecution
 
class  StateReactor
 
class  Transition
 

Typedefs

template<class T >
using deep_history = sc::deep_history< T >
 

Enumerations

enum class  SMRunMode { DEBUG , RELEASE }
 
enum class  ExecutionModel { SINGLE_THREAD_SPINNER , MULTI_THREAD_SPINNER }
 
enum class  EventLifeTime { ABSOLUTE , CURRENT_STATE }
 
enum class  StateMachineInternalAction {
  STATE_CONFIGURING , STATE_ENTERING , STATE_RUNNING , STATE_EXITING ,
  TRANSITIONING
}
 

Functions

template<typename TState , typename TTransitionTagName >
void specificNamedOnExit (TState &st, TTransitionTagName tn, std::true_type)
 
template<typename TState , typename TTransitionTagName >
void specificNamedOnExit (TState &, TTransitionTagName, std::false_type)
 
template<typename TState , typename TTransitionTagName >
void specificNamedOnExit (TState &m, TTransitionTagName tn)
 
template<typename TState >
void standardOnExit (TState &st, std::true_type)
 
template<typename TState >
void standardOnExit (TState &, std::false_type)
 
template<typename TState >
void standardOnExit (TState &m)
 
void onSigQuit (int sig)
 
template<typename StateMachineType >
void run (ExecutionModel executionModel=ExecutionModel::SINGLE_THREAD_SPINNER)
 
template<typename StateMachineType >
SmExecutionrun_async ()
 

Typedef Documentation

◆ deep_history

template<class T >
using smacc2::deep_history = typedef sc::deep_history<T>

Definition at line 53 of file common.hpp.

Enumeration Type Documentation

◆ EventLifeTime

enum class smacc2::EventLifeTime
strong
Enumerator
ABSOLUTE 
CURRENT_STATE 

Definition at line 46 of file smacc_state_machine.hpp.

47{
49 CURRENT_STATE /*events are discarded if we are leaving the state it were created. I is used for client behaviors whose lifetime is associated to state*/
50};

◆ ExecutionModel

enum class smacc2::ExecutionModel
strong
Enumerator
SINGLE_THREAD_SPINNER 
MULTI_THREAD_SPINNER 

Definition at line 29 of file smacc_signal_detector.hpp.

◆ SMRunMode

enum class smacc2::SMRunMode
strong
Enumerator
DEBUG 
RELEASE 

Definition at line 67 of file common.hpp.

◆ StateMachineInternalAction

Enumerator
STATE_CONFIGURING 
STATE_ENTERING 
STATE_RUNNING 
STATE_EXITING 
TRANSITIONING 

Definition at line 52 of file smacc_state_machine.hpp.

Function Documentation

◆ onSigQuit()

void smacc2::onSigQuit ( int  sig)

Definition at line 370 of file signal_detector.cpp.

371{
372 RCLCPP_INFO(rclcpp::get_logger("SMACC"), "SignalDetector: SIGQUIT received");
373 exit(0);
374}

Referenced by run(), and run_async().

Here is the caller graph for this function:

◆ run()

template<typename StateMachineType >
void smacc2::run ( ExecutionModel  executionModel = ExecutionModel::SINGLE_THREAD_SPINNER)

Definition at line 114 of file smacc_signal_detector.hpp.

115{
116 ::signal(SIGQUIT, onSigQuit);
117
118 // create the asynchronous state machine scheduler
119 SmaccFifoScheduler scheduler1(true);
120
121 // create the signalDetector component
122 SignalDetector signalDetector(&scheduler1, executionModel);
123
124 // create the asynchronous state machine processor
125 SmaccFifoScheduler::processor_handle sm =
126 scheduler1.create_processor<StateMachineType>(&signalDetector);
127
128 // initialize the asynchronous state machine processor
129 signalDetector.setProcessorHandle(sm);
130
131 scheduler1.initiate_processor(sm);
132
133 //create a thread for the asynchronous state machine processor execution
134 boost::thread schedulerThread(boost::bind(&sc::fifo_scheduler<>::operator(), &scheduler1, 0));
135
136 // use the main thread for the signal detector component (waiting actionclient requests)
137 signalDetector.pollingLoop();
138}
boost::statechart::fifo_scheduler< SmaccFifoWorker, SmaccAllocator > SmaccFifoScheduler

References onSigQuit(), smacc2::SignalDetector::pollingLoop(), and smacc2::SignalDetector::setProcessorHandle().

Here is the call graph for this function:

◆ run_async()

template<typename StateMachineType >
SmExecution * smacc2::run_async ( )

Definition at line 150 of file smacc_signal_detector.hpp.

151{
152 ::signal(SIGQUIT, onSigQuit);
153
154 SmExecution * ret = new SmExecution();
155
156 // create the asynchronous state machine scheduler
157 ret->scheduler1 = new SmaccFifoScheduler(true);
158
159 // create the signalDetector component
161
162 // create the asynchronous state machine processor
163 ret->sm = ret->scheduler1->create_processor<StateMachineType>(ret->signalDetector);
164
165 // initialize the asynchronous state machine processor
167
168 ret->scheduler1->initiate_processor(ret->sm);
169
170 //create a thread for the asynchronous state machine processor execution
171 ret->schedulerThread =
172 new boost::thread(boost::bind(&sc::fifo_scheduler<>::operator(), ret->scheduler1, NULL));
173 ret->signalDetectorLoop =
174 new boost::thread(boost::bind(&SignalDetector::pollingLoop, ret->signalDetector));
175
176 return ret;
177}
void setProcessorHandle(SmaccFifoScheduler::processor_handle processorHandle)
SmaccFifoScheduler::processor_handle sm
boost::thread * signalDetectorLoop
SmaccFifoScheduler * scheduler1
SignalDetector * signalDetector

References onSigQuit(), smacc2::SignalDetector::pollingLoop(), smacc2::SmExecution::scheduler1, smacc2::SmExecution::schedulerThread, smacc2::SignalDetector::setProcessorHandle(), smacc2::SmExecution::signalDetector, smacc2::SmExecution::signalDetectorLoop, and smacc2::SmExecution::sm.

Here is the call graph for this function:

◆ specificNamedOnExit() [1/3]

template<typename TState , typename TTransitionTagName >
void smacc2::specificNamedOnExit ( TState &  ,
TTransitionTagName  ,
std::false_type   
)

Definition at line 50 of file state_traits.hpp.

51{
52}

◆ specificNamedOnExit() [2/3]

template<typename TState , typename TTransitionTagName >
void smacc2::specificNamedOnExit ( TState &  m,
TTransitionTagName  tn 
)

Definition at line 55 of file state_traits.hpp.

56{
58 m, tn,
59 std::integral_constant<bool, HasSpecificNamedOnExit<TState, TTransitionTagName>::value>());
60}
void specificNamedOnExit(TState &st, TTransitionTagName tn, std::true_type)

References specificNamedOnExit().

Here is the call graph for this function:

◆ specificNamedOnExit() [3/3]

template<typename TState , typename TTransitionTagName >
void smacc2::specificNamedOnExit ( TState &  st,
TTransitionTagName  tn,
std::true_type   
)

◆ standardOnExit() [1/3]

template<typename TState >
void smacc2::standardOnExit ( TState &  ,
std::false_type   
)

Definition at line 89 of file state_traits.hpp.

90{
91}

◆ standardOnExit() [2/3]

template<typename TState >
void smacc2::standardOnExit ( TState &  m)

Definition at line 94 of file state_traits.hpp.

95{
96 standardOnExit(m, std::integral_constant<bool, HasStandardOnExit<TState>::value>());
97}
void standardOnExit(TState &st, std::true_type)

References standardOnExit().

Here is the call graph for this function:

◆ standardOnExit() [3/3]

template<typename TState >
void smacc2::standardOnExit ( TState &  st,
std::true_type   
)

Definition at line 83 of file state_traits.hpp.

84{
85 st.onExit();
86}

Referenced by smacc2::SmaccState< MostDerived, Context, InnerInitial, historyMode >::exit(), and standardOnExit().

Here is the caller graph for this function: