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{
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, bool throwExceptionIfNotExist = false);
45
46 virtual void onEntry() {}
47
48 virtual void onExit() {}
49
50 //internal visibility (private + friend)
51 virtual void executeOnEntry();
52
53 //internal visibility (private + friend)
54 virtual void executeOnExit();
55
56protected:
57 virtual void runtimeConfigure();
58
59 template <typename EventType>
60 void postEvent(const EventType & ev);
61
62 template <typename EventType>
63 void postEvent();
64
66
67 virtual void dispose();
68
69 virtual rclcpp::Node::SharedPtr getNode() const;
70
71 virtual rclcpp::Logger getLogger() const;
72
73private:
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::Logger getLogger() const
virtual rclcpp::Node::SharedPtr getNode() const
void requiresClient(SmaccClientType *&storage)
void requiresComponent(SmaccComponentType *&storage, bool throwExceptionIfNotExist=false)