![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
This defines an interface for receiving time notifications from a time server. The interface provides automatic attaching and detaching to/from a time server. It automatically handles tick events whilst allowing derived classes to provide specialised responses.
The default timer runs in its own separate thread. Where necessary, users will need to ensure thread-safety of the tick() method of any TSLTimeClient-derived classes.
Public Member Functions | |
TSLTimeClient (TSLTimeUInt32 updateRate=1, TSLTimeServer *server=0) | |
virtual | ~TSLTimeClient () |
bool | attachToServer (TSLTimeServer *server) |
bool | update (TSLTimeInstant const &time, TSLTimeServer *timeServer) |
TSLTimeUInt32 | updateRate () const |
void | updateRate (TSLTimeUInt32 rate) |
Protected Attributes | |
TSLTimeUInt32 | m_updateRate |
TSLTimeInstant | m_time |
TSLTimeServer * | m_timeServer |
TSLTimeClient::TSLTimeClient | ( | TSLTimeUInt32 | updateRate = 1, |
TSLTimeServer * | server = 0 ) |
Constructor.
Attaches the client to the supplied subject.
updateRate | The tick interval at which updates will be captured e.g. if updateRate is set at 5, then only every 5th update will be processed. Default value is 1. |
server | A pointer to a Time Server. If this is not NULL, then the client is automatically attached to the time server. Default value is NULL. |
|
virtual |
Virtual destructor.
Automatically detaches itself from its associated Time Server.
bool TSLTimeClient::attachToServer | ( | TSLTimeServer * | server | ) |
Attaches the client to the given time server.
server | A pointer to the Time Server. |
bool TSLTimeClient::update | ( | TSLTimeInstant const & | time, |
TSLTimeServer * | timeServer ) |
This method is called by the Time Server to notify Time Clients of a new time event.
time | The new time. |
timeServer | A pointer to the Time Server. |
TSLTimeClient captures the time by querying the supplied subject. It then calls the abstract tick() method which derived classes must implement.
Return true if the client actually changes as a result of this event, false otherwise.
|
inline |
Returns the update rate.
|
inline |
Sets the update rate.
rate | The new update rate. |
|
protected |
The time at the last tick event.
|
protected |
|
protected |
The tick interval at which updates will be captured e.g. if updateRate is set at 5, then only every 5th update will be processed.