Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::ElapseTimer Class Reference

Timer for turning true when a certain amount of time has passed. More...

#include <ElapseTimer.h>

Public Member Functions

 ElapseTimer ()
 Default constructor.
 
 ElapseTimer (const timespec &t)
 Initializing constructor setting the elapse time using a timespec struct.
 
 ElapseTimer (unsigned long usec)
 Initializing constructor setting the elapse time in usec.
 
void set (const timespec &t)
 Setting the elapse time and enabling the timer.
 
void set (unsigned long nsec)
 Setting the elapse time and enabling the timer where param 't' is in nano seconds.
 
void reset ()
 Sets the timer up to elapse again.
 
void disable ()
 Disables timer so Active does not return non-zero any more.
 
void enable ()
 Enables timer so without resetting the elapse time.
 
bool isEnabled () const
 Returns non-zero is the timer is enabled.
 
bool isActive () const
 Returns true if the time has elapsed and enabled.
 
TimeSpec getElapseTime () const
 Returns the elapse time set or initialized by the constructor.
 
TimeSpec getTimeLeft () const
 Returns the time left before the timer elapses.
 
TimeSpec getTimeLeft (const timespec &) const
 Returns the time left before the timer elapses.
 
 operator bool () const
 Test if timer is active or not.
 
bool operator() (const timespec &t) const
 This operator is used to minimize clock() calls. Return non-zero if timer is active.
 

Detailed Description

Timer for turning true when a certain amount of time has passed.

Constructor & Destructor Documentation

◆ ElapseTimer() [1/3]

sf::ElapseTimer::ElapseTimer ( )

Default constructor.

◆ ElapseTimer() [2/3]

sf::ElapseTimer::ElapseTimer ( const timespec &  t)
inlineexplicit

Initializing constructor setting the elapse time using a timespec struct.

◆ ElapseTimer() [3/3]

sf::ElapseTimer::ElapseTimer ( unsigned long  usec)
explicit

Initializing constructor setting the elapse time in usec.

Member Function Documentation

◆ disable()

void sf::ElapseTimer::disable ( )
inline

Disables timer so Active does not return non-zero any more.

◆ enable()

void sf::ElapseTimer::enable ( )
inline

Enables timer so without resetting the elapse time.

◆ getElapseTime()

TimeSpec sf::ElapseTimer::getElapseTime ( ) const
inline

Returns the elapse time set or initialized by the constructor.

◆ getTimeLeft() [1/2]

TimeSpec sf::ElapseTimer::getTimeLeft ( ) const

Returns the time left before the timer elapses.

◆ getTimeLeft() [2/2]

TimeSpec sf::ElapseTimer::getTimeLeft ( const timespec &  ) const

Returns the time left before the timer elapses.

◆ isActive()

bool sf::ElapseTimer::isActive ( ) const

Returns true if the time has elapsed and enabled.

◆ isEnabled()

bool sf::ElapseTimer::isEnabled ( ) const
inline

Returns non-zero is the timer is enabled.

◆ operator bool()

sf::ElapseTimer::operator bool ( ) const
inlineexplicit

Test if timer is active or not.

◆ operator()()

bool sf::ElapseTimer::operator() ( const timespec &  t) const

This operator is used to minimize clock() calls. Return non-zero if timer is active.

◆ reset()

void sf::ElapseTimer::reset ( )
inline

Sets the timer up to elapse again.

◆ set() [1/2]

void sf::ElapseTimer::set ( const timespec &  t)

Setting the elapse time and enabling the timer.

◆ set() [2/2]

void sf::ElapseTimer::set ( unsigned long  nsec)

Setting the elapse time and enabling the timer where param 't' is in nano seconds.


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