SMACC2
Loading...
Searching...
No Matches
smacc_asynchronous_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
24
25namespace smacc2
26{
27template <typename TOrthogonal, typename TSourceObject>
29{
30 postFinishEventFn_ = [this]
31 {
32 this->onFinished_();
33 this->postEvent<EvCbFinished<TSourceObject, TOrthogonal>>();
34 };
35
36 postSuccessEventFn_ = [this]
37 {
38 this->onSuccess_();
39 this->postEvent<EvCbSuccess<TSourceObject, TOrthogonal>>();
40 };
41
42 postFailureEventFn_ = [this]
43 {
44 this->onFailure_();
45 this->postEvent<EvCbFailure<TSourceObject, TOrthogonal>>();
46 };
47}
48
49template <typename TCallback, typename T>
50boost::signals2::connection SmaccAsyncClientBehavior::onSuccess(TCallback callback, T * object)
51{
52 return this->getStateMachine()->createSignalConnection(onSuccess_, callback, object);
53}
54
55template <typename TCallback, typename T>
56boost::signals2::connection SmaccAsyncClientBehavior::onFinished(TCallback callback, T * object)
57{
58 return this->getStateMachine()->createSignalConnection(onFinished_, callback, object);
59}
60
61template <typename TCallback, typename T>
62boost::signals2::connection SmaccAsyncClientBehavior::onFailure(TCallback callback, T * object)
63{
64 return this->getStateMachine()->createSignalConnection(onFailure_, callback, object);
65}
66} // namespace smacc2
boost::signals2::connection createSignalConnection(TSmaccSignal &signal, TMemberFunctionPrototype callback, TSmaccObjectType *object)
boost::signals2::connection onFinished(TCallback callback, T *object)
boost::signals2::connection onSuccess(TCallback callback, T *object)
boost::signals2::connection onFailure(TCallback callback, T *object)