vdr  2.4.7
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
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)
 
int GetMaxPriority (void) const
 
const cTimerGetNextActiveTimer (void) const
 
const cTimerUsesChannel (const cChannel *Channel) const
 
bool SetEvents (const cSchedules *Schedules)
 
bool DeleteExpired (void)
 
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 ()
 
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< T >
 cList (const char *NeedsLocking=NULL)
 
const T * Get (int Index) const
 
const T * First (void) const
 
const T * Last (void) const
 
const T * Prev (const T *Object) const
 
const T * Next (const T *Object) const
 
T * Get (int Index)
 
T * First (void)
 
T * Last (void)
 
T * Prev (const T *Object)
 
T * Next (const T *Object)
 
- 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 116 of file timers.h.

Constructor & Destructor Documentation

◆ cTimers()

cTimers::cTimers ( void  )

Definition at line 729 of file timers.c.

References lastDeleteExpired.

Member Function Documentation

◆ Add()

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

◆ Del()

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

◆ DeleteExpired()

bool cTimers::DeleteExpired ( void  )

◆ GetById() [1/2]

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

Definition at line 172 of file timers.h.

References GetById().

Referenced by GetById().

◆ GetById() [2/2]

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

Definition at line 755 of file timers.c.

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

Referenced by StoreRemoteTimers().

◆ GetMatch() [1/4]

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

Definition at line 178 of file timers.h.

References GetMatch().

Referenced by GetMatch().

◆ GetMatch() [2/4]

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

Definition at line 802 of file timers.c.

References cList< T >::First(), cList< T >::Next(), tmFull, and tmNone.

◆ GetMatch() [3/4]

cTimer* cTimers::GetMatch ( time_t  t)
inline

Definition at line 176 of file timers.h.

References GetMatch().

Referenced by GetMatch().

◆ 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 820 of file timers.c.

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

Referenced by main().

◆ GetNextActiveTimer()

const cTimer * cTimers::GetNextActiveTimer ( void  ) const

◆ GetTimer() [1/2]

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

Definition at line 174 of file timers.h.

References GetTimer().

Referenced by GetTimer().

◆ GetTimer() [2/2]

const cTimer * cTimers::GetTimer ( const cTimer Timer) 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 843 of file timers.c.

References cListBase::Lock(), and timers.

Referenced by cSkinLCARSDisplayMenu::DrawTimers(), main(), cSVDRPClientHandler::ProcessConnections(), cMenuTimers::Set(), cMenuWhatsOn::Update(), and cMenuSchedule::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 848 of file timers.c.

References cListBase::Lock(), and timers.

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

◆ Ins()

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

Definition at line 861 of file timers.c.

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

◆ Load()

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

◆ NewTimerId()

int cTimers::NewTimerId ( void  )
static

Definition at line 750 of file timers.c.

References lastTimerId.

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

◆ SetEvents()

bool cTimers::SetEvents ( const cSchedules Schedules)

Definition at line 882 of file timers.c.

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

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 909 of file timers.c.

References Add(), cVector< T >::Append(), Del(), esyslog, cList< T >::First(), GetById(), cList< T >::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 873 of file timers.c.

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

Member Data Documentation

◆ lastDeleteExpired

time_t cTimers::lastDeleteExpired
private

Definition at line 120 of file timers.h.

Referenced by cTimers(), and DeleteExpired().

◆ lastTimerId

int cTimers::lastTimerId = 0
staticprivate

Definition at line 119 of file timers.h.

Referenced by NewTimerId().

◆ timers

cTimers cTimers::timers
staticprivate

Definition at line 118 of file timers.h.

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


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