SMACC2
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 this->onFinished_();
32 this->postEvent<EvCbFinished<TSourceObject, TOrthogonal>>();
33 };
34
35 postSuccessEventFn_ = [this] {
36 this->onSuccess_();
37 this->postEvent<EvCbSuccess<TSourceObject, TOrthogonal>>();
38 };
39
40 postFailureEventFn_ = [this] {
41 this->onFailure_();
42 this->postEvent<EvCbFailure<TSourceObject, TOrthogonal>>();
43 };
44}
45
46template <typename TCallback, typename T>
47boost::signals2::connection SmaccAsyncClientBehavior::onSuccess(TCallback callback, T * object)
48{
49 return this->getStateMachine()->createSignalConnection(onSuccess_, callback, object);
50}
51
52template <typename TCallback, typename T>
53boost::signals2::connection SmaccAsyncClientBehavior::onFinished(TCallback callback, T * object)
54{
55 return this->getStateMachine()->createSignalConnection(onFinished_, callback, object);
56}
57
58template <typename TCallback, typename T>
59boost::signals2::connection SmaccAsyncClientBehavior::onFailure(TCallback callback, T * object)
60{
61 return this->getStateMachine()->createSignalConnection(onFailure_, callback, object);
62}
63} // 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)
void callback(const image_tools::ROSCvMatContainer &img)