MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSLTimeClient Class Referenceabstract
Inheritance diagram for TSLTimeClient:

Detailed Description

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
 
TSLTimeServerm_timeServer
 

Constructor & Destructor Documentation

◆ TSLTimeClient()

TSLTimeClient::TSLTimeClient ( TSLTimeUInt32 updateRate = 1,
TSLTimeServer * server = 0 )

Constructor.

Attaches the client to the supplied subject.

Parameters
updateRateThe 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.
serverA pointer to a Time Server. If this is not NULL, then the client is automatically attached to the time server. Default value is NULL.

◆ ~TSLTimeClient()

virtual TSLTimeClient::~TSLTimeClient ( )
virtual

Virtual destructor.

Automatically detaches itself from its associated Time Server.

Member Function Documentation

◆ attachToServer()

bool TSLTimeClient::attachToServer ( TSLTimeServer * server)

Attaches the client to the given time server.

Parameters
serverA pointer to the Time Server.
Returns
true if the client was successfully attached, false otherwise.

◆ update()

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.

Parameters
timeThe new time.
timeServerA 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.

◆ updateRate() [1/2]

TSLTimeUInt32 TSLTimeClient::updateRate ( ) const
inline

Returns the update rate.

◆ updateRate() [2/2]

void TSLTimeClient::updateRate ( TSLTimeUInt32 rate)
inline

Sets the update rate.

Parameters
rateThe new update rate.

Member Data Documentation

◆ m_time

TSLTimeInstant TSLTimeClient::m_time
protected

The time at the last tick event.

◆ m_timeServer

TSLTimeServer* TSLTimeClient::m_timeServer
protected

◆ m_updateRate

TSLTimeUInt32 TSLTimeClient::m_updateRate
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.