MIRA
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 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

◆ Base

typedef boost::posix_time::time_duration Base
protected

Constructor & Destructor Documentation

◆ Duration() [1/4]

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

◆ Duration() [2/4]

Duration ( const Base d)
inline

Construct from base class.

◆ Duration() [3/4]

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

Construct from special value.

◆ Duration() [4/4]

Duration ( )
inline

Default constructor constructs to Duration of 0 length.

Member Function Documentation

◆ nanoseconds() [1/2]

static Duration nanoseconds ( int64  v)
inlinestatic

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

See also
seconds

◆ microseconds() [1/2]

static Duration microseconds ( int64  v)
inlinestatic

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

See also
seconds

◆ milliseconds() [1/2]

static Duration milliseconds ( int64  v)
inlinestatic

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

See also
seconds

◆ seconds() [1/2]

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:

◆ minutes() [1/2]

static Duration minutes ( int32  v)
inlinestatic

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

See also
seconds

◆ hours() [1/2]

static Duration hours ( int32  v)
inlinestatic

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

See also
seconds

◆ reflectRead()

MIRA_SPLIT_REFLECT_MEMBER void reflectRead ( Reflector &  r)
inline

Reflect.

◆ reflectWrite()

void reflectWrite ( Reflector &  r)
inline

◆ negativeInfinity()

static Duration negativeInfinity ( )
inlinestatic

Returns a special duration time representing negative infinity.

◆ infinity()

static Duration infinity ( )
inlinestatic

Returns a special duration time representing positive infinity.

◆ invalid()

static Duration invalid ( )
inlinestatic

Returns an invalid duration.

◆ isValid()

bool isValid ( ) const
inline

Checks if this duration is invalid.

◆ isInfinity()

bool isInfinity ( ) const
inline

Checks if this duration is infinity.

◆ hours() [2/2]

hour_type hours ( ) const
inline

Returns number of hours in the duration.

◆ minutes() [2/2]

min_type minutes ( ) const
inline

Returns normalized number of minutes (0..59)

◆ seconds() [2/2]

sec_type seconds ( ) const
inline

Returns normalized number of seconds (0..59)

◆ milliseconds() [2/2]

tick_type milliseconds ( ) const
inline

Returns normalized number of milliseconds (0..999)

Examples:
tutorials/FloatProducer.C.

◆ microseconds() [2/2]

tick_type microseconds ( ) const
inline

Returns normalized number of microseconds (0..999)

◆ nanoseconds() [2/2]

tick_type nanoseconds ( ) const
inline

Returns normalized number of nanoseconds (0..999)

◆ totalSeconds()

sec_type totalSeconds ( ) const
inline

Returns total number of seconds truncating any fractional seconds.

◆ totalMilliseconds()

tick_type totalMilliseconds ( ) const
inline

Returns total number of milliseconds truncating any fractional milliseconds.

◆ totalMicroseconds()

tick_type totalMicroseconds ( ) const
inline

Returns total number of microseconds truncating any fractional microseconds.

◆ totalNanoseconds()

tick_type totalNanoseconds ( ) const
inline

Returns total number of nanoseconds truncating any fractional nanoseconds.

◆ operator-() [1/2]

Duration operator- ( ) const
inline

◆ operator-() [2/2]

Duration operator- ( const Duration d) const
inline

◆ operator+()

Duration operator+ ( const Duration d) const
inline

◆ operator/() [1/3]

Duration operator/ ( int  divisor) const
inline

◆ operator/() [2/3]

Duration operator/ ( float  divisor) const
inline

◆ operator/() [3/3]

float operator/ ( Duration  other) const
inline

◆ operator-=()

Duration operator-= ( const Duration d)
inline

◆ operator+=()

Duration operator+= ( const Duration d)
inline

◆ operator/=() [1/2]

Duration operator/= ( int  divisor)
inline

Division operations on a duration with an integer.

◆ operator/=() [2/2]

Duration operator/= ( float  divisor)
inline

◆ operator*() [1/2]

Duration operator* ( int  rhs) const
inline

Multiplication operations an a duration with an integer.

◆ operator*() [2/2]

Duration operator* ( float  rhs) const
inline

◆ operator*=() [1/2]

Duration operator*= ( int  rhs)
inline

◆ operator*=() [2/2]

Duration operator*= ( float  rhs)
inline

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