Class Clock
Defined in File clock.hpp
Base Type
public holoscan::Resource
(Class Resource)
-
class Clock : public holoscan::Resource
Clock resource class using Bridge pattern.
Clock classes are used by a Scheduler to control the flow of time in an application. This class acts as a Resource wrapper around a ClockInterface implementation.
Public Functions
-
template<typename ArgT, typename ...ArgsT, typename = std::enable_if_t<!std::is_base_of_v<::holoscan::Resource, std::decay_t<ArgT>> && (std::is_same_v<::holoscan::Arg, std::decay_t<ArgT>> || std::is_same_v<::holoscan::ArgList, std::decay_t<ArgT>>)>>
inline explicit Clock(ArgT &&arg, ArgsT&&... args)
-
Clock() = default
Constructor that takes a clock implementation.
-
~Clock() override = default
Set the clock implementation.
-
inline std::shared_ptr<ClockInterface> clock_impl() const
Get the clock implementation.
Template method for safe casting to specific clock implementation types.
-
inline virtual double time() const
The current time of the clock. Time is measured in seconds.
-
inline virtual int64_t timestamp() const
The current timestamp of the clock. Timestamps are measured in nanoseconds.
-
inline virtual void sleep_for(int64_t duration_ns)
Waits until the given duration has elapsed on the clock.
-
template<typename Rep, typename Period>
inline void sleep_for(std::chrono::duration<Rep, Period> duration) Set a duration to sleep.
- Parameters
duration – The sleep duration of type
std::chrono::duration
.
-
inline virtual void sleep_until(int64_t target_time_ns)
Waits until the given target time.
Protected Attributes
-
std::shared_ptr<ClockInterface> clock_impl_
The clock implementation.
-
template<typename ArgT, typename ...ArgsT, typename = std::enable_if_t<!std::is_base_of_v<::holoscan::Resource, std::decay_t<ArgT>> && (std::is_same_v<::holoscan::Arg, std::decay_t<ArgT>> || std::is_same_v<::holoscan::ArgList, std::decay_t<ArgT>>)>>