OpenCMISS-Zinc C++ API Documentation
Public Types | Public Member Functions | Protected Attributes | List of all members
OpenCMISS::Zinc::Timekeeper Class Reference

The timekeeper synchronises a current time across Zinc objects. More...

#include <timekeeper.hpp>

Public Types

enum  PlayDirection { PLAY_DIRECTION_INVALID = CMZN_TIMEKEEPER_PLAY_DIRECTION_INVALID, PLAY_DIRECTION_FORWARD = CMZN_TIMEKEEPER_PLAY_DIRECTION_FORWARD, PLAY_DIRECTION_REVERSE = CMZN_TIMEKEEPER_PLAY_DIRECTION_REVERSE }
 

Public Member Functions

 Timekeeper (cmzn_timekeeper_id in_timekeeper_id)
 
 Timekeeper (const Timekeeper &timeKeeper)
 
Timekeeperoperator= (const Timekeeper &timeKeeper)
 
bool isValid () const
 
cmzn_timekeeper_id getId () const
 
TimenotifierRegular createTimenotifierRegular (double updateFrequency, double timeOffset)
 
double getMaximumTime ()
 
int setMaximumTime (double maximumTime)
 
double getMinimumTime ()
 
int setMinimumTime (double minimumTime)
 
double getTime ()
 
int setTime (double time)
 
double getNextCallbackTime (enum PlayDirection playDirection)
 

Protected Attributes

cmzn_timekeeper_id id
 

Detailed Description

The timekeeper synchronises a current time across Zinc objects.

The timekeeper maintains a current time that is communicated to objects within Zinc. For example, time-varying graphics are shown at the current timekeeper time; also, the time value field allows the current timekeeper time to be used in field expressions. Responsibility for timing animations is left to client code (as it is UI or OS-dependent), however the timekeeper API assists clients to determine the ideal callback time and to set the current time just before rendering to synchronise animation. Time notifiers allow clients to also use the timekeeper features including callbacks.

See also
Timekeeper::getNextCallbackTime
Timekeeper::setTime
Timenotifier

Member Enumeration Documentation

Specifies the direction of play when querying the next callback time preferred for internal zinc objects.

See also
Timekeeper::getNextCallbackTime
Enumerator
PLAY_DIRECTION_INVALID 

Unspecified play direction

PLAY_DIRECTION_FORWARD 

Specify the time keeper to progress at increasing time value

PLAY_DIRECTION_REVERSE 

Specify the time keeper to progress at decreasing time value

Member Function Documentation

TimenotifierRegular OpenCMISS::Zinc::Timekeeper::createTimenotifierRegular ( double  updateFrequency,
double  timeOffset 
)
inline

Create and returns a time notifier with regular update time in time keeper. The returned time notifier will automatically be added to the time keeper.

Parameters
updateFrequencyThe number of times which time notifier will receive callback per unit of time in the time keeper.
timeOffsetThis value will set the exact time the notification happenes and allow setting the callback time other than t=0. Time notifier will receive/send out notification when time_offset + original callback time is reached.
Returns
Handle to new timekeeper, or NULL/invalid handle on failure.
cmzn_timekeeper_id OpenCMISS::Zinc::Timekeeper::getId ( ) const
inline

Return the C handle of the Timekeeper object.

Returns
C handle of Timekeeper if this objects is valid, 0 otherwise.
double OpenCMISS::Zinc::Timekeeper::getMaximumTime ( )
inline

Gets the maximum time in the timekeeper.

Returns
Current time or 0 if invalid argument.
double OpenCMISS::Zinc::Timekeeper::getMinimumTime ( )
inline

Gets the minimum time in the timekeeper.

Returns
Current time or 0 if invalid argument.
double OpenCMISS::Zinc::Timekeeper::getNextCallbackTime ( enum PlayDirection  playDirection)
inline

Gets the next callback time required by any of the time notifiers in the timekeeper. This function takes the minimum and maximum time into consideration. If the direction of playback is forward and next callback time exceeds the maximum time, the next callback time will be timekeeper_minimum + (callback_time - timekeeper_maximum). If the direction of playback is reverse and next callback time is smaller than the minimum time, the next callback time will be timekeeper_maximum + (timekeeper_minimum - callback_time).

See also
Timenotifier::getNextCallbackTime
Parameters
playDirectionEnumeration indicating rather next forward/reverse time will be calculated.
Returns
next callback time on success.
double OpenCMISS::Zinc::Timekeeper::getTime ( )
inline

Gets the current time from the timekeeper.

Returns
Current time or 0 if invalid argument.
bool OpenCMISS::Zinc::Timekeeper::isValid ( ) const
inline

Check if this is a valid Timekeeper object.

Returns
Status True if object is valid, false otherwise.
int OpenCMISS::Zinc::Timekeeper::setMaximumTime ( double  maximumTime)
inline

Sets the maximum time in the timekeeper.

Parameters
maximumTimeThe timekeeper to modify.
maximum_timeThe new maximum time.
Returns
OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Timekeeper::setMinimumTime ( double  minimumTime)
inline

Sets the minimum time in the timekeeper.

Parameters
minimumTimeThe timekeeper to modify.
minimum_timeThe new minimum time.
Returns
OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Timekeeper::setTime ( double  time)
inline

Sets the current time in the timekeeper. Timenotifiers are informed of the time change.

Parameters
timeThe new current time.
Returns
OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.

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