48 spTimer = std::numeric_limits<int>::max()
79 [[nodiscard]]
int getPriority()
const;
86 void setInterval(
const timespec& interval);
92 [[nodiscard]]
const timespec& getInterval()
const;
108 [[nodiscard]]
bool isEnabled()
const;
115 virtual inline bool call(
const timespec& time);
189 typedef bool (T::*
Pmf)(const timespec& t);
230 inline bool call(
const timespec& tm)
override
232 return (_self->*_pmf)(tm);
252 typedef bool (*Pf)(
const timespec&);
285 bool call(
const timespec& time)
override;
293inline bool StaticSustain::call(
const timespec& time)
Timer class that has fixed time intervals at which it becomes true.
Definition IntervalTimer.h:14
void enable()
Enables the timer with the current interval time.
Definition IntervalTimer.h:155
bool isEnabled() const
Gets timer enabled.
Definition IntervalTimer.h:165
const TimeSpec & getInterval() const
Gets the set interval time in TimeSpec format.
Definition IntervalTimer.h:170
void disable()
Disables the timer.
Definition IntervalTimer.h:160
void set(const timespec &t)
Sets the timers interval time.
Implements a class to hook a static function to the global main thread sustain call.
Definition Sustain.h:247
StaticSustain & operator=(const StaticSustain &)=delete
Prevent copying.
StaticSustain(const StaticSustain &)=delete
Prevent copying.
StaticSustain(Pf pf, int priority=spDefault, PtrVector *vector=_defaultVector)
One and only constructor.
Definition Sustain.h:261
Base class for template TSustain which enables repetitive calls from the main thread with a set frequ...
Definition Sustain.h:36
void disable()
Disables this entry.
Definition Sustain.h:163
static void flushVector(PtrVector *vector)
Flushes the vector and clears all Vector member of all entries first.
~SustainBase()
oes not have to be virtual because this base class is not used must always be derived.
const timespec & getInterval() const
Gets the interval at which the hooked function is called.
Definition Sustain.h:153
virtual bool call(const timespec &time)
Must be overloaded to be able to call the sustain member function.
Definition Sustain.h:173
int _priority
Data member holing priority.
Definition Sustain.h:137
bool isEnabled() const
Returns if the entry is enabled or not.
Definition Sustain.h:168
TVector< SustainBase * > PtrVector
Definition Sustain.h:38
IntervalTimer _timer
Timer for when priority spTimer has been set.
Definition Sustain.h:145
PtrVector * _list
Vector where this entry is part of.
Definition Sustain.h:141
static void callSustain(PtrVector *vector=nullptr)
Calls all sustain table entry functions in the vector passed. The default is the static default vecto...
SustainBase(PtrVector *vector, int priority)
Default Constructor adding itself to the passed vector. If the passed vector is NULL the default vect...
void setInterval(const timespec &interval)
Sets the interval at which the hooked function is called. This is only valid when the priority for th...
Definition Sustain.h:148
int getPriority() const
Gets the priority value of this instance;.
Definition Sustain.h:288
static PtrVector * _defaultVector
Pointer to the default vector which is automatically created when.
Definition Sustain.h:133
void enable()
Enables this entry.
Definition Sustain.h:158
ESustainPriority
Do not use an iterator because the sustain function could affect the vector itself.
Definition Sustain.h:44
@ spDefault
Definition Sustain.h:46
SustainBase & operator=(const SustainBase &)=delete
Prevent copying.
SustainBase(const SustainBase &)=delete
Prevent copying.
Template to make the sustain system call a class method regularly.
Definition Sustain.h:184
TSustain(const TSustain &)=delete
Prevent copying.
virtual ~TSustain()=default
Virtual destructor.
TSustain(T *self, Pmf pmf, int priority=spDefault, PtrVector *vector=nullptr)
One and only initializing constructor.
Definition Sustain.h:237
TSustain & operator=(const TSustain &)=delete
Prevent copying.
bool(T::* Pmf)(const timespec &t)
Required type.
Definition Sustain.h:189
Counted vector having additional methods and operators for ease of usage. This template class extends...
Definition TVector.h:20
#define _MISC_FUNC
Definition misc/global.h:39
#define _MISC_CLASS
Definition misc/global.h:40
Definition Application.h:10
_MISC_FUNC bool setSustainTimer(int msec)
This function will enable a timer that call all Sustain functions in the _defaultVector member of the...
_MISC_FUNC int getSustainTimer()
Gets the current sustain timer interval in milliseconds.