OpenJAUS SAE SDK  6.0.0
Public Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
openjaus::system::Timer Class Reference

#include <Timer.h>

Public Member Functions

 Timer ()
 
virtual ~Timer ()
 
 Timer (void(*functionPointer)(void *, Timer *), void *data)
 
void start ()
 Starts the timer using the current interval Using this method on a running timer has no effect. More...
 
void start (int interval_ms)
 Starts the timer using the specified interval Using this method on a running timer has no effect Interval value of 0 is ignored and timer will not start. More...
 
void setInterval_ms (int value)
 Set the timer interval Has no effect if timer is running. More...
 
int getInterval_ms ()
 Get the timer interval. More...
 
void changeInterval_ms (int value)
 Change the running timer interval. More...
 
void reset ()
 Reset the timer. More...
 
void stop ()
 Stop the timer. More...
 
virtual std::string toString () const
 
void setTimerFunction (void(*functionPointer)(void *, Timer *), void *data)
 
bool isRunning () const
 
void OPENJAUS_DEPRECATED reset (int milliseconds)
 
void OPENJAUS_DEPRECATED setInterval (int milliseconds)
 

Static Private Member Functions

static void timerEventFunction (sigval_t)
 

Private Attributes

timer_t timerId
 
struct sigevent event
 
struct itimerspec intervalSpec
 
bool running
 
bool stopped
 
bool created
 
Mutex timerFuncMutex
 
void * data
 
void(* timerFunction )(void *, Timer *)
 
int interval_ms
 

Friends

OPENJAUS_EXPORT friend std::ostream & operator<< (std::ostream &output, const Timer &object)
 
OPENJAUS_EXPORT friend std::ostream & operator<< (std::ostream &output, const Timer *object)
 

Constructor & Destructor Documentation

◆ Timer() [1/2]

openjaus::system::Timer::Timer ( )

◆ ~Timer()

openjaus::system::Timer::~Timer ( )
virtual

◆ Timer() [2/2]

openjaus::system::Timer::Timer ( void(*)(void *, Timer *)  functionPointer,
void *  data 
)

Member Function Documentation

◆ changeInterval_ms()

void openjaus::system::Timer::changeInterval_ms ( int  value)

◆ getInterval_ms()

int openjaus::system::Timer::getInterval_ms ( )

◆ isRunning()

bool openjaus::system::Timer::isRunning ( ) const
inline

◆ reset() [1/2]

void openjaus::system::Timer::reset ( )

◆ reset() [2/2]

void openjaus::system::Timer::reset ( int  milliseconds)
Deprecated:
This function will be removed in a future revision.

Use reset() instead. To obtain same functionality as deprecated method, use the changeInterval_ms() method.

Deprecated:

◆ setInterval()

void openjaus::system::Timer::setInterval ( int  milliseconds)
Deprecated:
This function will be removed in a future revision.

Use setInterval_ms(int milliseconds) instead. To obtain same functionality as deprecated method, use start(int milliseconds) or setInterval_ms(int milliseconds) followed by start().

Deprecated:

◆ setInterval_ms()

void openjaus::system::Timer::setInterval_ms ( int  value)

◆ setTimerFunction()

void openjaus::system::Timer::setTimerFunction ( void(*)(void *, Timer *)  functionPointer,
void *  data 
)

◆ start() [1/2]

void openjaus::system::Timer::start ( )

Interval value of 0 is ignored and timer will not start

◆ start() [2/2]

void openjaus::system::Timer::start ( int  interval_ms)

◆ stop()

void openjaus::system::Timer::stop ( )

◆ timerEventFunction()

void openjaus::system::Timer::timerEventFunction ( sigval_t  sigval)
staticprivate

◆ toString()

std::string openjaus::system::Timer::toString ( ) const
virtual

Friends And Related Function Documentation

◆ operator<< [1/2]

OPENJAUS_EXPORT friend std::ostream& operator<< ( std::ostream &  output,
const Timer object 
)
friend

◆ operator<< [2/2]

OPENJAUS_EXPORT friend std::ostream& operator<< ( std::ostream &  output,
const Timer object 
)
friend

Member Data Documentation

◆ created

bool openjaus::system::Timer::created
private

◆ data

void* openjaus::system::Timer::data
private

◆ event

struct sigevent openjaus::system::Timer::event
private

◆ interval_ms

int openjaus::system::Timer::interval_ms
private

◆ intervalSpec

struct itimerspec openjaus::system::Timer::intervalSpec
private

◆ running

bool openjaus::system::Timer::running
private

◆ stopped

bool openjaus::system::Timer::stopped
private

◆ timerFuncMutex

Mutex openjaus::system::Timer::timerFuncMutex
private

◆ timerFunction

void(* openjaus::system::Timer::timerFunction) (void *, Timer *)
private

◆ timerId

timer_t openjaus::system::Timer::timerId
private

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