AJA NTV2 SDK  17.1.1.1245
NTV2 SDK 17.1.1.1245
AJATimer Class Reference

#include <timer.h>

Public Member Functions

 AJATimer (const AJATimerPrecision precision=AJATimerPrecisionMilliseconds)
 
virtual ~AJATimer ()
 
void Start (void)
 
void Stop (void)
 
void Reset (void)
 
uint32_t ElapsedTime (void) const
 
double ETSecs (void) const
 
bool Timeout (const uint32_t interval) const
 
bool IsRunning (void) const
 
AJATimerPrecision Precision (void) const
 
std::ostream & Print (std::ostream &oss) const
 

Static Public Member Functions

static std::string PrecisionName (const AJATimerPrecision precision, const bool longName=true)
 
static double PrecisionSecs (const AJATimerPrecision precision)
 

Detailed Description

Class to support timing of events

Definition at line 25 of file timer.h.

Constructor & Destructor Documentation

◆ AJATimer()

AJATimer::AJATimer ( const AJATimerPrecision  precision = AJATimerPrecisionMilliseconds)

Definition at line 15 of file timer.cpp.

◆ ~AJATimer()

virtual AJATimer::~AJATimer ( )
inlinevirtual

Definition at line 29 of file timer.h.

Member Function Documentation

◆ ElapsedTime()

uint32_t AJATimer::ElapsedTime ( void  ) const

Get the elapsed time.

If the timer is running, return the elapsed time since Start() was called. If Stop() has been called, return the time between Start() and Stop().

Returns
The elapsed time in selected timer precision units

Definition at line 58 of file timer.cpp.

◆ ETSecs()

double AJATimer::ETSecs ( void  ) const
inline

Get the elapsed time, in seconds, as a double-precision floating point value.

If the timer is running, return the elapsed time since Start() was called. If Stop() has been called, return the time elapsed between Start() and Stop().

Returns
The elapsed time, in seconds

Definition at line 64 of file timer.h.

◆ IsRunning()

bool AJATimer::IsRunning ( void  ) const
inline

Is the timer running.

Returns
true if timer is running.

Definition at line 81 of file timer.h.

◆ Precision()

AJATimerPrecision AJATimer::Precision ( void  ) const
inline

Return the timer precision enum.

Returns
precision enum that was used in the constructor.

Definition at line 88 of file timer.h.

◆ PrecisionName()

std::string AJATimer::PrecisionName ( const AJATimerPrecision  precision,
const bool  longName = true 
)
static

Return the display string for the given timer precision enum.

Parameters
precisionThe precision enum to get the display string for.
longNameIf true the string is set to a long description, otherwise an abbreviation.
Returns
string description

Definition at line 111 of file timer.cpp.

◆ PrecisionSecs()

double AJATimer::PrecisionSecs ( const AJATimerPrecision  precision)
static

Return the fraction of a second as a double-precision floating point value for the given timer precision.

Parameters
precisionThe precision enum to get the display string for.
Returns
double-precision value

Definition at line 131 of file timer.cpp.

◆ Print()

std::ostream & AJATimer::Print ( std::ostream &  oss) const

Prints my elapsed time into the given output stream.

Parameters
ossthe output stream to use
Returns
the output stream being used

Definition at line 75 of file timer.cpp.

◆ Reset()

void AJATimer::Reset ( void  )

Resets me to a stopped state with no elapsed time, without changing my precision.

Definition at line 50 of file timer.cpp.

◆ Start()

void AJATimer::Start ( void  )

Starts me. If already running, re-starts me.

Definition at line 22 of file timer.cpp.

◆ Stop()

void AJATimer::Stop ( void  )

Stops me. If already stopped, re-stops me.

Definition at line 36 of file timer.cpp.

◆ Timeout()

bool AJATimer::Timeout ( const uint32_t  interval) const
inline

Check for timeout.

Timeout checks the ElapsedTime() and returns true if it is greater than interval.

Parameters
intervalTimeout interval in selected timer precision units.
Returns
true if elapsed time greater than interval.

Definition at line 74 of file timer.h.


The documentation for this class was generated from the following files: