SMACC2
Loading...
Searching...
No Matches
smacc2::introspection Namespace Reference

Namespaces

namespace  anonymous_namespace{string_type_walker.cpp}
 

Classes

struct  add_type_wrapper
 
struct  AddSubState
 
struct  AddTransition
 
struct  CheckType
 
class  ClientBehaviorHandler
 
struct  ClientBehaviorInfoEntry
 
struct  EventGeneratorCallbackFunctor
 
class  EventGeneratorHandler
 
class  HasAutomaticTransitionTag
 
class  HasAutomaticTransitionType
 
class  HasEventLabel
 
class  HasOnDefinition
 
struct  SmaccEventGeneratorInfo
 
struct  SmaccEventInfo
 
class  SmaccStateInfo
 
class  SmaccStateMachineInfo
 
struct  SmaccStateReactorInfo
 
struct  SmaccTransitionInfo
 
struct  StateReactorCallbackFunctor
 
class  StateReactorHandler
 
struct  type_
 
class  TypeInfo
 
struct  typelist
 
struct  WalkStatesExecutor
 

Typedefs

typedef std::allocator< boost::statechart::none > SmaccAllocator
 
typedef boost::mpl::list< SUCCESS, ABORT, CANCEL, CONTINUELOOP, ENDLOOP > DEFAULT_TRANSITION_TYPES
 

Enumerations

enum class  SmaccStateType { SUPERSTATE = 2 , STATE = 1 , SUPERSTATE_ROUTINE = 1 }
 

Functions

void transitionInfoToMsg (const SmaccTransitionInfo &transition, smacc2_msgs::msg::SmaccTransition &transitionMsg)
 
template<class T >
auto optionalNodeHandle (std::shared_ptr< T > &obj) -> T *
 
template<class T >
auto optionalNodeHandle (boost::intrusive_ptr< T > &obj) -> T *
 
template<class T >
auto optionalNodeHandle (T *obj) -> T *
 
std::string demangleSymbol (const char *name)
 
std::string demangleSymbol (const std::string &name)
 
template<typename T >
std::string demangleSymbol ()
 
template<class T >
std::string demangledTypeName ()
 
std::string demangleType (const std::type_info *tinfo)
 
std::string demangleType (const std::type_info &tinfo)
 
template<typename T >
std::enable_if< HasEventLabel< T >::value, void >::type EventLabel (std::string &label)
 
template<typename T >
std::enable_if<!HasEventLabel< T >::value, void >::type EventLabel (std::string &label)
 
template<typename T >
std::enable_if< HasAutomaticTransitionTag< T >::value, void >::type automaticTransitionTag (std::string &transition_name)
 
template<typename T >
std::enable_if<!HasAutomaticTransitionTag< T >::value, void >::type automaticTransitionTag (std::string &transition_name)
 
template<typename T >
std::enable_if< HasAutomaticTransitionType< T >::value, void >::type automaticTransitionType (std::string &transition_type)
 
template<typename T >
std::enable_if<!HasAutomaticTransitionType< T >::value, void >::type automaticTransitionType (std::string &transition_type)
 
template<typename TTransition >
static std::string getTransitionType ()
 
template<typename T >
disable_if< boost::mpl::is_sequence< T > >::type processSubState (std::shared_ptr< SmaccStateInfo > &parentState)
 
template<typename T >
enable_if< boost::mpl::is_sequence< T > >::type processSubState (std::shared_ptr< SmaccStateInfo > &parentState)
 
template<typename T >
enable_if< boost::mpl::is_sequence< T > >::type processTransitions (std::shared_ptr< SmaccStateInfo > &sourceState)
 
template<typename Ev , typename Dst , typename Tag >
void processTransition (smacc2::Transition< Ev, boost::statechart::deep_history< Dst >, Tag > *, std::shared_ptr< SmaccStateInfo > &sourceState)
 
template<typename Ev , typename Dst , typename Tag >
void processTransition (smacc2::Transition< Ev, Dst, Tag > *t, std::shared_ptr< SmaccStateInfo > &sourceState)
 
template<typename Ev , typename Dst , typename Tag >
void processTransitionAux (smacc2::Transition< Ev, Dst, Tag > *, std::shared_ptr< SmaccStateInfo > &sourceState, bool history, TypeInfo::Ptr &transitionTypeInfo)
 
template<typename Ev , typename Dst >
void processTransition (statechart::transition< Ev, Dst > *, std::shared_ptr< SmaccStateInfo > &)
 
template<typename Ev >
void processTransition (statechart::custom_reaction< Ev > *, std::shared_ptr< SmaccStateInfo > &)
 
template<typename T >
disable_if< boost::mpl::is_sequence< T > >::type processTransitions (std::shared_ptr< SmaccStateInfo > &sourceState)
 
template<typename T >
std::enable_if< HasOnDefinition< T >::value, void >::type CallOnDefinition ()
 
template<typename T >
std::enable_if<!HasOnDefinition< T >::value, void >::type CallOnDefinition ()
 
bool replace (std::string &str, const std::string &from, const std::string &to)
 
std::string replace_back (std::string roottype, const std::vector< std::pair< std::string, std::string > > &orderedtypesdict)
 

Variables

rclcpp::Node::SharedPtr globalNh_
 

Typedef Documentation

◆ DEFAULT_TRANSITION_TYPES

◆ SmaccAllocator

typedef std::allocator<boost::statechart::none> smacc2::introspection::SmaccAllocator

Definition at line 54 of file introspection.hpp.

Enumeration Type Documentation

◆ SmaccStateType

Enumerator
SUPERSTATE 
STATE 
SUPERSTATE_ROUTINE 

Definition at line 181 of file smacc_state_info.hpp.

Function Documentation

◆ automaticTransitionTag() [1/2]

template<typename T >
std::enable_if< HasAutomaticTransitionTag< T >::value, void >::type smacc2::introspection::automaticTransitionTag ( std::string & transition_name)

Definition at line 163 of file introspection.hpp.

165{
166 transition_name = T::getDefaultTransitionTag();
167}

Referenced by processTransitionAux().

Here is the caller graph for this function:

◆ automaticTransitionTag() [2/2]

template<typename T >
std::enable_if<!HasAutomaticTransitionTag< T >::value, void >::type smacc2::introspection::automaticTransitionTag ( std::string & transition_name)

Definition at line 170 of file introspection.hpp.

172{
173 transition_name = "";
174}

◆ automaticTransitionType() [1/2]

template<typename T >
std::enable_if< HasAutomaticTransitionType< T >::value, void >::type smacc2::introspection::automaticTransitionType ( std::string & transition_type)

Definition at line 197 of file introspection.hpp.

199{
200 transition_type = T::getDefaultTransitionType();
201}

Referenced by processTransitionAux().

Here is the caller graph for this function:

◆ automaticTransitionType() [2/2]

template<typename T >
std::enable_if<!HasAutomaticTransitionType< T >::value, void >::type smacc2::introspection::automaticTransitionType ( std::string & transition_type)

Definition at line 204 of file introspection.hpp.

206{
207 transition_type = demangledTypeName<DEFAULT>();
208}

References demangledTypeName().

Here is the call graph for this function:

◆ CallOnDefinition() [1/2]

template<typename T >
std::enable_if< HasOnDefinition< T >::value, void >::type smacc2::introspection::CallOnDefinition ( )

Definition at line 336 of file smacc_state_machine_info.hpp.

337{
338 /* something when T has toString ... */
339 RCLCPP_INFO_STREAM(
340 globalNh_->get_logger(), "EXECUTING ONDEFINITION: " << demangleSymbol(typeid(T).name()));
341 T::staticConfigure();
342}
rclcpp::Node::SharedPtr globalNh_
std::string demangleSymbol(const char *name)

References demangleSymbol(), and globalNh_.

Referenced by smacc2::introspection::WalkStatesExecutor< InitialStateType >::walkStates().

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

◆ CallOnDefinition() [2/2]

template<typename T >
std::enable_if<!HasOnDefinition< T >::value, void >::type smacc2::introspection::CallOnDefinition ( )

Definition at line 345 of file smacc_state_machine_info.hpp.

346{
347 RCLCPP_INFO_STREAM(
348 globalNh_->get_logger(),
349 "static OnDefinition: dont exist for " << demangleSymbol(typeid(T).name()));
350 /* something when T has toString ... */
351}

References demangleSymbol(), and globalNh_.

Here is the call graph for this function:

◆ demangledTypeName()

template<class T >
std::string smacc2::introspection::demangledTypeName ( )
inline

Definition at line 90 of file introspection.hpp.

91{
92 return demangleSymbol(typeid(T).name());
93}

References demangleSymbol().

Referenced by smacc2::introspection::StateReactorHandler::addInputEvent(), automaticTransitionType(), smacc2::ISmaccState::configure(), smacc2::Orthogonal< TOrthogonal >::createClient(), smacc2::ISmaccClient::createNamedComponent(), smacc2::ISmaccStateMachine::createOrthogonal(), smacc2::ISmaccStateMachine::createSignalConnection(), smacc2::introspection::SmaccStateMachineInfo::createState(), smacc2::introspection::SmaccStateInfo::declareTransition(), smacc2::default_events::EvActionAborted< TSource, TOrthogonal >::getDefaultTransitionTag(), smacc2::default_events::EvActionCancelled< TSource, TOrthogonal >::getDefaultTransitionTag(), smacc2::default_events::EvActionSucceeded< TSource, TOrthogonal >::getDefaultTransitionTag(), smacc2::default_events::EvLoopContinue< TSource >::getDefaultTransitionTag(), smacc2::default_events::EvLoopEnd< TSource >::getDefaultTransitionTag(), smacc2::default_events::EvServiceFailure< TSource, TOrthogonal >::getDefaultTransitionTag(), smacc2::default_events::EvServiceResponse< TSource, TOrthogonal, TResponse >::getDefaultTransitionTag(), smacc2::default_events::EvActionAborted< TSource, TOrthogonal >::getDefaultTransitionType(), smacc2::default_events::EvActionCancelled< TSource, TOrthogonal >::getDefaultTransitionType(), smacc2::default_events::EvActionSucceeded< TSource, TOrthogonal >::getDefaultTransitionType(), smacc2::default_events::EvLoopContinue< TSource >::getDefaultTransitionType(), smacc2::default_events::EvLoopEnd< TSource >::getDefaultTransitionType(), smacc2::default_events::EvServiceFailure< TSource, TOrthogonal >::getDefaultTransitionType(), smacc2::default_events::EvServiceResponse< TSource, TOrthogonal, TResponse >::getDefaultTransitionType(), smacc2::ISmaccStateMachine::getOrthogonal(), smacc2::client_behaviors::CbWaitTopicMessage< TMessage >::onEntry(), smacc2::introspection::CheckType< TTransition >::operator()(), smacc2::ISmaccOrthogonal::requiresClient(), smacc2::introspection::StateReactorHandler::setOutputEvent(), smacc2::client_bases::SmaccActionClientBase< ActionType >::waitForServer(), and smacc2::introspection::WalkStatesExecutor< InitialStateType >::walkStates().

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

◆ demangleSymbol() [1/3]

template<typename T >
std::string smacc2::introspection::demangleSymbol ( )
inline

Definition at line 84 of file introspection.hpp.

85{
86 return demangleSymbol(typeid(T).name());
87}

References demangleSymbol().

Referenced by smacc2::introspection::SmaccStateMachineInfo::assembleSMStructureMessage(), CallOnDefinition(), smacc2::introspection::SmaccStateInfo::createChildState(), smacc2::ISmaccStateMachine::createSignalConnection(), demangledTypeName(), demangleSymbol(), demangleSymbol(), demangleType(), demangleType(), smacc2::SmaccState< MostDerived, Context, InnerInitial, historyMode >::entryStateInternal(), smacc2::ISmaccState::getClassName(), smacc2::introspection::SmaccStateInfo::getDemangledFullName(), cl_generic_sensor::CbDefaultGenericSensorBehavior< ClientType >::getEventLabel(), smacc2::introspection::SmaccEventInfo::getEventSourceName(), smacc2::introspection::SmaccEventInfo::getEventTypeName(), smacc2::introspection::TypeInfo::getFromStdTypeInfo(), smacc2::SmaccState< MostDerived, Context, InnerInitial, historyMode >::getFullName(), smacc2::ISmaccClient::getName(), smacc2::ISmaccClientBehavior::getName(), smacc2::ISmaccComponent::getName(), smacc2::ISmaccOrthogonal::getName(), smacc2::introspection::SmaccEventInfo::getOrthogonalName(), smacc2::ISmaccStateMachine::getStateMachineName(), smacc2::ISmaccStateMachine::notifyOnStateEntryEnd(), smacc2::ISmaccStateMachine::notifyOnStateEntryStart(), smacc2::ISmaccStateMachine::notifyOnStateExited(), smacc2::ISmaccStateMachine::notifyOnStateExiting(), cl_generic_sensor::CbDefaultGenericSensorBehavior< ClientType >::onEntry(), cl_moveit2z::CbMoveEndEffectorTrajectory::onEntry(), smacc2::state_reactors::SrAllEventsGo::onEventNotified(), smacc2::state_reactors::SrEventCountdown::onEventNotified(), smacc2::SmaccState< MostDerived, Context, InnerInitial, historyMode >::onInitializationFailure(), smacc2::client_bases::SmaccActionClientBase< ActionType >::onInitialize(), cl_generic_sensor::CbDefaultGenericSensorBehavior< ClientType >::onStateOrthogonalAllocation(), smacc2::ISmaccStateMachine::postEvent(), cl_keyboard::CbDefaultKeyboardBehavior::postKeyEvent(), cl_keyboard::components::CpKeyboardListener1::postKeyEvent(), smacc2::client_bases::SmaccActionClientBase< ActionType >::postResultEvent(), smacc2::client_core_components::CpActionClient< ActionType >::postResultEvent(), processTransition(), processTransitionAux(), smacc2::ISmaccStateMachine::propagateEventToStateReactors(), cl_generic_sensor::CbDefaultGenericSensorBehavior< ClientType >::propagateMessageEvent(), cl_generic_sensor::CbDefaultGenericSensorBehavior< ClientType >::propagateTimeoutEvent(), smacc2::ISmaccState::requiresClient(), smacc2::ISmaccComponent::requiresComponent(), smacc2::ISmaccComponent::requiresComponent(), smacc2::ISmaccStateMachine::requiresComponent(), smacc2::ISmaccStateMachine::requiresComponent(), smacc2::client_bases::SmaccActionClientBase< ActionType >::sendGoal(), smacc2::StateReactor::setOutputEvent(), and smacc2::client_behaviors::CbSequence::then().

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

◆ demangleSymbol() [2/3]

std::string smacc2::introspection::demangleSymbol ( const char * name)
inline

Definition at line 74 of file introspection.hpp.

75{
76 // Boost allocates and releases the demangled name; the mangled name is returned when demangling fails.
77 return boost::core::demangle(name);
78}

◆ demangleSymbol() [3/3]

std::string smacc2::introspection::demangleSymbol ( const std::string & name)
inline

Definition at line 81 of file introspection.hpp.

81{ return demangleSymbol(name.c_str()); }

References demangleSymbol().

Here is the call graph for this function:

◆ demangleType() [1/2]

std::string smacc2::introspection::demangleType ( const std::type_info & tinfo)
inline

Definition at line 100 of file introspection.hpp.

101{
102 return demangleSymbol(tinfo.name());
103}

References demangleSymbol().

Here is the call graph for this function:

◆ demangleType() [2/2]

◆ EventLabel() [1/2]

◆ EventLabel() [2/2]

template<typename T >
std::enable_if<!HasEventLabel< T >::value, void >::type smacc2::introspection::EventLabel ( std::string & label)

Definition at line 137 of file introspection.hpp.

138{
139 label = "";
140}

◆ getTransitionType()

template<typename TTransition >
static std::string smacc2::introspection::getTransitionType ( )
static

Definition at line 249 of file introspection.hpp.

250{
251 std::string output;
252 CheckType<TTransition> op(&output);
253 using boost::mpl::_1;
254 using wrappedList = typename boost::mpl::transform<DEFAULT_TRANSITION_TYPES, _1>::type;
255
256 boost::mpl::for_each<wrappedList>(op);
257 return output;
258}

Referenced by processTransitionAux().

Here is the caller graph for this function:

◆ optionalNodeHandle() [1/3]

template<class T >
auto smacc2::introspection::optionalNodeHandle ( boost::intrusive_ptr< T > & obj) -> T *

Definition at line 63 of file introspection.hpp.

64{
65 return obj.get();
66}

◆ optionalNodeHandle() [2/3]

template<class T >
auto smacc2::introspection::optionalNodeHandle ( std::shared_ptr< T > & obj) -> T *

Definition at line 57 of file introspection.hpp.

58{
59 return obj.get;
60}

◆ optionalNodeHandle() [3/3]

template<class T >
auto smacc2::introspection::optionalNodeHandle ( T * obj) -> T *

Definition at line 69 of file introspection.hpp.

70{
71 return obj;
72}

◆ processSubState() [1/2]

template<typename T >
disable_if< boost::mpl::is_sequence< T > >::type smacc2::introspection::processSubState ( std::shared_ptr< SmaccStateInfo > & parentState)

Definition at line 140 of file smacc_state_machine_info.hpp.

References smacc2::introspection::WalkStatesExecutor< InitialStateType >::walkStates().

Referenced by smacc2::introspection::WalkStatesExecutor< InitialStateType >::walkStates().

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

◆ processSubState() [2/2]

template<typename T >
enable_if< boost::mpl::is_sequence< T > >::type smacc2::introspection::processSubState ( std::shared_ptr< SmaccStateInfo > & parentState)

Definition at line 148 of file smacc_state_machine_info.hpp.

150{
151 using boost::mpl::_1;
152 using wrappedList = typename boost::mpl::transform<T, add_type_wrapper<_1>>::type;
153 boost::mpl::for_each<wrappedList>(AddSubState(parentState));
154}

◆ processTransition() [1/4]

template<typename Ev , typename Dst , typename Tag >
void smacc2::introspection::processTransition ( smacc2::Transition< Ev, boost::statechart::deep_history< Dst >, Tag > * ,
std::shared_ptr< SmaccStateInfo > & sourceState )

Definition at line 177 of file smacc_state_machine_info.hpp.

180{
181 RCLCPP_INFO(
182 globalNh_->get_logger(), "[DIAG] processTransition [deep_history] START for state %s",
183 sourceState->toShortName().c_str());
184 auto transitionTypeInfo = TypeInfo::getTypeInfoFromType<
186 RCLCPP_INFO(
187 globalNh_->get_logger(), "[DIAG] processTransition [deep_history] got TypeInfo for state %s",
188 sourceState->toShortName().c_str());
189 smacc2::Transition<Ev, Dst, Tag> * mock = nullptr;
190 processTransitionAux(mock, sourceState, true, transitionTypeInfo);
191}
void processTransitionAux(smacc2::Transition< Ev, Dst, Tag > *, std::shared_ptr< SmaccStateInfo > &sourceState, bool history, TypeInfo::Ptr &transitionTypeInfo)

References smacc2::introspection::TypeInfo::getTypeInfoFromType(), globalNh_, and processTransitionAux().

Referenced by processTransitions().

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

◆ processTransition() [2/4]

template<typename Ev , typename Dst , typename Tag >
void smacc2::introspection::processTransition ( smacc2::Transition< Ev, Dst, Tag > * t,
std::shared_ptr< SmaccStateInfo > & sourceState )

Definition at line 194 of file smacc_state_machine_info.hpp.

196{
197 RCLCPP_INFO(
198 globalNh_->get_logger(), "[DIAG] processTransition START for state %s",
199 sourceState->toShortName().c_str());
200 auto transitionTypeInfo = TypeInfo::getTypeInfoFromType<smacc2::Transition<Ev, Dst, Tag>>();
201 RCLCPP_INFO(
202 globalNh_->get_logger(), "[DIAG] processTransition got TypeInfo for state %s",
203 sourceState->toShortName().c_str());
204 RCLCPP_INFO(
205 globalNh_->get_logger(), "State %s Walker transition: %s", sourceState->toShortName().c_str(),
206 demangleSymbol(typeid(Ev).name()).c_str());
207 processTransitionAux(t, sourceState, false, transitionTypeInfo);
208}

References demangleSymbol(), smacc2::introspection::TypeInfo::getTypeInfoFromType(), globalNh_, and processTransitionAux().

Here is the call graph for this function:

◆ processTransition() [3/4]

template<typename Ev >
void smacc2::introspection::processTransition ( statechart::custom_reaction< Ev > * ,
std::shared_ptr< SmaccStateInfo > &  )

Definition at line 314 of file smacc_state_machine_info.hpp.

315{
316}

◆ processTransition() [4/4]

template<typename Ev , typename Dst >
void smacc2::introspection::processTransition ( statechart::transition< Ev, Dst > * ,
std::shared_ptr< SmaccStateInfo > &  )

Definition at line 309 of file smacc_state_machine_info.hpp.

310{
311}

◆ processTransitionAux()

template<typename Ev , typename Dst , typename Tag >
void smacc2::introspection::processTransitionAux ( smacc2::Transition< Ev, Dst, Tag > * ,
std::shared_ptr< SmaccStateInfo > & sourceState,
bool history,
TypeInfo::Ptr & transitionTypeInfo )

Definition at line 211 of file smacc_state_machine_info.hpp.

214{
215 RCLCPP_INFO(
216 globalNh_->get_logger(), "State %s Walker transition: %s", sourceState->toShortName().c_str(),
217 demangleSymbol(typeid(Ev).name()).c_str());
218 std::string transitionTag;
219 std::string transitionType;
220
221 if (typeid(Tag) != typeid(default_transition_name))
222 {
223 transitionTag = demangleSymbol<Tag>();
224 transitionType = getTransitionType<Tag>();
225 RCLCPP_DEBUG_STREAM(globalNh_->get_logger(), "TRANSITION TYPE:" << transitionType);
226 }
227 else
228 {
229 transitionTag = "";
230 automaticTransitionTag<Ev>(transitionTag);
231 automaticTransitionType<Ev>(transitionType);
232 }
233
234 RCLCPP_INFO_STREAM(globalNh_->get_logger(), "Transition tag: " << transitionTag);
235
236 if (!sourceState->getStateMachineInfo()->containsState<Dst>())
237 {
238 auto realparentState = sourceState->getStateMachineInfo()->getState<typename Dst::TContext>();
239 auto siblingnode = sourceState->getStateMachineInfo()->createState<Dst>(realparentState);
240
241 WalkStatesExecutor<Dst>::walkStates(siblingnode, true);
242 sourceState->declareTransition<Ev>(
243 siblingnode, transitionTag, transitionType, history, transitionTypeInfo);
244 }
245 else
246 {
247 auto siblingnode = sourceState->getStateMachineInfo()->getState<Dst>();
248 sourceState->declareTransition<Ev>(
249 siblingnode, transitionTag, transitionType, history, transitionTypeInfo);
250 }
251}

References automaticTransitionTag(), automaticTransitionType(), demangleSymbol(), getTransitionType(), globalNh_, and smacc2::introspection::WalkStatesExecutor< InitialStateType >::walkStates().

Referenced by processTransition(), and processTransition().

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

◆ processTransitions() [1/2]

template<typename T >
enable_if< boost::mpl::is_sequence< T > >::type smacc2::introspection::processTransitions ( std::shared_ptr< SmaccStateInfo > & sourceState)

Definition at line 159 of file smacc_state_machine_info.hpp.

161{
162 RCLCPP_INFO(
163 globalNh_->get_logger(), "State %s Walker has transition list",
164 sourceState->fullStateName.c_str());
165 using boost::mpl::_1;
166 using wrappedList = typename boost::mpl::transform<T, add_type_wrapper<_1>>::type;
167 RCLCPP_INFO(
168 globalNh_->get_logger(), "[DIAG] About to call boost::mpl::for_each for state %s",
169 sourceState->fullStateName.c_str());
170 boost::mpl::for_each<wrappedList>(AddTransition(sourceState));
171 RCLCPP_INFO(
172 globalNh_->get_logger(), "[DIAG] Completed boost::mpl::for_each for state %s",
173 sourceState->fullStateName.c_str());
174}

References globalNh_.

Referenced by smacc2::introspection::AddTransition::operator()(), smacc2::introspection::AddTransition::operator()(), smacc2::introspection::AddTransition::operator()(), and smacc2::introspection::WalkStatesExecutor< InitialStateType >::walkStates().

Here is the caller graph for this function:

◆ processTransitions() [2/2]

template<typename T >
disable_if< boost::mpl::is_sequence< T > >::type smacc2::introspection::processTransitions ( std::shared_ptr< SmaccStateInfo > & sourceState)

Definition at line 322 of file smacc_state_machine_info.hpp.

324{
325 RCLCPP_INFO(
326 globalNh_->get_logger(), "[DIAG] processTransitions [single/leaf] called for state %s",
327 sourceState->fullStateName.c_str());
328 T * dummy = nullptr;
329 processTransition(dummy, sourceState);
330 RCLCPP_INFO(
331 globalNh_->get_logger(), "[DIAG] processTransitions [single/leaf] completed for state %s",
332 sourceState->fullStateName.c_str());
333}
void processTransition(smacc2::Transition< Ev, boost::statechart::deep_history< Dst >, Tag > *, std::shared_ptr< SmaccStateInfo > &sourceState)

References globalNh_, and processTransition().

Here is the call graph for this function:

◆ replace()

bool smacc2::introspection::replace ( std::string & str,
const std::string & from,
const std::string & to )

Definition at line 40 of file string_type_walker.cpp.

41{
42 size_t start_pos = str.find(from);
43 if (start_pos == std::string::npos) return false;
44 str.replace(start_pos, from.length(), to);
45 return true;
46}

Referenced by smacc2::introspection::TypeInfo::getTypeInfoFromString(), and replace_back().

Here is the caller graph for this function:

◆ replace_back()

std::string smacc2::introspection::replace_back ( std::string roottype,
const std::vector< std::pair< std::string, std::string > > & orderedtypesdict )

Definition at line 48 of file string_type_walker.cpp.

50{
51 while (roottype.find("$") != std::string::npos)
52 {
53 for (const auto & t : orderedtypesdict)
54 {
55 const auto & tkey = t.first;
56 const auto & tval = t.second;
57
58 replace(roottype, tkey, tval);
59 }
60 }
61
62 return roottype;
63}
bool replace(std::string &str, const std::string &from, const std::string &to)

References replace().

Referenced by smacc2::introspection::TypeInfo::getTypeInfoFromString().

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

◆ transitionInfoToMsg()

void smacc2::introspection::transitionInfoToMsg ( const SmaccTransitionInfo & transition,
smacc2_msgs::msg::SmaccTransition & transitionMsg )

Definition at line 30 of file reflection.cpp.

32{
33 transitionMsg.index = transition.index;
34
35 // The transition holds its states weakly (see smacc_state_info.hpp). An expired pointer leaves
36 // the name empty, as a null pointer did before.
37 auto sourceState = transition.sourceState.lock();
38 if (sourceState != nullptr)
39 {
40 transitionMsg.source_state_name = sourceState->demangledStateName;
41 }
42
43 transitionMsg.transition_name = transition.transitionTag;
44 transitionMsg.transition_type = transition.transitionType;
45
46 if (transition.eventInfo != nullptr)
47 {
48 transitionMsg.event.event_type = transition.eventInfo->getEventTypeName();
49 transitionMsg.event.event_source = transition.eventInfo->getEventSourceName();
50 transitionMsg.event.event_object_tag = transition.eventInfo->getOrthogonalName();
51 transitionMsg.event.label = transition.eventInfo->label;
52 }
53
54 transitionMsg.history_node = transition.historyNode;
55
56 auto destinyState = transition.destinyState.lock();
57 if (destinyState == nullptr)
58 {
59 transitionMsg.destiny_state_name = "";
60 }
61 else if (transition.historyNode)
62 {
63 auto destinyParent = destinyState->getParentState();
64 if (destinyParent != nullptr)
65 {
66 transitionMsg.destiny_state_name = destinyParent->demangledStateName;
67 }
68 else
69 {
70 transitionMsg.destiny_state_name = "";
71 }
72 }
73 else
74 {
75 transitionMsg.destiny_state_name = destinyState->demangledStateName;
76 }
77}
std::weak_ptr< const SmaccStateInfo > sourceState
std::shared_ptr< SmaccEventInfo > eventInfo
std::weak_ptr< const SmaccStateInfo > destinyState

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

Referenced by smacc2::introspection::SmaccStateMachineInfo::assembleSMStructureMessage(), and smacc2::ISmaccStateMachine::publishTransition().

Here is the caller graph for this function:

Variable Documentation

◆ globalNh_