SMACC2
common.hpp
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#pragma once
21
22// boost statechart
23#include <boost/statechart/asynchronous_state_machine.hpp>
24#include <boost/statechart/custom_reaction.hpp>
25#include <boost/statechart/deep_history.hpp>
26#include <boost/statechart/event.hpp>
27#include <boost/statechart/simple_state.hpp>
28#include <boost/statechart/state.hpp>
29
30// other boost includes
31#include <boost/algorithm/string.hpp>
32#include <boost/any.hpp>
33#include <boost/config.hpp>
34#include <boost/function.hpp>
35#include <boost/intrusive_ptr.hpp>
36#include <boost/mpl/list.hpp>
37#include <boost/signals2.hpp>
38
39#include <mutex>
40#include <rclcpp/rclcpp.hpp>
41
45
46typedef boost::statechart::processor_container<
47 boost::statechart::fifo_scheduler<>, boost::function0<void>,
48 std::allocator<boost::statechart::none>>::processor_context my_context;
49
50namespace smacc2
51{
52template <class T>
53using deep_history = sc::deep_history<T>;
54
55namespace utils
56{
57// demangles the type name to be used as a ros node name
58std::string cleanShortTypeName(const std::type_info & tinfo);
59
60template <typename T>
61std::string cleanShortTypeName()
62{
63 return cleanShortTypeName(typeid(T));
64}
65} // namespace utils
66
67enum class SMRunMode
68{
69 DEBUG,
71};
72
73template <typename StateMachineType>
74void run();
75} // namespace smacc2
76
boost::statechart::processor_container< boost::statechart::fifo_scheduler<>, boost::function0< void >, std::allocator< boost::statechart::none > >::processor_context my_context
Definition: common.hpp:48
std::string cleanShortTypeName(const std::type_info &tinfo)
Definition: common.cpp:28
SMRunMode
Definition: common.hpp:68
sc::deep_history< T > deep_history
Definition: common.hpp:53