sptk2 logo
SPTK Home Page
Public Types | Public Member Functions | Friends | List of all members
sptk::Timer::EventData Class Reference

#include <Timer.h>

Public Types

using Callback = std::function< void()>
 

Public Member Functions

 EventData (const EventData &other)=delete
 
const EventIdgetId () const
 
EventDataoperator= (const EventData &other)=delete
 
 EventData (const DateTime &timestamp, const Callback &eventCallback, std::chrono::milliseconds repeatEvery, int repeatCount=-1)
 
const DateTimegetWhen () const
 
bool shift (std::chrono::milliseconds interval)
 
const std::chrono::milliseconds & getInterval () const
 
int getRepeatCount () const
 
bool fire ()
 

Friends

class Timer
 

Detailed Description

Timer event class. Stores event data, including references to parent Timer and events map.

Member Typedef Documentation

◆ Callback

using sptk::Timer::EventData::Callback = std::function<void()>

Event callback definition. Events call that function when there is time for them to fire.

Constructor & Destructor Documentation

◆ EventData() [1/2]

sptk::Timer::EventData::EventData ( const EventData other)
delete

Disabled event copy constructor

Parameters
otherOther event

◆ EventData() [2/2]

sptk::Timer::EventData::EventData ( const DateTime timestamp,
const Callback eventCallback,
std::chrono::milliseconds  repeatEvery,
int  repeatCount = -1 
)

Constructor

Parameters
timestampFire at timestamp
eventCallbackEvent callback function
repeatEveryEvent repeate interval
repeatCountRepeat count, -1 means no limit

Member Function Documentation

◆ fire()

bool sptk::Timer::EventData::fire ( )

Fire event by calling its callback function..

◆ getId()

const EventId & sptk::Timer::EventData::getId ( ) const
Returns
Bookmark of event entry in events map.

◆ getInterval()

const std::chrono::milliseconds & sptk::Timer::EventData::getInterval ( ) const
inline
Returns
event repeat interval

◆ getRepeatCount()

int sptk::Timer::EventData::getRepeatCount ( ) const
inline
Returns
event repeat count

◆ getWhen()

const DateTime & sptk::Timer::EventData::getWhen ( ) const
inline
Returns
event fire at timestamp

◆ operator=()

EventData & sptk::Timer::EventData::operator= ( const EventData other)
delete

Disabled event assignment

Parameters
otherOther event

◆ shift()

bool sptk::Timer::EventData::shift ( std::chrono::milliseconds  interval)
inline

Add interval to event fire at timestamp

Parameters
intervalShift interval

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

Fri Oct 14 2022 09:58:47: SPTK 5.4.1