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>
46 SmaccComponentType *& storage,
48
49 virtual void onEntry() {}
50
51 virtual void onExit() {}
52
53 //internal visibility (private + friend)
54 virtual void executeOnEntry();
55
56 //internal visibility (private + friend)
57 virtual void executeOnExit();
58
59protected:
60 virtual void runtimeConfigure();
61
62 template <typename EventType>
63 void postEvent(const EventType & ev);
64
65 template <typename EventType>
66 void postEvent();
67
69
70 virtual void dispose();
71
72 virtual rclcpp::Node::SharedPtr getNode() const;
73
74 virtual rclcpp::Logger getLogger() const;
75
76private:
77 template <typename TOrthogonal, typename TSourceObject>
79
80 // a reference to the owner state machine
82
83 // a reference to the state where the client behavior is being executed
86
87 friend class ISmaccState;
88 friend class ISmaccOrthogonal;
90};
91} // namespace smacc2
smacc2::ISmaccOrthogonal * currentOrthogonal
virtual rclcpp::Logger getLogger() const
virtual rclcpp::Node::SharedPtr getNode() const
void requiresClient(SmaccClientType *&storage)
void requiresComponent(SmaccComponentType *&storage, ComponentRequirement requirementType=ComponentRequirement::SOFT)
ComponentRequirement
Definition common.hpp:75