te::dt::TimePeriod Class Reference

A class to represent time period. More...

#include <TimePeriod.h>

Inheritance diagram for te::dt::TimePeriod:
te::dt::DateTimePeriod te::dt::DateTime te::dt::AbstractData

Public Member Functions

AbstractDataclone () const
 It returns a clone of this object. More...
 
DateTimeType getDateTimeType () const
 It returns the subtype of the date and time type. More...
 
DateTimeInstantgetFinalInstant () const
 It gets the final date time instant. More...
 
TimeInstant getFinalTimeInstant () const
 It gets the final time instant. More...
 
DateTimeInstantgetInitialInstant () const
 It gets the initial date time instant. More...
 
TimeInstant getInitialTimeInstant () const
 It gets the initial time instant. More...
 
const boost::posix_time::time_period & getTimePeriod () const
 Assignment operator. More...
 
boost::posix_time::time_period & getTimePeriod ()
 It returns the boost time period 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...
 
bool operator< (const DateTime &rhs) const
 Operator <. More...
 
bool operator== (const DateTime &rhs) const
 Operator ==. More...
 
bool operator> (const DateTime &rhs) const
 Operator > More...
 
 TimePeriod ()
 Constructor. More...
 
 TimePeriod (const TimeInstant &initialTime, const TimeInstant &finalTime)
 Constructor. More...
 
 TimePeriod (const boost::posix_time::time_period &t)
 Constructor. More...
 
std::string toString () const
 It returns the time period in the ISO textual format (YYYYMMDDThhmmss/YYYYMMDDThhmmss). More...
 
virtual ~TimePeriod ()
 Destructor. More...
 

Protected Attributes

boost::posix_time::time_period m_timePeriod
 Time period information. More...
 

Detailed Description

A class to represent time period.

A time period is a part of the continous time axis limited by two time instants or points. Each time instant 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 period, by using the data type boost::posix_time::time_period.

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

Definition at line 54 of file TimePeriod.h.

Constructor & Destructor Documentation

te::dt::TimePeriod::TimePeriod ( )

Constructor.

te::dt::TimePeriod::TimePeriod ( const TimeInstant initialTime,
const TimeInstant finalTime 
)

Constructor.

Parameters
initialTimeA initial time instant.
finalTimeA final time instant.
te::dt::TimePeriod::TimePeriod ( const boost::posix_time::time_period &  t)

Constructor.

Parameters
tA time period.
virtual te::dt::TimePeriod::~TimePeriod ( )
virtual

Destructor.

Member Function Documentation

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

It returns a clone of this object.

Returns
A clone of this object.

Implements te::dt::AbstractData.

DateTimeType te::dt::TimePeriod::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 182 of file TimePeriod.h.

References te::dt::TIME_PERIOD.

DateTimeInstant* te::dt::TimePeriod::getFinalInstant ( ) const
virtual

It gets the final date time instant.

Returns
The final time instant
Note
The caller will take the ownership of the returned pointer.

Implements te::dt::DateTimePeriod.

TimeInstant te::dt::TimePeriod::getFinalTimeInstant ( ) const

It gets the final time instant.

Returns
The final time instant
DateTimeInstant* te::dt::TimePeriod::getInitialInstant ( ) const
virtual

It gets the initial date time instant.

Returns
The initial time instant
Note
The caller will take the ownership of the returned pointer.

Implements te::dt::DateTimePeriod.

TimeInstant te::dt::TimePeriod::getInitialTimeInstant ( ) const

It gets the initial time instant.

Returns
The initial time instant
const boost::posix_time::time_period& te::dt::TimePeriod::getTimePeriod ( ) const
inline

Assignment operator.

It returns the boost time period type.

Returns
The boost time period type.

Definition at line 86 of file TimePeriod.h.

boost::posix_time::time_period& te::dt::TimePeriod::getTimePeriod ( )
inline

It returns the boost time period type.

Returns
The boost time period type.

Definition at line 93 of file TimePeriod.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::TimePeriod::operator!= ( const DateTime rhs) const
virtual

Operator !=.

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

Implements te::dt::DateTime.

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

Operator <.

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

Implements te::dt::DateTime.

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

Operator ==.

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

Implements te::dt::DateTime.

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

Operator >

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

Implements te::dt::DateTime.

std::string te::dt::TimePeriod::toString ( ) const
virtual

It returns the time period in the ISO textual format (YYYYMMDDThhmmss/YYYYMMDDThhmmss).

Returns
The time period in the ISO textual format (YYYYMMDDThhmmss/YYYYMMDDThhmmss).

Implements te::dt::AbstractData.

Member Data Documentation

boost::posix_time::time_period te::dt::TimePeriod::m_timePeriod
protected

Time period information.

Definition at line 191 of file TimePeriod.h.


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