MIRA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Types | List of all members
Duration Class Reference

Use this class to represent time durations. More...

#include <utils/Time.h>

Inheritance diagram for Duration:
Inheritance graph
[legend]

Public Member Functions

 Duration (hour_type hour, min_type min, sec_type sec, fractional_seconds_type fs=0)
 
 Duration (const Duration &d)
 Construct from duration. More...
 
 Duration (Base d)
 Construct from base class. More...
 
 Duration (const boost::posix_time::special_values sv)
 Construct from special value. More...
 
 Duration ()
 Default constructor constructs to Duration of 0 length. More...
 
template<typename Reflector >
MIRA_SPLIT_REFLECT_MEMBER void reflectRead (Reflector &r)
 Reflect. More...
 
template<typename Reflector >
void reflectWrite (Reflector &r)
 
bool isValid () const
 Checks if this duration is invalid. More...
 
bool isInfinity () const
 Checks if this duration is infinity. More...
 
hour_type hours () const
 Returns number of hours in the duration. More...
 
min_type minutes () const
 Returns normalized number of minutes (0..59) More...
 
sec_type seconds () const
 Returns normalized number of seconds (0..59) More...
 
tick_type milliseconds () const
 Returns normalized number of milliseconds (0..999) More...
 
tick_type microseconds () const
 Returns normalized number of microseconds (0..999) More...
 
tick_type nanoseconds () const
 Returns normalized number of nanoseconds (0..999) More...
 
sec_type totalSeconds () const
 Returns total number of seconds truncating any fractional seconds. More...
 
tick_type totalMilliseconds () const
 Returns total number of milliseconds truncating any fractional milliseconds. More...
 
tick_type totalMicroseconds () const
 Returns total number of microseconds truncating any fractional microseconds. More...
 
tick_type totalNanoseconds () const
 Returns total number of nanoseconds truncating any fractional nanoseconds. More...
 
Operators
Duration operator- () const
 
Duration operator- (const Duration &d) const
 
Duration operator+ (const Duration &d) const
 
Duration operator/ (int divisor) const
 
Duration operator/ (float divisor) const
 
float operator/ (Duration other) const
 
Duration operator-= (const Duration &d)
 
Duration operator+= (const Duration &d)
 
Duration operator/= (int divisor)
 Division operations on a duration with an integer. More...
 
Duration operator/= (float divisor)
 
Duration operator* (int rhs) const
 Multiplication operations an a duration with an integer. More...
 
Duration operator* (float rhs) const
 
Duration operator*= (int rhs)
 
Duration operator*= (float rhs)
 

Static Public Member Functions

static Duration nanoseconds (int64 v)
 Can be used to construct a Duration object that is specified in nanoseconds. More...
 
static Duration microseconds (int64 v)
 Can be used to construct a Duration object that is specified in microseconds. More...
 
static Duration milliseconds (int64 v)
 Can be used to construct a Duration object that is specified in milliseconds. More...
 
static Duration seconds (int32 v)
 Can be used to construct a Duration object that is specified in seconds. More...
 
static Duration minutes (int32 v)
 Can be used to construct a Duration object that is specified in minutes. More...
 
static Duration hours (int32 v)
 Can be used to construct a Duration object that is specified in hours. More...
 
static Duration negativeInfinity ()
 Returns a special duration time representing negative infinity. More...
 
static Duration infinity ()
 Returns a special duration time representing positive infinity. More...
 
static Duration invalid ()
 Returns an invalid duration. More...
 

Protected Types

typedef
boost::posix_time::time_duration 
Base
 

Detailed Description

Use this class to represent time durations.

Time durations can be added to each other and to Time objects. For specifying time durations you can use microseconds, milliseconds, seconds, minutes and hours. The underlying class is boost::posix_time::time_duration. For documentation see http://boost.org/doc/libs/1_44_0/doc/html/date_time/posix_time.html .

Examples:
tutorials/Point2Visualization.C, and tutorials/Point3Visualization.C.

Member Typedef Documentation

typedef boost::posix_time::time_duration Base
protected

Constructor & Destructor Documentation

Duration ( hour_type  hour,
min_type  min,
sec_type  sec,
fractional_seconds_type  fs = 0 
)
inline
Duration ( const Duration d)
inline

Construct from duration.

Duration ( Base  d)
inline

Construct from base class.

Duration ( const boost::posix_time::special_values  sv)
inline

Construct from special value.

Duration ( )
inline

Default constructor constructs to Duration of 0 length.

Member Function Documentation

static Duration nanoseconds ( int64  v)
inlinestatic

Can be used to construct a Duration object that is specified in nanoseconds.

See Also
seconds
static Duration microseconds ( int64  v)
inlinestatic

Can be used to construct a Duration object that is specified in microseconds.

See Also
seconds
static Duration milliseconds ( int64  v)
inlinestatic

Can be used to construct a Duration object that is specified in milliseconds.

See Also
seconds
static Duration seconds ( int32  v)
inlinestatic

Can be used to construct a Duration object that is specified in seconds.

e.g:

Duration duration = Duration::seconds(20);

Durations can also be added:

static Duration minutes ( int32  v)
inlinestatic

Can be used to construct a Duration object that is specified in minutes.

See Also
seconds
static Duration hours ( int32  v)
inlinestatic

Can be used to construct a Duration object that is specified in hours.

See Also
seconds
MIRA_SPLIT_REFLECT_MEMBER void reflectRead ( Reflector &  r)
inline

Reflect.

void reflectWrite ( Reflector &  r)
inline
static Duration negativeInfinity ( )
inlinestatic

Returns a special duration time representing negative infinity.

static Duration infinity ( )
inlinestatic

Returns a special duration time representing positive infinity.

static Duration invalid ( )
inlinestatic

Returns an invalid duration.

bool isValid ( ) const
inline

Checks if this duration is invalid.

bool isInfinity ( ) const
inline

Checks if this duration is infinity.

hour_type hours ( ) const
inline

Returns number of hours in the duration.

min_type minutes ( ) const
inline

Returns normalized number of minutes (0..59)

sec_type seconds ( ) const
inline

Returns normalized number of seconds (0..59)

tick_type milliseconds ( ) const
inline

Returns normalized number of milliseconds (0..999)

Examples:
tutorials/FloatProducer.C.
tick_type microseconds ( ) const
inline

Returns normalized number of microseconds (0..999)

tick_type nanoseconds ( ) const
inline

Returns normalized number of nanoseconds (0..999)

sec_type totalSeconds ( ) const
inline

Returns total number of seconds truncating any fractional seconds.

tick_type totalMilliseconds ( ) const
inline

Returns total number of milliseconds truncating any fractional milliseconds.

tick_type totalMicroseconds ( ) const
inline

Returns total number of microseconds truncating any fractional microseconds.

tick_type totalNanoseconds ( ) const
inline

Returns total number of nanoseconds truncating any fractional nanoseconds.

Duration operator- ( ) const
inline
Duration operator- ( const Duration d) const
inline
Duration operator+ ( const Duration d) const
inline
Duration operator/ ( int  divisor) const
inline
Duration operator/ ( float  divisor) const
inline
float operator/ ( Duration  other) const
inline
Duration operator-= ( const Duration d)
inline
Duration operator+= ( const Duration d)
inline
Duration operator/= ( int  divisor)
inline

Division operations on a duration with an integer.

Duration operator/= ( float  divisor)
inline
Duration operator* ( int  rhs) const
inline

Multiplication operations an a duration with an integer.

Duration operator* ( float  rhs) const
inline
Duration operator*= ( int  rhs)
inline
Duration operator*= ( float  rhs)
inline

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