SMACC2
Loading...
Searching...
No Matches
common.hpp
Go to the documentation of this file.
1// Copyright 2025 Robosoft 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#pragma once
21
22// boost statechart
23#define BOOST_BIND_NO_PLACEHOLDERS
24#if defined(__clang__)
25#pragma clang diagnostic push
26// Filters out the deprecated std::auto_ptr warning from Boost.Statechart's processor_container.
27#pragma clang diagnostic ignored "-Wdeprecated-declarations"
28#endif
29#include <boost/statechart/asynchronous_state_machine.hpp>
30#if defined(__clang__)
31#pragma clang diagnostic pop
32#endif
33#include <boost/statechart/custom_reaction.hpp>
34#include <boost/statechart/deep_history.hpp>
35#include <boost/statechart/event.hpp>
36#include <boost/statechart/simple_state.hpp>
37#include <boost/statechart/state.hpp>
38
39// other boost includes
40#include <boost/algorithm/string.hpp>
41#include <boost/any.hpp>
42#include <boost/config.hpp>
43#include <boost/function.hpp>
44#include <boost/intrusive_ptr.hpp>
45#include <boost/mpl/list.hpp>
46
47#include <mutex>
48#include <rclcpp/rclcpp.hpp>
49
53
54typedef boost::statechart::processor_container<
55 boost::statechart::fifo_scheduler<>, boost::function0<void>,
56 std::allocator<boost::statechart::none>>::processor_context my_context;
57
58namespace smacc2
59{
60template <class T>
61using deep_history = sc::deep_history<T>;
62
63namespace utils
64{
65// demangles the type name to be used as a ros node name
66std::string cleanShortTypeName(const std::type_info & tinfo);
67
68template <typename T>
69std::string cleanShortTypeName()
70{
71 return cleanShortTypeName(typeid(T));
72}
73} // namespace utils
74
75enum class SMRunMode
76{
77 DEBUG,
79};
80
82{
83 SOFT,
84 HARD
85};
86
87} // namespace smacc2
88
boost::statechart::processor_container< boost::statechart::fifo_scheduler<>, boost::function0< void >, std::allocator< boost::statechart::none > >::processor_context my_context
Definition common.hpp:56
std::string cleanShortTypeName()
Definition common.hpp:69
SMRunMode
Definition common.hpp:76
sc::deep_history< T > deep_history
Definition common.hpp:61
ComponentRequirement
Definition common.hpp:82