MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSLTimeServer Class Reference

Detailed Description

This is the actual Time Server object. It provides a time object to all registered clients at intervals determined by the user.

By default, the Time Server uses its own default timer. If they wish, users can supply their own timers. In this case, the server ignores its default timer and uses the timer supplied by the user.

Public Member Functions

 TSLTimeServer ()
 
 ~TSLTimeServer ()
 
bool attach (TSLTimeClient *client)
 
TSLTimer const & defaultTimer () const
 
bool detach (TSLTimeClient *client)
 
TSLTimersetUserTimer (TSLTimer *userTimer)
 
bool tick (TSLTimeInstant const &time)
 
TSLTimertimer ()
 
TSLTimer const & timer () const
 

Static Public Member Functions

static TSLTime64 calibrate (TSLTimeInterval const &duration, TSLTimerCalibrationProgress *callback=0)
 
static TSLTimeHelper const & defaultTimeHelper ()
 

Protected Member Functions

 TSLTimeServer (TSLTimeServer const &)
 
TSLTimeServeroperator= (TSLTimeServer const &)
 

Constructor & Destructor Documentation

◆ TSLTimeServer() [1/2]

TSLTimeServer::TSLTimeServer ( )

Default constructor.

Creates the default timer.

◆ ~TSLTimeServer()

TSLTimeServer::~TSLTimeServer ( )

Destructor.

Destroys the default timer.

◆ TSLTimeServer() [2/2]

TSLTimeServer::TSLTimeServer ( TSLTimeServer const & )
protected

Protected copy constructor and assignment operator to prevent copying of time server objects.

Member Function Documentation

◆ attach()

bool TSLTimeServer::attach ( TSLTimeClient * client)

Register a Time Client with the Time Server.

Parameters
clientA pointer to the time client.
Returns
true if the client is successfully registered (or if it already registered with this server); false otherwise.

◆ calibrate()

static TSLTime64 TSLTimeServer::calibrate ( TSLTimeInterval const & duration,
TSLTimerCalibrationProgress * callback = 0 )
static

Calibrates the time server and its default timer. This call only needs to be made once before the server is ever used.

The time server does not rely on calibration having been performed. However, by calibrating the timer, users are guaranteed the best accuracy of time events.

Parameters
durationThe length of time that the calibration should last for.
callbackA callback function that is called by the calibration method to indicate progress.
Returns
a value that should be passed to the timer's setCalibration() method before the timer is started. Normally users will store this value in an .ini file or the Window's registry.

◆ defaultTimeHelper()

static TSLTimeHelper const & TSLTimeServer::defaultTimeHelper ( )
static

Static query method for the server's default time helper.

Returns a (const) reference to the default time helper.

◆ defaultTimer()

TSLTimer const & TSLTimeServer::defaultTimer ( ) const

(Const) Query method for the server's default timer.

Returns a (const) reference to the default timer.

◆ detach()

bool TSLTimeServer::detach ( TSLTimeClient * client)

Register a Time Client with the Time Server.

Parameters
clientA pointer to the time client.
Returns
true if the client is successfully unregistered; false otherwise.

◆ operator=()

TSLTimeServer & TSLTimeServer::operator= ( TSLTimeServer const & )
protected

◆ setUserTimer()

TSLTimer * TSLTimeServer::setUserTimer ( TSLTimer * userTimer)

Sets the user-defined timer.

Parameters
userTimerA pointer to the user-defined timer. This can be NULL.
Returns
the previous user-defined timer. Users are responsible for destroying the timer object.

◆ tick()

bool TSLTimeServer::tick ( TSLTimeInstant const & time)

This method informs all registered clients of a change in time.

Parameters
timeThe new time.
Returns
true if any client has changed as a result of the event, false otherwise.

◆ timer() [1/2]

TSLTimer & TSLTimeServer::timer ( )

Query method for the server's timer.

Returns a reference to the default timer, if no user-defined timer has been set. Otherwise it returns a reference to the user-defined timer.

◆ timer() [2/2]

TSLTimer const & TSLTimeServer::timer ( ) const

(Const) Query method for the server's timer.

Returns a (const) reference to the default timer, if no user-defined timer has been set. Otherwise it returns a (const) reference to the user-defined timer.