115 virtual inline bool call(
const timespec& time);
155 return _timer.getInterval();
170 return _timer.isEnabled();
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
bool(* Pf)(const timespec &)
Required type for the callback function.
Definition Sustain.h:252
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
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 overridden 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
@ spTimer
Definition Sustain.h:48
@ spDefault
Definition Sustain.h:46
SustainBase & operator=(const SustainBase &)=delete
Prevent copying.
SustainBase(const SustainBase &)=delete
Prevent copying.
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:19
#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.