SMACC2
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
smacc2::introspection::SmaccStateInfo Class Reference

#include <smacc_state_info.hpp>

Inheritance diagram for smacc2::introspection::SmaccStateInfo:
Inheritance graph
Collaboration diagram for smacc2::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
 
rclcpp::Node::SharedPtr getNode ()
 
rclcpp::Logger getLogger ()
 

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 162 of file smacc_state_info.hpp.

Member Typedef Documentation

◆ Ptr

Definition at line 165 of file smacc_state_info.hpp.

Constructor & Destructor Documentation

◆ SmaccStateInfo()

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

Definition at line 37 of file smacc_state_info.cpp.

40{
41 tid_ = tid;
42 parentState_ = parentState;
43 stateMachine_ = stateMachineInfo;
44
45 if (parentState_ != nullptr) depth_ = parentState->depth_ + 1;
46}
std::shared_ptr< SmaccStateInfo > parentState_
std::shared_ptr< SmaccStateMachineInfo > stateMachine_

References depth_, parentState_, stateMachine_, and tid_.

Member Function Documentation

◆ createChildState()

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

Definition at line 505 of file smacc_state_machine_info.hpp.

506{
507 auto realparentState = this->stateMachine_->getState<typename StateType::TContext>();
508
509 auto childState = this->stateMachine_->createState<StateType>(realparentState);
510
511 RCLCPP_WARN_STREAM(
512 getLogger(), "Real parent state> " << demangleSymbol<typename StateType::TContext>());
513
514 /*auto contextInfo = TypeInfo::getTypeInfoFromType<InitialStateType>();
515 auto parentState2= getState<InitialStateType::TContext>();
516 parentState2->createChildState<InitialStateType>();*/
517
518 // this->stateMachine_->addState(childState);
519 // stateMachineInfo.addState(stateMachineInfo)
520 // stateNames.push_back(currentname);
521 // RCLCPP_INFO(getLogger(),"------------");
522 // RCLCPP_INFO_STREAM(getLogger(),"** STATE state: "<< this->demangledStateName);
523
524 return childState;
525}

References getLogger(), and stateMachine_.

Here is the call graph for this function:

◆ declareTransition()

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

Definition at line 242 of file smacc_state_machine_info.hpp.

245{
246 auto evtype = demangledTypeName<EvType>();
247
248 SmaccTransitionInfo transitionInfo;
249 transitionInfo.index = transitions_.size();
250 transitionInfo.sourceState = shared_from_this();
251 transitionInfo.destinyState = dstState;
252 transitionInfo.transitionTypeInfo = transitionTypeInfo;
253
254 if (transitionTag != "")
255 transitionInfo.transitionTag = transitionTag;
256 else
257 transitionInfo.transitionTag = "Transition_" + std::to_string(transitionInfo.index);
258
259 transitionInfo.transitionType = transitionType;
260 transitionInfo.historyNode = history;
261
262 transitionInfo.eventInfo =
263 std::make_shared<SmaccEventInfo>(transitionTypeInfo->templateParameters.front());
264
265 EventLabel<EvType>(transitionInfo.eventInfo->label);
266 // RCLCPP_DEBUG_STREAM(getLogger(), "LABEL: " << transitionInfo.eventInfo->label);
267
268 transitions_.push_back(transitionInfo);
269}
std::vector< SmaccTransitionInfo > transitions_

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

◆ depth()

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

Definition at line 191 of file smacc_state_info.hpp.

191{ return depth_; }

References depth_.

◆ getAncestors()

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

Definition at line 48 of file smacc_state_info.cpp.

49{
50 ancestorsList.push_front(this);
51 if (parentState_ != nullptr)
52 {
53 this->parentState_->getAncestors(ancestorsList);
54 }
55}

References parentState_.

◆ getDemangledFullName()

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

Definition at line 88 of file smacc_state_info.cpp.

89{
90 return demangleSymbol(this->fullStateName.c_str());
91}
std::string demangleSymbol(const std::string &name)

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

Here is the call graph for this function:

◆ getFullPath()

std::string smacc2::SmaccStateInfo::getFullPath ( )

Definition at line 78 of file smacc_state_info.cpp.

79{
80 if (parentState_ == nullptr)
81 return this->toShortName();
82 else
83 return this->parentState_->getFullPath() + "/" + this->toShortName();
84}
const std::string & toShortName() const

References parentState_, and toShortName().

Here is the call graph for this function:

◆ getLogger()

rclcpp::Logger smacc2::introspection::SmaccStateInfo::getLogger ( )
inline

Definition at line 212 of file smacc_state_info.hpp.

212{ return getNode()->get_logger(); }

References getNode().

Referenced by createChildState().

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

◆ getNode()

rclcpp::Node::SharedPtr smacc2::SmaccStateInfo::getNode ( )

Definition at line 76 of file smacc_state_info.cpp.

76{ return this->stateMachine_->getNode(); }

References stateMachine_.

Referenced by getLogger().

Here is the caller graph for this function:

◆ getStateLevel()

SmaccStateType smacc2::SmaccStateInfo::getStateLevel ( )

Definition at line 57 of file smacc_state_info.cpp.

58{
59 if (this->children_.size() == 0)
60 {
61 if (this->parentState_ != nullptr)
62 {
64 }
65 else
66 {
68 }
69 }
70 else
71 {
73 }
74}
std::vector< std::shared_ptr< SmaccStateInfo > > children_

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

◆ toShortName()

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

Definition at line 86 of file smacc_state_info.cpp.

References demangledStateName.

Referenced by getFullPath().

Here is the caller graph for this function:

Member Data Documentation

◆ children_

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

Definition at line 181 of file smacc_state_info.hpp.

Referenced by getStateLevel().

◆ demangledStateName

std::string smacc2::introspection::SmaccStateInfo::demangledStateName

Definition at line 175 of file smacc_state_info.hpp.

Referenced by toShortName().

◆ depth_

int smacc2::introspection::SmaccStateInfo::depth_

Definition at line 182 of file smacc_state_info.hpp.

Referenced by depth(), and SmaccStateInfo().

◆ eventGeneratorsInfo

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

◆ fullStateName

std::string smacc2::introspection::SmaccStateInfo::fullStateName

Definition at line 174 of file smacc_state_info.hpp.

Referenced by getDemangledFullName().

◆ parentState_

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

Definition at line 178 of file smacc_state_info.hpp.

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

◆ stateIndex_

int smacc2::introspection::SmaccStateInfo::stateIndex_

Definition at line 173 of file smacc_state_info.hpp.

◆ stateMachine_

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

Definition at line 177 of file smacc_state_info.hpp.

Referenced by createChildState(), getNode(), and SmaccStateInfo().

◆ stateReactorsInfo

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

◆ staticBehaviorInfo

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

◆ tid_

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

Definition at line 183 of file smacc_state_info.hpp.

Referenced by SmaccStateInfo().

◆ transitions_

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

Definition at line 179 of file smacc_state_info.hpp.

Referenced by declareTransition().


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