domain::Clock Class Reference

A simple clock that can notify objects. More...

#include <clock.h>

Inheritance diagram for domain::Clock:
Inheritance graph
[legend]
Collaboration diagram for domain::Clock:
Collaboration graph
[legend]

List of all members.

Signals

void timeChanged (const QDateTime &newTime)

Public Member Functions

 Clock ()
const QDateTime & time () const
void setTime (const QDateTime &time)
void addEvent (const QDateTime &time, StorableData *data)
void removeEvents (StorableData *data)
void setTicking (bool enable)
bool isTicking () const

Static Public Member Functions

static QDateTime currentTime ()
static void newEvent (const QDateTime &time, StorableData *data)
static void deleteEvents (StorableData *data)

Private Slots

void tick ()

Private Attributes

QDateTime m_time
QMultiMap< QDateTime,
StorableData * > 
m_events
QTimer m_timer

Detailed Description

A simple clock that can notify objects.

This class offers functionality to store and modify a date/time. It can also notify StorableData objects at specific times. It does so by calling StorableData::notify().

Definition at line 22 of file clock.h.


Constructor & Destructor Documentation

Clock::Clock (  ) 

Creates a new clock object with the current time set to the current system time. The clock is not ticking.

Definition at line 7 of file clock.cpp.

Here is the call graph for this function:


Member Function Documentation

void Clock::addEvent ( const QDateTime &  time,
StorableData data 
)

Registers a new event to notify the given object at the given time. The registration is only made if the given time is greater than or equal to this clocks time().

Definition at line 44 of file clock.cpp.

Here is the call graph for this function:

QDateTime Clock::currentTime (  )  [static]

Returns the time of the clock stored in TaskManagerData.

See also:
TaskManagerData::clock().

Definition at line 63 of file clock.cpp.

Here is the call graph for this function:

void Clock::deleteEvents ( StorableData data  )  [static]

Removes events from the clock stored in TaskManagerData.

See also:
TaskManagerData::clock().

Definition at line 58 of file clock.cpp.

Here is the call graph for this function:

bool Clock::isTicking (  )  const

Indicates whether this clock is ticking.

See also:
setTicking().

Definition at line 84 of file clock.cpp.

void Clock::newEvent ( const QDateTime &  time,
StorableData data 
) [static]

Registers a new event in the clock stored in TaskManagerData.

See also:
TaskManagerData::clock().

Definition at line 68 of file clock.cpp.

Here is the call graph for this function:

void Clock::removeEvents ( StorableData data  ) 

Removes all events associated with the given object.

Definition at line 52 of file clock.cpp.

Here is the call graph for this function:

void Clock::setTicking ( bool  enable  ) 

Enables/disables the ticking of this clock. If a clock is ticking its time is incremented by 1s every 1000ms.

See also:
isTicking().

Definition at line 73 of file clock.cpp.

void Clock::setTime ( const QDateTime &  time  ) 

Sets the time of this clock to the given time. All StorableData abjects that are registered in this clock via addEvent() with a time smaller than or equal to this clocks time() are notified.

See also:
addEvent(), StorableData::notify().

Definition at line 18 of file clock.cpp.

Here is the call graph for this function:

void Clock::tick (  )  [private, slot]

Increments this clocks time() by 1s.

Definition at line 89 of file clock.cpp.

Here is the call graph for this function:

const QDateTime & Clock::time (  )  const

Returns the time of this clock.

Definition at line 13 of file clock.cpp.

void domain::Clock::timeChanged ( const QDateTime &  newTime  )  [signal]

Emitted when the time stored in this clock changes.

Parameters:
newTime The new time of this clock.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Enumerations Enumerator
Generated on Thu May 27 14:20:09 2010 for MopTaskManager by  doxygen 1.6.3