sttcl  v0.9c
STTCL C++ template state machine framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sttcl::TimeDuration< Implementation > Class Template Reference

#include <SttclTime.h>

List of all members.

Public Types

typedef
Implementation::NativeTimeDuration 
NativeTimeDuration

Public Member Functions

 TimeDuration (unsigned int argHours=0, unsigned int argMinutes=0, unsigned int argSeconds=0, unsigned int argMilliSeconds=0, unsigned long argMicroSeconds=0, unsigned long argNanoSeconds=0)
 TimeDuration (const TimeDuration< Implementation > &rhs)
 TimeDuration (const NativeTimeDuration &nativeTimeDuration)
 ~TimeDuration ()
TimeDuration< Implementation > & operator= (const TimeDuration< Implementation > &rhs)
TimeDuration< Implementation > & operator= (const NativeTimeDuration &nativeTimeDuration)
bool operator== (const TimeDuration< Implementation > &rhs) const
bool operator!= (const TimeDuration< Implementation > &rhs) const
bool operator< (const TimeDuration< Implementation > &rhs) const
bool operator<= (const TimeDuration< Implementation > &rhs) const
bool operator> (const TimeDuration< Implementation > &rhs) const
bool operator>= (const TimeDuration< Implementation > &rhs) const
TimeDuration< Implementation > & operator+= (const TimeDuration< Implementation > &rhs)
TimeDuration< Implementation > & operator-= (const TimeDuration< Implementation > &rhs)
TimeDuration< Implementation > & operator*= (int factor)
TimeDuration< Implementation > & operator/= (int divider)
long hours () const
long minutes () const
long seconds () const
long milliseconds () const
long microseconds () const
long nanoseconds () const
void hours (int newHours)
void minutes (int newMinutes)
void seconds (int newSeconds)
const NativeTimeDurationgetNativeValue () const

Static Public Attributes

static const TimeDuration
< Implementation > 
Zero = sttcl::TimeDuration<Implementation>()

Detailed Description

template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
class sttcl::TimeDuration< Implementation >

Adapter class for a (OS-)specific "real"-time duration representation implementation.

Template Parameters:
ImplementationSelects a (OS-)specific "real"-time duration representation implementation.
Todo:
Implement a static interface check for the Impl class.

Member Typedef Documentation

template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
typedef Implementation::NativeTimeDuration sttcl::TimeDuration< Implementation >::NativeTimeDuration

The class type of the native "real"-time duration representation.


Constructor & Destructor Documentation

template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
sttcl::TimeDuration< Implementation >::TimeDuration ( unsigned int  argHours = 0,
unsigned int  argMinutes = 0,
unsigned int  argSeconds = 0,
unsigned int  argMilliSeconds = 0,
unsigned long  argMicroSeconds = 0,
unsigned long  argNanoSeconds = 0 
)
inline

Constructor for class TimeDuration.

Parameters:
argHoursThe hours represented in this instance.
argMinutesThe minutes represented in this instance.
argSecondsThe seconds represented in this instance.
argMilliSecondsThe milliseconds represented in this instance.
argMicroSecondsThe microseconds represented in this instance.
argNanoSecondsThe nanoseconds represented in this instance.
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
sttcl::TimeDuration< Implementation >::TimeDuration ( const TimeDuration< Implementation > &  rhs)
inline

Copy constructor for class TimeDuration.

Parameters:
rhsAnother instance of TimeDuration.
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
sttcl::TimeDuration< Implementation >::TimeDuration ( const NativeTimeDuration< Implementation > &  nativeTimeDuration)
inline

Constructor for class TimeDuration.

Parameters:
nativeTimeDurationAn instance of the NativeTimeDuration value.
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
sttcl::TimeDuration< Implementation >::~TimeDuration ( )
inline

Destructor for class TimeDuration.


Member Function Documentation

template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
const NativeTimeDuration& sttcl::TimeDuration< Implementation >::getNativeValue ( ) const
inline
Todo:
Implement methods to set milliseconds, microseconds and nanoseconds in a consistent way with the getters.

Sets the milliseconds represented in this instance. Sets the microseconds represented in this instance. Sets the nanoseconds represented in this instance. Gets the native "real"-time duration representation.

Returns:
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
long sttcl::TimeDuration< Implementation >::hours ( ) const
inline

Gets the hours represented in this instance.

template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
void sttcl::TimeDuration< Implementation >::hours ( int  newHours)
inline

Sets the hours represented in this instance.

template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
long sttcl::TimeDuration< Implementation >::microseconds ( ) const
inline

Gets the microseconds represented in this instance.

template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
long sttcl::TimeDuration< Implementation >::milliseconds ( ) const
inline

Gets the milliseconds represented in this instance.

template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
long sttcl::TimeDuration< Implementation >::minutes ( ) const
inline

Gets the minutes represented in this instance.

template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
void sttcl::TimeDuration< Implementation >::minutes ( int  newMinutes)
inline

Sets the minutes represented in this instance.

template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
long sttcl::TimeDuration< Implementation >::nanoseconds ( ) const
inline

Gets the nanoseconds represented in this instance.

template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
bool sttcl::TimeDuration< Implementation >::operator!= ( const TimeDuration< Implementation > &  rhs) const
inline

Inequality comparison operator for class TimeDuration.

Parameters:
rhsAnother instance of TimeDuration.
Returns:
true if rhs time duration doesn't equal this instance, false otherwise.
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
TimeDuration<Implementation>& sttcl::TimeDuration< Implementation >::operator*= ( int  factor)
inline

Multiplies the time duration from of this instance with factor.

Parameters:
factorThe multiplication factor.
Returns:
A reference to the modified TimeDuration instance.
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
TimeDuration<Implementation>& sttcl::TimeDuration< Implementation >::operator+= ( const TimeDuration< Implementation > &  rhs)
inline

Adds the rhs time duration to this instance.

Parameters:
rhsAnother instance of TimeDuration.
Returns:
A reference to the modified TimeDuration instance.
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
TimeDuration<Implementation>& sttcl::TimeDuration< Implementation >::operator-= ( const TimeDuration< Implementation > &  rhs)
inline

Substracts the rhs time duration from this instance.

Parameters:
rhsAnother instance of TimeDuration.
Returns:
A reference to the modified TimeDuration instance.
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
TimeDuration<Implementation>& sttcl::TimeDuration< Implementation >::operator/= ( int  divider)
inline

Divides the time duration from of this instance by divider.

Parameters:
dividerThe divider.
Returns:
A reference to the modified TimeDuration instance.
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
bool sttcl::TimeDuration< Implementation >::operator< ( const TimeDuration< Implementation > &  rhs) const
inline

Less comparison operator for class TimeDuration.

Parameters:
rhsAnother instance of TimeDuration.
Returns:
true if rhs time duration is less than this instance, false otherwise.
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
bool sttcl::TimeDuration< Implementation >::operator<= ( const TimeDuration< Implementation > &  rhs) const
inline

Less or equality comparison operator for class TimeDuration.

Parameters:
rhsAnother instance of TimeDuration.
Returns:
true if rhs time duration is less than or equals this instance, false otherwise.
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
TimeDuration<Implementation>& sttcl::TimeDuration< Implementation >::operator= ( const TimeDuration< Implementation > &  rhs)
inline

Assignment operator for class TimeDuration.

Parameters:
rhsAnother instance of TimeDuration.
Returns:
A reference to the assigned TimeDuration instance.
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
TimeDuration<Implementation>& sttcl::TimeDuration< Implementation >::operator= ( const NativeTimeDuration< Implementation > &  nativeTimeDuration)
inline

Assignment operator for class TimeDuration.

Parameters:
nativeTimeDurationAn instance of the NativeTimeDuration value.
Returns:
A reference to the assigned TimeDuration instance.
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
bool sttcl::TimeDuration< Implementation >::operator== ( const TimeDuration< Implementation > &  rhs) const
inline

Equality comparison operator for class TimeDuration.

Parameters:
rhsAnother instance of TimeDuration.
Returns:
true if rhs time duration equals this instance, false otherwise.
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
bool sttcl::TimeDuration< Implementation >::operator> ( const TimeDuration< Implementation > &  rhs) const
inline

Greater comparison operator for class TimeDuration.

Parameters:
rhsAnother instance of TimeDuration.
Returns:
true if rhs time duration is greater than this instance, false otherwise.
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
bool sttcl::TimeDuration< Implementation >::operator>= ( const TimeDuration< Implementation > &  rhs) const
inline

Greater or equality comparison operator for class TimeDuration.

Parameters:
rhsAnother instance of TimeDuration.
Returns:
true if rhs time duration is greater than or equals this instance, false otherwise.
template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
long sttcl::TimeDuration< Implementation >::seconds ( ) const
inline

Gets the seconds represented in this instance.

template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
void sttcl::TimeDuration< Implementation >::seconds ( int  newSeconds)
inline

Sets the seconds represented in this instance.


Member Data Documentation

template<class Implementation = STTCL_DEFAULT_TIMEDURATIONIMPL>
const sttcl::TimeDuration< Implementation > sttcl::TimeDuration< Implementation >::Zero = sttcl::TimeDuration<Implementation>()
static

Represents a zero time duration.


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