SMACC2
smacc_client_behavior_impl.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
25
26namespace smacc2
27{
28template <typename EventType>
29void ISmaccClientBehavior::postEvent(const EventType & ev)
30{
31 if (stateMachine_ == nullptr)
32 {
33 RCLCPP_ERROR(
34 getLogger(),
35 "The client behavior cannot post events before being assigned to an orthogonal. Ignoring "
36 "post event call.");
37 }
38 else
39 {
41 }
42}
43
44template <typename EventType>
46{
47 if (stateMachine_ == nullptr)
48 {
49 RCLCPP_ERROR(
50 getLogger(),
51 "The client behavior cannot post events before being assigned to an orthogonal. Ignoring "
52 "post event call.");
53 }
54 else
55 {
56 stateMachine_->template postEvent<EventType>(EventLifeTime::CURRENT_STATE);
57 }
58}
59
60//inline
62
63//inline
65
66template <typename SmaccClientType>
67void ISmaccClientBehavior::requiresClient(SmaccClientType *& storage)
68{
70}
71
72template <typename SmaccComponentType>
73void ISmaccClientBehavior::requiresComponent(SmaccComponentType *& storage)
74{
75 if (stateMachine_ == nullptr)
76 {
77 RCLCPP_ERROR(
78 getLogger(),
79 "Cannot use the requiresComponent funcionality before assigning the client behavior to an "
80 "orthogonal. Try using the OnEntry method to capture required components.");
81 }
82 else
83 {
85 }
86}
87
88template <typename TOrthogonal, typename TSourceObject>
90{
91}
92
93} // namespace smacc2
smacc2::ISmaccOrthogonal * currentOrthogonal
void requiresClient(SmaccClientType *&storage)
void requiresComponent(SmaccComponentType *&storage)
bool requiresClient(SmaccClientType *&storage)
void requiresComponent(SmaccComponentType *&storage)
void postEvent(EventType *ev, EventLifeTime evlifetime=EventLifeTime::ABSOLUTE)