SMACC2
smacc_client_behavior_base.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
21#pragma once
22
23#include <string>
24
25#include <smacc2/common.hpp>
26
27namespace smacc2
28{
30{
31public:
33
34 virtual ~ISmaccClientBehavior();
35
37
38 std::string getName() const;
39
40 template <typename SmaccClientType>
41 void requiresClient(SmaccClientType *& storage);
42
43 template <typename SmaccComponentType>
44 void requiresComponent(SmaccComponentType *& storage);
45
46protected:
47 virtual void runtimeConfigure();
48
49 virtual void onEntry() {}
50
51 virtual void onExit() {}
52
53 template <typename EventType>
54 void postEvent(const EventType & ev);
55
56 template <typename EventType>
57 void postEvent();
58
60
61 virtual void dispose();
62
63 virtual rclcpp::Node::SharedPtr getNode();
64
65 virtual rclcpp::Logger getLogger();
66
67private:
68 //internal visibility (private + friend)
69 virtual void executeOnEntry();
70
71 //internal visibility (private + friend)
72 virtual void executeOnExit();
73
74 template <typename TOrthogonal, typename TSourceObject>
76
77 // a reference to the owner state machine
79
80 // a reference to the state where the client behavior is being executed
83
84 friend class ISmaccState;
85 friend class ISmaccOrthogonal;
87};
88} // namespace smacc2
smacc2::ISmaccOrthogonal * currentOrthogonal
virtual rclcpp::Node::SharedPtr getNode()
void requiresClient(SmaccClientType *&storage)
void requiresComponent(SmaccComponentType *&storage)