All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
te::dt::TimeInstant Class Reference

A class to represent time instant. More...

#include <TimeInstant.h>

Inheritance diagram for te::dt::TimeInstant:
te::dt::DateTimeInstant te::dt::DateTime te::dt::AbstractData

Public Member Functions

AbstractDataclone () const
 It returns a clone of this object. More...
 
Date getDate () const
 It returns the date associated to time instant. More...
 
DateTimeType getDateTimeType () const
 It returns the subtype of the date and time type. More...
 
TimeDuration getTime () const
 It returns the time duration associated to time instant. More...
 
const boost::posix_time::ptime & getTimeInstant () const
 It returns the boost time instant type. More...
 
boost::posix_time::ptime & getTimeInstant ()
 It returns the boost time instant type. More...
 
int getTypeCode () const
 It returns the data type code associated to date and time values: DATETIME_TYPE. More...
 
bool operator!= (const DateTime &rhs) const
 Operator !=. More...
 
long operator- (const TimeInstant &rhs) const
 Operator -. More...
 
bool operator< (const DateTime &rhs) const
 Operator <. More...
 
bool operator== (const DateTime &rhs) const
 Operator ==. More...
 
bool operator> (const DateTime &rhs) const
 Operator > More...
 
 TimeInstant ()
 Constructor. More...
 
 TimeInstant (const Date &d, const TimeDuration &td)
 Constructor from a date and time offset. More...
 
 TimeInstant (const boost::posix_time::ptime &t)
 Constructor. More...
 
 TimeInstant (const std::string &dtime)
 Constructor. More...
 
std::string toString () const
 It returns the time instant in the ISO textual format (YYYYMMDDTHHMMSS,fffffffff) where T is the date-time separator. More...
 
virtual ~TimeInstant ()
 Constructor. More...
 

Protected Attributes

boost::posix_time::ptime m_timeInstant
 The internal time instant information. More...
 

Detailed Description

A class to represent time instant.

A time instant is a point on the continuous time axis. It is composed of a date that uses the Gregorian calendar and of a local time. Internally, it uses the datetime boost library to represent time instant, by using the data type boost::posix_time::ptime.

See also
Date, DateTime, TimeInstantTZ, TimeDuration, TimePeriod, TimePeriodTZ, DatePeriod, DateDuration

Definition at line 55 of file TimeInstant.h.

Constructor & Destructor Documentation

te::dt::TimeInstant::TimeInstant ( )

Constructor.

Definition at line 29 of file TimeInstant.cpp.

te::dt::TimeInstant::TimeInstant ( const Date d,
const TimeDuration td 
)

Constructor from a date and time offset.

Parameters
dThe date.
tdTime offset.

Definition at line 34 of file TimeInstant.cpp.

te::dt::TimeInstant::TimeInstant ( const boost::posix_time::ptime &  t)

Constructor.

Parameters
tA time instant.

Definition at line 39 of file TimeInstant.cpp.

te::dt::TimeInstant::TimeInstant ( const std::string &  dtime)

Constructor.

It constructs a time instant from a non delimited ISO form string. Example: 20020131T235959

Parameters
dtimeISO form string

Definition at line 44 of file TimeInstant.cpp.

te::dt::TimeInstant::~TimeInstant ( )
virtual

Constructor.

Definition at line 99 of file TimeInstant.cpp.

Member Function Documentation

te::dt::AbstractData * te::dt::TimeInstant::clone ( ) const
virtual

It returns a clone of this object.

Returns
A clone of this object.

Implements te::dt::AbstractData.

Definition at line 87 of file TimeInstant.cpp.

DateTimeType te::dt::TimeInstant::getDateTimeType ( ) const
inlinevirtual

It returns the subtype of the date and time type.

Returns
The subtype of the date and time type.

Implements te::dt::DateTime.

Definition at line 179 of file TimeInstant.h.

References te::dt::TIME_INSTANT.

boost::posix_time::ptime& te::dt::TimeInstant::getTimeInstant ( )
inline

It returns the boost time instant type.

Returns
The boost time instant type.

Definition at line 99 of file TimeInstant.h.

int te::dt::DateTime::getTypeCode ( ) const
inlinevirtualinherited

It returns the data type code associated to date and time values: DATETIME_TYPE.

Returns
The data type code associated to the date and time values: DATETIME_TYPE.

Implements te::dt::AbstractData.

Definition at line 103 of file DateTime.h.

References te::dt::DATETIME_TYPE.

bool te::dt::TimeInstant::operator!= ( const DateTime rhs) const
virtual

Operator !=.

Parameters
rhsThe time instant to be compared.
Returns
It returns true if the two time instants are not equal. Otherwise, it returns false.

Implements te::dt::DateTime.

Definition at line 62 of file TimeInstant.cpp.

References m_timeInstant.

long te::dt::TimeInstant::operator- ( const TimeInstant rhs) const

Operator -.

Parameters
rhsThe right-hand-side time instant.
Returns
It returns the number of seconds between the two time instants.

Definition at line 80 of file TimeInstant.cpp.

References m_timeInstant.

bool te::dt::TimeInstant::operator< ( const DateTime rhs) const
virtual

Operator <.

Parameters
rhsThe right-hand-side time instant to be compared.
Returns
It returns true if the right-hand-side time instant is greater than the lefth side one. Otherwise, it returns false.

Implements te::dt::DateTime.

Definition at line 68 of file TimeInstant.cpp.

References m_timeInstant.

bool te::dt::TimeInstant::operator== ( const DateTime rhs) const
virtual

Operator ==.

Parameters
rhsThe time instant to be compared.
Returns
It returns true if the two time instants are equal. Otherwise, it returns false.

Implements te::dt::DateTime.

Definition at line 56 of file TimeInstant.cpp.

References m_timeInstant.

bool te::dt::TimeInstant::operator> ( const DateTime rhs) const
virtual

Operator >

Parameters
rhsThe right-hand-side time instant to be compared.
Returns
It returns true if the right-hand-side time instant is less than the lefth side one. Otherwise, it returns false.

Implements te::dt::DateTime.

Definition at line 74 of file TimeInstant.cpp.

References m_timeInstant.

std::string te::dt::TimeInstant::toString ( void  ) const
virtual

It returns the time instant in the ISO textual format (YYYYMMDDTHHMMSS,fffffffff) where T is the date-time separator.

Returns
The time instant in the ISO textual format (YYYYMMDDTHHMMSS,fffffffff) where T is the date-time separator.

Implements te::dt::AbstractData.

Definition at line 92 of file TimeInstant.cpp.

Member Data Documentation

boost::posix_time::ptime te::dt::TimeInstant::m_timeInstant
protected

The internal time instant information.

Definition at line 186 of file TimeInstant.h.

Referenced by operator!=(), operator-(), operator<(), operator==(), and operator>().


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