SMACC2
Loading...
Searching...
No Matches
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{
29
31{
32public:
34
35 virtual ~ISmaccClientBehavior();
36
38
39 std::string getName() const;
40
41 template <typename SmaccClientType>
42 void requiresClient(SmaccClientType *& storage);
43
44 template <typename SmaccComponentType>
45 [[deprecated(
46 "Use requiresClient with the ComponentRequirement argument. This method will be removed in "
47 "future versions.")]] void
48 requiresComponent(SmaccComponentType *& storage, bool throwExceptionIfNotExist);
49
50 template <typename SmaccComponentType>
52 SmaccComponentType *& storage,
54
55 virtual void onEntry() {}
56
57 virtual void onExit() {}
58
59 //internal visibility (private + friend)
60 virtual void executeOnEntry();
61
62 //internal visibility (private + friend)
63 virtual void executeOnExit();
64
65protected:
66 virtual void runtimeConfigure();
67
68 template <typename EventType>
69 void postEvent(const EventType & ev);
70
71 template <typename EventType>
72 void postEvent();
73
75
76 virtual void dispose();
77
78 virtual rclcpp::Node::SharedPtr getNode() const;
79
80 virtual rclcpp::Logger getLogger() const;
81
82private:
83 template <typename TOrthogonal, typename TSourceObject>
84 [[deprecated(
85 "Use onStateOrthogonalAllocation instead. onOrthogonalAllocation will be removed in future "
86 "versions.")]] void
88
89 // New method: called when the client behavior is allocated to a state (replaces onOrthogonalAllocation)
90 template <typename TOrthogonal, typename TSourceObject>
92
93 // a reference to the owner state machine
95
96 // a reference to the state where the client behavior is being executed
99
100 friend class ISmaccState;
101 friend class ISmaccOrthogonal;
103};
104} // namespace smacc2
smacc2::ISmaccOrthogonal * currentOrthogonal
void requiresComponent(SmaccComponentType *&storage, bool throwExceptionIfNotExist)
virtual rclcpp::Logger getLogger() const
virtual rclcpp::Node::SharedPtr getNode() const
void requiresClient(SmaccClientType *&storage)
ComponentRequirement
Definition common.hpp:75