SMACC2
Loading...
Searching...
No Matches
smacc2
src
smacc2
introspection
reflection.cpp
Go to the documentation of this file.
1
// Copyright 2021 RobosoftAI Inc.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
/*****************************************************************************************************************
16
*
17
* Authors: Pablo Inigo Blasco, Brett Aldrich
18
*
19
******************************************************************************************************************/
20
21
#include <
smacc2/introspection/introspection.hpp
>
22
#include "rclcpp/rclcpp.hpp"
23
24
namespace
smacc2
25
{
26
namespace
introspection
27
{
28
rclcpp::Node::SharedPtr
globalNh_
;
29
30
void
transitionInfoToMsg
(
31
const
SmaccTransitionInfo
& transition, smacc2_msgs::msg::SmaccTransition &
transitionMsg
)
32
{
33
transitionMsg
.index = transition.
index
;
34
35
if
(transition.
sourceState
!=
nullptr
)
36
{
37
transitionMsg
.source_state_name = transition.
sourceState
->demangledStateName;
38
}
39
40
transitionMsg
.transition_name = transition.
transitionTag
;
41
transitionMsg
.transition_type = transition.
transitionType
;
42
43
if
(transition.
eventInfo
!=
nullptr
)
44
{
45
transitionMsg
.event.event_type = transition.
eventInfo
->getEventTypeName();
46
transitionMsg
.event.event_source = transition.
eventInfo
->getEventSourceName();
47
transitionMsg
.event.event_object_tag = transition.
eventInfo
->getOrthogonalName();
48
transitionMsg
.event.label = transition.
eventInfo
->label;
49
}
50
51
transitionMsg
.history_node = transition.
historyNode
;
52
53
if
(transition.
historyNode
)
54
{
55
if
(transition.
destinyState
->parentState_ !=
nullptr
)
56
{
57
transitionMsg
.destiny_state_name = transition.
destinyState
->parentState_->demangledStateName;
58
}
59
else
60
{
61
transitionMsg
.destiny_state_name =
""
;
62
}
63
}
64
else
65
{
66
transitionMsg
.destiny_state_name = transition.
destinyState
->demangledStateName;
67
}
68
}
69
}
// namespace introspection
70
}
// namespace smacc2
introspection.hpp
smacc2::introspection::globalNh_
rclcpp::Node::SharedPtr globalNh_
Definition
reflection.cpp:28
smacc2::introspection::transitionInfoToMsg
void transitionInfoToMsg(const SmaccTransitionInfo &transition, smacc2_msgs::msg::SmaccTransition &transitionMsg)
Definition
reflection.cpp:30
smacc2
Definition
callback_counter_semaphore.hpp:30
smacc2::default_events::EvTopicMessage
Definition
smacc_default_events.hpp:155
smacc2::introspection::SmaccTransitionInfo
Definition
smacc_state_info.hpp:61
smacc2::introspection::SmaccTransitionInfo::historyNode
bool historyNode
Definition
smacc_state_info.hpp:64
smacc2::introspection::SmaccTransitionInfo::index
int index
Definition
smacc_state_info.hpp:65
smacc2::introspection::SmaccTransitionInfo::destinyState
std::shared_ptr< const SmaccStateInfo > destinyState
Definition
smacc_state_info.hpp:67
smacc2::introspection::SmaccTransitionInfo::eventInfo
std::shared_ptr< SmaccEventInfo > eventInfo
Definition
smacc_state_info.hpp:71
smacc2::introspection::SmaccTransitionInfo::transitionTag
std::string transitionTag
Definition
smacc_state_info.hpp:69
smacc2::introspection::SmaccTransitionInfo::sourceState
std::shared_ptr< const SmaccStateInfo > sourceState
Definition
smacc_state_info.hpp:66
smacc2::introspection::SmaccTransitionInfo::transitionType
std::string transitionType
Definition
smacc_state_info.hpp:70
Generated by
1.9.8