SMACC
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
smacc::introspection::SmaccStateInfo Class Reference

#include <smacc_state_info.h>

Inheritance diagram for smacc::introspection::SmaccStateInfo:
Inheritance graph
Collaboration diagram for smacc::introspection::SmaccStateInfo:
Collaboration graph

Public Types

typedef std::shared_ptr< SmaccStateInfoPtr
 

Public Member Functions

 SmaccStateInfo (const std::type_info *tid, std::shared_ptr< SmaccStateInfo > parentState, std::shared_ptr< SmaccStateMachineInfo > stateMachineInfo)
 
SmaccStateType getStateLevel ()
 
int depth () const
 
void getAncestors (std::list< const SmaccStateInfo * > &ancestorsList) const
 
std::string getFullPath ()
 
template<typename StateType >
std::shared_ptr< SmaccStateInfocreateChildState ()
 
template<typename EvType >
void declareTransition (std::shared_ptr< SmaccStateInfo > &dstState, std::string transitionTag, std::string transitionType, bool history, TypeInfo::Ptr transitionTypeInfo)
 
const std::string & toShortName () const
 
std::string getDemangledFullName () const
 

Public Attributes

int stateIndex_
 
std::string fullStateName
 
std::string demangledStateName
 
std::shared_ptr< SmaccStateMachineInfostateMachine_
 
std::shared_ptr< SmaccStateInfoparentState_
 
std::vector< SmaccTransitionInfotransitions_
 
std::vector< std::shared_ptr< SmaccStateInfo > > children_
 
int depth_
 
const std::type_info * tid_
 

Static Public Attributes

static std::map< const std::type_info *, std::vector< ClientBehaviorInfoEntry > > staticBehaviorInfo
 
static std::map< const std::type_info *, std::vector< std::shared_ptr< SmaccStateReactorInfo > > > stateReactorsInfo
 
static std::map< const std::type_info *, std::vector< std::shared_ptr< SmaccEventGeneratorInfo > > > eventGeneratorsInfo
 

Detailed Description

Definition at line 136 of file smacc_state_info.h.

Member Typedef Documentation

◆ Ptr

Definition at line 140 of file smacc_state_info.h.

Constructor & Destructor Documentation

◆ SmaccStateInfo()

smacc::SmaccStateInfo::SmaccStateInfo ( const std::type_info *  tid,
std::shared_ptr< SmaccStateInfo parentState,
std::shared_ptr< SmaccStateMachineInfo stateMachineInfo 
)

Definition at line 13 of file smacc_state_info.cpp.

14{
15 tid_ = tid;
16 parentState_ = parentState;
17 stateMachine_ = stateMachineInfo;
18
19 if (parentState_ != nullptr)
20 depth_ = parentState->depth_ + 1;
21}
std::shared_ptr< SmaccStateMachineInfo > stateMachine_
std::shared_ptr< SmaccStateInfo > parentState_

References depth_, parentState_, stateMachine_, and tid_.

Member Function Documentation

◆ createChildState()

template<typename StateType >
std::shared_ptr< SmaccStateInfo > smacc::introspection::SmaccStateInfo::createChildState

Definition at line 441 of file smacc_state_machine_info.h.

442{
443 auto realparentState = this->stateMachine_->getState<typename StateType::TContext>();
444
445 auto childState = this->stateMachine_->createState<StateType>(realparentState);
446
447 ROS_WARN_STREAM("Real parent state> " << demangleSymbol<typename StateType::TContext>());
448
449 /*auto contextInfo = TypeInfo::getTypeInfoFromType<InitialStateType>();
450 auto parentState2= getState<InitialStateType::TContext>();
451 parentState2->createChildState<InitialStateType>();*/
452
453 //this->stateMachine_->addState(childState);
454 //stateMachineInfo.addState(stateMachineInfo)
455 //stateNames.push_back(currentname);
456 //ROS_INFO("------------");
457 //ROS_INFO_STREAM("** STATE state: "<< this->demangledStateName);
458
459 return childState;
460}

References stateMachine_.

◆ declareTransition()

template<typename EvType >
void smacc::introspection::SmaccStateInfo::declareTransition ( std::shared_ptr< SmaccStateInfo > &  dstState,
std::string  transitionTag,
std::string  transitionType,
bool  history,
TypeInfo::Ptr  transitionTypeInfo 
)

Definition at line 197 of file smacc_state_machine_info.h.

198{
199 auto evtype = demangledTypeName<EvType>();
200
201 SmaccTransitionInfo transitionInfo;
202 transitionInfo.index = transitions_.size();
203 transitionInfo.sourceState = shared_from_this();
204 transitionInfo.destinyState = dstState;
205 transitionInfo.transitionTypeInfo = transitionTypeInfo;
206
207 if (transitionTag != "")
208 transitionInfo.transitionTag = transitionTag;
209 else
210 transitionInfo.transitionTag = "Transition_" + std::to_string(transitionInfo.index);
211
212 transitionInfo.transitionType = transitionType;
213 transitionInfo.historyNode = history;
214
215 transitionInfo.eventInfo = std::make_shared<SmaccEventInfo>(transitionTypeInfo->templateParameters.front());
216
217 EventLabel<EvType>(transitionInfo.eventInfo->label);
218 ROS_DEBUG_STREAM("LABEL: " << transitionInfo.eventInfo->label);
219
220 transitions_.push_back(transitionInfo);
221}
std::vector< SmaccTransitionInfo > transitions_

References smacc::introspection::SmaccTransitionInfo::destinyState, smacc::introspection::SmaccTransitionInfo::eventInfo, smacc::introspection::SmaccTransitionInfo::historyNode, smacc::introspection::SmaccTransitionInfo::index, smacc::introspection::SmaccTransitionInfo::sourceState, transitions_, smacc::introspection::SmaccTransitionInfo::transitionTag, smacc::introspection::SmaccTransitionInfo::transitionType, and smacc::introspection::SmaccTransitionInfo::transitionTypeInfo.

◆ depth()

int smacc::introspection::SmaccStateInfo::depth ( ) const
inline

Definition at line 162 of file smacc_state_info.h.

162{ return depth_; }

References depth_.

◆ getAncestors()

void smacc::SmaccStateInfo::getAncestors ( std::list< const SmaccStateInfo * > &  ancestorsList) const

Definition at line 23 of file smacc_state_info.cpp.

24{
25 ancestorsList.push_front(this);
26 if (parentState_ != nullptr)
27 {
28 this->parentState_->getAncestors(ancestorsList);
29 }
30}

References parentState_.

◆ getDemangledFullName()

std::string smacc::SmaccStateInfo::getDemangledFullName ( ) const

Definition at line 64 of file smacc_state_info.cpp.

65{
66 return demangleSymbol(this->fullStateName.c_str());
67}
std::string demangleSymbol()
Definition: introspection.h:75

References smacc::introspection::demangleSymbol(), and fullStateName.

Here is the call graph for this function:

◆ getFullPath()

std::string smacc::SmaccStateInfo::getFullPath ( )

Definition at line 51 of file smacc_state_info.cpp.

52{
53 if (parentState_ == nullptr)
54 return this->toShortName();
55 else
56 return this->parentState_->getFullPath() + "/" + this->toShortName();
57}
const std::string & toShortName() const

References parentState_, and toShortName().

Here is the call graph for this function:

◆ getStateLevel()

SmaccStateType smacc::SmaccStateInfo::getStateLevel ( )

Definition at line 32 of file smacc_state_info.cpp.

33{
34 if (this->children_.size() == 0)
35 {
36 if (this->parentState_ != nullptr)
37 {
39 }
40 else
41 {
43 }
44 }
45 else
46 {
48 }
49}
std::vector< std::shared_ptr< SmaccStateInfo > > children_

References children_, parentState_, smacc::introspection::STATE, smacc::introspection::SUPERSTATE, and smacc::introspection::SUPERSTATE_ROUTINE.

◆ toShortName()

const std::string & smacc::SmaccStateInfo::toShortName ( ) const

Definition at line 59 of file smacc_state_info.cpp.

60{
61 return this->demangledStateName;
62}

References demangledStateName.

Referenced by getFullPath().

Here is the caller graph for this function:

Member Data Documentation

◆ children_

std::vector<std::shared_ptr<SmaccStateInfo> > smacc::introspection::SmaccStateInfo::children_

Definition at line 154 of file smacc_state_info.h.

Referenced by getStateLevel().

◆ demangledStateName

std::string smacc::introspection::SmaccStateInfo::demangledStateName

Definition at line 148 of file smacc_state_info.h.

Referenced by toShortName().

◆ depth_

int smacc::introspection::SmaccStateInfo::depth_

Definition at line 155 of file smacc_state_info.h.

Referenced by depth(), and SmaccStateInfo().

◆ eventGeneratorsInfo

std::map< const std::type_info *, std::vector< std::shared_ptr< SmaccEventGeneratorInfo > > > smacc::SmaccStateInfo::eventGeneratorsInfo
static

◆ fullStateName

std::string smacc::introspection::SmaccStateInfo::fullStateName

Definition at line 147 of file smacc_state_info.h.

Referenced by getDemangledFullName().

◆ parentState_

std::shared_ptr<SmaccStateInfo> smacc::introspection::SmaccStateInfo::parentState_

Definition at line 151 of file smacc_state_info.h.

Referenced by getAncestors(), getFullPath(), getStateLevel(), and SmaccStateInfo().

◆ stateIndex_

int smacc::introspection::SmaccStateInfo::stateIndex_

Definition at line 146 of file smacc_state_info.h.

◆ stateMachine_

std::shared_ptr<SmaccStateMachineInfo> smacc::introspection::SmaccStateInfo::stateMachine_

Definition at line 150 of file smacc_state_info.h.

Referenced by createChildState(), and SmaccStateInfo().

◆ stateReactorsInfo

std::map< const std::type_info *, std::vector< std::shared_ptr< smacc::introspection::SmaccStateReactorInfo > > > smacc::SmaccStateInfo::stateReactorsInfo
static

◆ staticBehaviorInfo

std::map< const std::type_info *, std::vector< ClientBehaviorInfoEntry > > smacc::SmaccStateInfo::staticBehaviorInfo
static

◆ tid_

const std::type_info* smacc::introspection::SmaccStateInfo::tid_

Definition at line 156 of file smacc_state_info.h.

Referenced by SmaccStateInfo().

◆ transitions_

std::vector<SmaccTransitionInfo> smacc::introspection::SmaccStateInfo::transitions_

Definition at line 152 of file smacc_state_info.h.

Referenced by declareTransition().


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