vdr 2.7.7
cTimers Class Reference

#include <timers.h>

Public Member Functions

 cTimers (void)
const cTimerGetById (int Id, const char *Remote=NULL) const
cTimerGetById (int Id, const char *Remote=NULL)
const cTimerGetTimer (const cTimer *Timer) const
cTimerGetTimer (const cTimer *Timer)
const cTimerGetMatch (time_t t) const
cTimerGetMatch (time_t t)
const cTimerGetMatch (const cEvent *Event, eTimerMatch *Match=NULL) const
cTimerGetMatch (const cEvent *Event, eTimerMatch *Match=NULL)
const cTimerGetTimerForEvent (const cEvent *Event, eTimerFlags Flags=tfNone) const
int GetMaxPriority (void) const
const cTimerGetNextActiveTimer (void) const
const cTimerUsesChannel (const cChannel *Channel) const
bool SetEvents (const cSchedules *Schedules)
bool SpawnPatternTimers (const cSchedules *Schedules)
bool AdjustSpawnedTimers (void)
bool DeleteExpired (bool Force)
void Add (cTimer *Timer, cTimer *After=NULL)
void Ins (cTimer *Timer, cTimer *Before=NULL)
void Del (cTimer *Timer, bool DeleteObject=true)
bool StoreRemoteTimers (const char *ServerName=NULL, const cStringList *RemoteTimers=NULL)
Public Member Functions inherited from cConfig< cTimer >
 cConfig (const char *NeedsLocking=NULL)
virtual ~cConfig () override
const char * FileName (void)
bool Load (const char *FileName=NULL, bool AllowComments=false, bool MustExist=false)
bool Save (void) const
Public Member Functions inherited from cList< cTimer >
 cList (const char *NeedsLocking=NULL)
const cTimerGet (int Index) const
const cTimerFirst (void) const
const cTimerLast (void) const
const cTimerPrev (const cTimer *Object) const
const cTimerNext (const cTimer *Object) const
Public Member Functions inherited from cListBase
virtual ~cListBase ()
bool Lock (cStateKey &StateKey, bool Write=false, int TimeoutMs=0) const
void SetSyncStateKey (cStateKey &StateKey)
void SetUseGarbageCollector (void)
void SetExplicitModify (void)
void SetModified (void)
void Add (cListObject *Object, cListObject *After=NULL)
void Ins (cListObject *Object, cListObject *Before=NULL)
void Del (cListObject *Object, bool DeleteObject=true)
virtual void Move (int From, int To)
void Move (cListObject *From, cListObject *To)
bool Contains (const cListObject *Object) const
const cListObjectGet (int Index) const
cListObjectGet (int Index)
int Count (void) const
void Sort (void)

Static Public Member Functions

static const cTimersGetTimersRead (cStateKey &StateKey, int TimeoutMs=0)
static cTimersGetTimersWrite (cStateKey &StateKey, int TimeoutMs=0)
static bool Load (const char *FileName)
static int NewTimerId (void)

Private Attributes

time_t lastDeleteExpired

Static Private Attributes

static cTimers timers
static int lastTimerId = 0

Additional Inherited Members

Protected Member Functions inherited from cListBase
 cListBase (const char *NeedsLocking=NULL)
Protected Attributes inherited from cListBase
cListObjectobjects
cListObjectlastObject
int count
cStateLock stateLock
const char * needsLocking
bool useGarbageCollector

Detailed Description

Definition at line 165 of file timers.h.

Constructor & Destructor Documentation

◆ cTimers()

cTimers::cTimers ( void )

Member Function Documentation

◆ Add()

void cTimers::Add ( cTimer * Timer,
cTimer * After = NULL )

◆ AdjustSpawnedTimers()

bool cTimers::AdjustSpawnedTimers ( void )

Definition at line 1356 of file timers.c.

References cList< cTimer >::First(), cList< cTimer >::Next(), tfSpawned, and tfVps.

Referenced by main().

◆ Del()

void cTimers::Del ( cTimer * Timer,
bool DeleteObject = true )

◆ DeleteExpired()

◆ GetById() [1/2]

cTimer * cTimers::GetById ( int Id,
const char * Remote = NULL )
inline

Definition at line 221 of file timers.h.

References cTimers().

◆ GetById() [2/2]

const cTimer * cTimers::GetById ( int Id,
const char * Remote = NULL ) const

Definition at line 1197 of file timers.c.

References cList< cTimer >::First(), and cList< cTimer >::Next().

Referenced by StoreRemoteTimers().

◆ GetMatch() [1/4]

cTimer * cTimers::GetMatch ( const cEvent * Event,
eTimerMatch * Match = NULL )
inline

Definition at line 227 of file timers.h.

References cTimers().

◆ GetMatch() [2/4]

const cTimer * cTimers::GetMatch ( const cEvent * Event,
eTimerMatch * Match = NULL ) const

◆ GetMatch() [3/4]

cTimer * cTimers::GetMatch ( time_t t)
inline

Definition at line 225 of file timers.h.

References cTimers().

◆ GetMatch() [4/4]

const cTimer * cTimers::GetMatch ( time_t t) const

◆ GetMaxPriority()

int cTimers::GetMaxPriority ( void ) const

Returns the maximum priority of all local timers that are currently recording.

If there is no local timer currently recording, -1 is returned.

Definition at line 1272 of file timers.c.

References cList< cTimer >::First(), max(), and cList< cTimer >::Next().

Referenced by main().

◆ GetNextActiveTimer()

const cTimer * cTimers::GetNextActiveTimer ( void ) const

◆ GetTimer() [1/2]

cTimer * cTimers::GetTimer ( const cTimer * Timer)
inline

Definition at line 223 of file timers.h.

References cTimers().

◆ GetTimer() [2/2]

const cTimer * cTimers::GetTimer ( const cTimer * Timer) const

◆ GetTimerForEvent()

const cTimer * cTimers::GetTimerForEvent ( const cEvent * Event,
eTimerFlags Flags = tfNone ) const

◆ GetTimersRead()

const cTimers * cTimers::GetTimersRead ( cStateKey & StateKey,
int TimeoutMs = 0 )
static

Gets the list of timers for read access.

If TimeoutMs is given, it will wait that long to get a read lock before giving up. Otherwise it will wait indefinitely. If no read lock can be obtained within the given timeout, NULL will be returned. The list is locked and a pointer to it is returned if the state of the list is different than the state of the given StateKey. If both states are equal, the list of timers has not been modified since the last call with the same StateKey, and NULL will be returned (and the list is not locked). After the returned list of timers is no longer needed, the StateKey's Remove() function must be called to release the list. The time between calling cTimers::GetTimersRead() and StateKey.Remove() should be as short as possible. After calling StateKey.Remove() the list returned from this call must not be accessed any more. If you need to access the timers again later, a new call to GetTimersRead() must be made. A typical code sequence would look like this: cStateKey StateKey; if (const cTimers *Timers = cTimers::GetTimersRead(StateKey)) { // access the timers StateKey.Remove(); }

Definition at line 1295 of file timers.c.

References cTimers(), and timers.

Referenced by cSkinLCARSDisplayMenu::DrawTimers(), main(), cSVDRPClientHandler::ProcessConnections(), cMenuTimers::Set(), cMenuSchedule::Update(), and cMenuWhatsOn::Update().

◆ GetTimersWrite()

cTimers * cTimers::GetTimersWrite ( cStateKey & StateKey,
int TimeoutMs = 0 )
static

Gets the list of timers for write access.

If TimeoutMs is given, it will wait that long to get a write lock before giving up. Otherwise it will wait indefinitely. If no write lock can be obtained within the given timeout, NULL will be returned. If a write lock can be obtained, the list of timers will be returned, regardless of the state values of the timers or the given StateKey. After the returned list of timers is no longer needed, the StateKey's Remove() function must be called to release the list. The time between calling cTimers::GetTimersWrite() and StateKey.Remove() should be as short as possible. After calling StateKey.Remove() the list returned from this call must not be accessed any more. If you need to access the timers again later, a new call to GetTimersWrite() must be made. The call to StateKey.Remove() will increment the state of the list of timers and will copy the new state value to the StateKey. You can suppress this by using 'false' as the parameter to the call, in which case the state values are left untouched. A typical code sequence would look like this: cStateKey StateKey; if (cTimers *Timers = cTimers::GetTimersWrite(StateKey)) { // access the timers StateKey.Remove(); }

Definition at line 1300 of file timers.c.

References cTimers(), and timers.

Referenced by cMenuTimers::Delete(), main(), cMenuTimers::OnOff(), and cSVDRPClientHandler::ProcessConnections().

◆ Ins()

void cTimers::Ins ( cTimer * Timer,
cTimer * Before = NULL )

Definition at line 1313 of file timers.c.

References cListBase::Ins(), cStatus::MsgTimerChange(), and tcAdd.

◆ Load()

bool cTimers::Load ( const char * FileName)
static

Definition at line 1177 of file timers.c.

References cConfig< cTimer >::FileName(), LOCK_TIMERS_WRITE, NewTimerId(), tfRecording, and timers.

Referenced by main().

◆ NewTimerId()

int cTimers::NewTimerId ( void )
static

Definition at line 1192 of file timers.c.

References lastTimerId.

Referenced by Add(), HandleRemoteTimerModifications(), and Load().

◆ SetEvents()

bool cTimers::SetEvents ( const cSchedules * Schedules)

Definition at line 1334 of file timers.c.

References cList< cTimer >::First(), and cList< cTimer >::Next().

Referenced by main().

◆ SpawnPatternTimers()

bool cTimers::SpawnPatternTimers ( const cSchedules * Schedules)

Definition at line 1344 of file timers.c.

References cList< cTimer >::First(), cList< cTimer >::Next(), and tfActive.

Referenced by main().

◆ StoreRemoteTimers()

bool cTimers::StoreRemoteTimers ( const char * ServerName = NULL,
const cStringList * RemoteTimers = NULL )

Stores the given list of RemoteTimers, which come from the VDR ServerName, in this list.

If no ServerName is given, all remote timers from all peer machines will be removed from this list. If no RemoteTimers are given, only the remote timers from ServerName will be removed from this list. The given list of RemoteTimers must be sorted numerically (by a call to its SortNumerically() function). Returns true if any remote timers have been added, deleted or modified.

Definition at line 1391 of file timers.c.

References Add(), cVector< T >::Append(), Del(), esyslog, cList< cTimer >::First(), GetById(), cList< cTimer >::Next(), cTimer::Parse(), cTimer::Remote(), cTimer::SetId(), cTimer::SetRemote(), cVector< T >::Size(), cStringList::SortNumerically(), and cString::sprintf().

Referenced by cSVDRPClientHandler::ProcessConnections().

◆ UsesChannel()

const cTimer * cTimers::UsesChannel ( const cChannel * Channel) const

Definition at line 1325 of file timers.c.

References cList< cTimer >::First(), and cList< cTimer >::Next().

Member Data Documentation

◆ lastDeleteExpired

time_t cTimers::lastDeleteExpired
private

Definition at line 169 of file timers.h.

Referenced by cTimers(), and DeleteExpired().

◆ lastTimerId

int cTimers::lastTimerId = 0
staticprivate

Definition at line 168 of file timers.h.

Referenced by NewTimerId().

◆ timers

cTimers cTimers::timers
staticprivate

Definition at line 167 of file timers.h.

Referenced by GetTimersRead(), GetTimersWrite(), and Load().


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