ScopedStopWatch.cpp
Go to the documentation of this file.
1#include "ScopedStopWatch.h"
2
3#include <functional>
4
5#include <IceUtil/Time.h>
6
8
9namespace armarx::core::time
10{
11
12 ScopedStopWatch::ScopedStopWatch(std::function<void(const Duration&)> callback,
13 ClockType clockType) :
14 StopWatch(clockType), _callback{callback}
15 {
16 // pass
17 }
18
20 {
21 _callback(stop());
22 }
23
24} // namespace armarx::core::time
25
26namespace armarx
27{
28 ScopedStopWatch::ScopedStopWatch(std::function<void(IceUtil::Time)> callback,
29 TimeMode timeMode) :
30 StopWatch(timeMode), m_callback{callback}
31 {
32 // pass
33 }
34
36 {
37 m_callback(stop());
38 }
39} // namespace armarx
ScopedStopWatch(std::function< void(IceUtil::Time)> callback, armarx::TimeMode timeMode=armarx::TimeMode::SystemTime)
virtual ~ScopedStopWatch() override
IceUtil::Time stop()
StopWatch(armarx::TimeMode timeMode=armarx::TimeMode::SystemTime)
Definition StopWatch.cpp:89
Represents a duration.
Definition Duration.h:17
ScopedStopWatch(std::function< void(const Duration &)> callback, ClockType clockType=ClockType::Virtual)
Constructs a ScopedStopWatch.
virtual ~ScopedStopWatch() override
Destructs the ScopedStopWatch.
Duration stop()
Stops the timer and returns the measured duration.
Definition StopWatch.cpp:39
StopWatch(ClockType clockType=ClockType::Virtual)
Constructs a StopWatch and starts it immediately.
Definition StopWatch.cpp:19
TimeMode
Time mode to be used.
Definition TimeUtil.h:124
ClockType
Describes the type of clock.
Definition ClockType.h:10
This file offers overloads of toIce() and fromIce() functions for STL container types.