SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
sutil::CSystemClock Class Reference

#include <CSystemClock.hpp>

Inheritance diagram for sutil::CSystemClock:
Inheritance graph
Collaboration diagram for sutil::CSystemClock:
Collaboration graph

Static Public Member Functions

static bool start ()
static suClock getSysTime ()
static suClock getSimTime ()
static void tick (suClock arg_dt)
static void progressToTime (const timeval &arg_t_start, const suClock arg_time_increment=1.0, const bool arg_increment_sim_clock=true)

Private Member Functions

 CSystemClock ()
 CSystemClock (const CSystemClock &)
CSystemClockoperator= (const CSystemClock &)

Static Private Member Functions

static suClock computeTDiff (const timeval &arg_t_start)
static SSystemClockgetData ()
static bool resetData ()

Private Attributes

SSystemClock data_

Static Private Attributes

static CSingletonsingleton_

Detailed Description

A system (global) clock to measure time in seconds.

Since it uses the singleton to ensure global time syncing, a "startClock" function must be called to initialize the time to zero.

NOTE : This class does not do any error checks while returning the time. Make sure that start() returns true.

Constructor & Destructor Documentation

sutil::CSystemClock::CSystemClock ( )

Private for the singleton

sutil::CSystemClock::CSystemClock ( const CSystemClock )

Private for the singleton

Member Function Documentation

static suClock sutil::CSystemClock::computeTDiff ( const timeval &  arg_t_start)

Computes the elapsed time (in seconds) since the passed timeval

static SSystemClock * sutil::CSingleton< SSystemClock >::getData ( )

Creates a singleton if necessary and returns it.

Returns a pointer instead of a reference to support a 0 return when there is an error

static suClock sutil::CSystemClock::getSimTime ( )

Returns the current simulation time. Increment this by calling the tick() function

static suClock sutil::CSystemClock::getSysTime ( )

Returns the system time (in seconds) since the clock was initialized.

CSystemClock& sutil::CSystemClock::operator= ( const CSystemClock )

Private for the singleton

static void sutil::CSystemClock::progressToTime ( const timeval &  arg_t_start,
const suClock  arg_time_increment = 1.0,
const bool  arg_increment_sim_clock = true 

Progresses the simulation time (sleeps if there is nothing to do).

Works approximately.

static bool sutil::CSingleton< SSystemClock >::resetData ( )

Deletes the singleton instance and creates a new one.

static bool sutil::CSystemClock::start ( )

Forces the singleton to create the object (and hence set the start time through the constructor).

Member Data Documentation

SSystemClock sutil::CSingleton< SSystemClock >::data_

Shared Memory: The publicly available data that will be shared across the different subsystems

CSingleton* sutil::CSingleton< SSystemClock >::singleton_

The singleton instance

This initializes the pointer to null

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