SMACC2
Loading...
Searching...
No Matches
smacc2_client_library
ros_timer_client
src
ros_timer_client
cb_timer_countdown_once.cpp
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
#include <ros_timer_client/client_behaviors/cb_timer_countdown_once.hpp>
16
17
namespace
cl_ros_timer
18
{
19
CbTimerCountdownOnce::CbTimerCountdownOnce
(int64_t triggerTickCount)
20
: tickCounter_(0), tickTriggerCount_(triggerTickCount)
21
{
22
}
23
24
void
CbTimerCountdownOnce::onClientTimerTickCallback
()
25
{
26
tickCounter_
++;
27
28
if
(
tickCounter_
%
tickTriggerCount_
== 0)
29
{
30
onTimerTick_
();
31
postCountDownEvent_
();
32
}
33
}
34
35
void
CbTimerCountdownOnce::onEntry
()
36
{
37
this->
requiresClient
(
timerClient_
);
38
timerClient_
->
onTimerTick
(&
CbTimerCountdownOnce::onClientTimerTickCallback
,
this
);
39
}
40
41
void
CbTimerCountdownOnce::onExit
() {}
42
}
// namespace cl_ros_timer
cl_ros_timer::CbTimerCountdownOnce::tickCounter_
int64_t tickCounter_
Definition
cb_timer_countdown_once.hpp:44
cl_ros_timer::CbTimerCountdownOnce::onClientTimerTickCallback
void onClientTimerTickCallback()
Definition
cb_timer_countdown_once.cpp:24
cl_ros_timer::CbTimerCountdownOnce::onTimerTick_
smacc2::SmaccSignal< void()> onTimerTick_
Definition
cb_timer_countdown_once.hpp:49
cl_ros_timer::CbTimerCountdownOnce::onEntry
void onEntry() override
Definition
cb_timer_countdown_once.cpp:35
cl_ros_timer::CbTimerCountdownOnce::tickTriggerCount_
int64_t tickTriggerCount_
Definition
cb_timer_countdown_once.hpp:45
cl_ros_timer::CbTimerCountdownOnce::timerClient_
ClRosTimer * timerClient_
Definition
cb_timer_countdown_once.hpp:47
cl_ros_timer::CbTimerCountdownOnce::onExit
void onExit() override
Definition
cb_timer_countdown_once.cpp:41
cl_ros_timer::CbTimerCountdownOnce::CbTimerCountdownOnce
CbTimerCountdownOnce(int64_t triggerTickCount)
Definition
cb_timer_countdown_once.cpp:19
cl_ros_timer::CbTimerCountdownOnce::postCountDownEvent_
std::function< void()> postCountDownEvent_
Definition
cb_timer_countdown_once.hpp:48
cl_ros_timer::ClRosTimer::onTimerTick
boost::signals2::connection onTimerTick(void(T::*callback)(), T *object)
Definition
cl_ros_timer.hpp:49
smacc2::ISmaccClientBehavior::requiresClient
void requiresClient(SmaccClientType *&storage)
Definition
smacc_client_behavior_impl.hpp:67
cl_ros_timer
Definition
cl_ros_timer.hpp:23
Generated by
1.9.8