30 ss <<
"----------- PRINT STATE MACHINE STRUCTURE -------------------" << std::endl;
34 for (
auto & val : this->
states)
36 smacc2_msgs::msg::SmaccState stateMsg;
37 auto state = val.second;
39 stateMsg.index = state->stateIndex_;
41 ss <<
"**** State: " <<
demangleSymbol(val.first.c_str()) << std::endl;
43 stateMsg.name = state->getDemangledFullName();
44 stateMsg.level =
static_cast<int8_t
>(state->getStateLevel());
46 ss <<
"Index: " << stateMsg.index << std::endl;
47 ss <<
"StateLevel: " << stateMsg.level << std::endl;
49 ss <<
" Childstates:" << std::endl;
52 for (
auto & child : state->children_)
54 auto childStateName = child->getDemangledFullName();
55 stateMsg.children_states.push_back(childStateName);
57 ss <<
" - " << childStateName << std::endl;
60 ss <<
" Transitions:" << std::endl;
63 for (
auto & transition : state->transitions_)
65 smacc2_msgs::msg::SmaccTransition transitionMsg;
69 ss <<
" - Transition. " << std::endl;
70 ss <<
" - Index: " << transitionMsg.index << std::endl;
71 ss <<
" - Transition Name: " << transitionMsg.transition_name << std::endl;
72 ss <<
" - Transition Type: " << transitionMsg.transition_type << std::endl;
73 ss <<
" - Event Type :" << transitionMsg.event.event_type << std::endl;
74 ss <<
" - Event Source: " << transitionMsg.event.event_source << std::endl;
75 ss <<
" - Event ObjectTag: " << transitionMsg.event.event_object_tag << std::endl;
76 ss <<
" - Event Label: " << transitionMsg.event.label << std::endl;
77 ss <<
" - Destiny State: " << transitionMsg.destiny_state_name << std::endl;
78 ss <<
" - Owner State: " << transitionMsg.source_state_name << std::endl;
79 ss <<
" - Is History Node: " << std::to_string(transitionMsg.history_node) << std::endl;
80 ss <<
" - TransitionC++Type: " << transition.transitionTypeInfo->getFullName()
82 ss <<
" - EventC++Type: " << transition.eventInfo->eventType->getFullName() << std::endl;
84 stateMsg.transitions.push_back(transitionMsg);
87 const std::type_info * statetid = state->tid_;
90 std::map<const std::type_info *, std::vector<smacc2::ClientBehaviorInfoEntry *>>
91 smaccBehaviorInfoMappingByOrthogonalType;
93 ss <<
" Orthogonals:" << std::endl;
98 smaccBehaviorInfoMappingByOrthogonalType[bhinfo.orthogonalType].push_back(&bhinfo);
105 for (
auto & orthogonal : runtimeOrthogonals)
107 smacc2_msgs::msg::SmaccOrthogonal orthogonalMsg;
109 const auto & orthogonalRef = *(orthogonal.second);
110 const auto * orthogonaltid = &
typeid(orthogonalRef);
113 ss <<
" - orthogonal: " << orthogonalMsg.name << std::endl;
116 if (smaccBehaviorInfoMappingByOrthogonalType[orthogonaltid].size() > 0)
118 auto & behaviors = smaccBehaviorInfoMappingByOrthogonalType[orthogonaltid];
119 for (
auto & bhinfo : behaviors)
121 auto ClientBehaviorName =
demangleSymbol(bhinfo->behaviorType->name());
122 orthogonalMsg.client_behavior_names.push_back(ClientBehaviorName);
123 ss <<
" - client behavior: " << ClientBehaviorName << std::endl;
128 ss <<
" - NO CLIENT BEHAVIORS -" << std::endl;
132 auto & clients = orthogonal.second->getClients();
133 if (clients.size() > 0)
135 for (
auto & client : clients)
137 auto clientTid = client->getType();
138 auto clientName = clientTid->getNonTemplatedTypeName();
139 orthogonalMsg.client_names.push_back(clientName);
140 ss <<
" - client: " << clientName << std::endl;
145 ss <<
" - NO CLIENTS - " << std::endl;
147 stateMsg.orthogonals.push_back(orthogonalMsg);
151 ss <<
" State event generators:" << std::endl;
157 smacc2_msgs::msg::SmaccEventGenerator eventGeneratorMsg;
158 eventGeneratorMsg.index = k++;
159 eventGeneratorMsg.type_name = eginfo->eventGeneratorType->getFullName();
161 ss <<
" - event generator: " << eventGeneratorMsg.type_name << std::endl;
162 if (eginfo->objectTagType !=
nullptr)
164 eventGeneratorMsg.object_tag = eginfo->objectTagType->getFullName();
165 ss <<
" - object tag: " << eventGeneratorMsg.object_tag << std::endl;
167 stateMsg.event_generators.push_back(eventGeneratorMsg);
172 ss <<
" State reactors:" << std::endl;
178 smacc2_msgs::msg::SmaccStateReactor stateReactorMsg;
179 stateReactorMsg.index = k++;
180 stateReactorMsg.type_name = srinfo->stateReactorType->getFullName();
182 ss <<
" - state reactor: " << stateReactorMsg.type_name << std::endl;
183 if (srinfo->objectTagType !=
nullptr)
185 stateReactorMsg.object_tag = srinfo->objectTagType->getFullName();
186 ss <<
" - object tag: " << stateReactorMsg.object_tag << std::endl;
190 for (
auto & tev : srinfo->sourceEventTypes)
193 auto eventTypeName = tev->getEventTypeName();
194 smacc2_msgs::msg::SmaccEvent event;
196 ss <<
" - triggering event: " << tev->getEventTypeName() << std::endl;
197 event.event_type = eventTypeName;
199 event.event_source = tev->getEventSourceName();
200 ss <<
" - source type: " <<
event.event_source << std::endl;
202 event.event_object_tag = tev->getOrthogonalName();
203 ss <<
" - source object: " <<
event.event_object_tag << std::endl;
205 event.label = tev->label;
206 ss <<
" - event label: " <<
event.label << std::endl;
208 stateReactorMsg.event_sources.push_back(event);
211 stateMsg.state_reactors.push_back(stateReactorMsg);
216 ss <<
"- NO STATE REACTORS - " << std::endl;
219 ss <<
"----------------------------------------------------------" << std::endl;
222 auto resumeMsg = ss.str();
223 RCLCPP_DEBUG(
getLogger(),
"%s", resumeMsg.c_str());