Loading...
Searching...
No Matches
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

AbstractData * clone () const
 It returns a clone of this object.
 
DateTimeType getDateTimeType () const
 It returns the subtype of the date and time type.
 
DateTimeInstant * getFinalInstant () const
 It gets the final date time instant.
 
TimeInstant getFinalTimeInstant () const
 It gets the final time instant.
 
DateTimeInstant * getInitialInstant () const
 It gets the initial date time instant.
 
TimeInstant getInitialTimeInstant () const
 It gets the initial time instant.
 
boost::posix_time::time_period & getTimePeriod ()
 It returns the boost time period type.
 
const boost::posix_time::time_period & getTimePeriod () const
 Assignment operator.
 
int getTypeCode () const
 It returns the data type code associated to date and time values: DATETIME_TYPE.
 
bool operator!= (const DateTime &rhs) const
 Operator !=.
 
bool operator< (const DateTime &rhs) const
 Operator <.
 
bool operator== (const DateTime &rhs) const
 Operator ==.
 
bool operator> (const DateTime &rhs) const
 Operator >
 
 TimePeriod ()
 Constructor.
 
 TimePeriod (const boost::posix_time::time_period &t)
 Constructor.
 
 TimePeriod (const TimeInstant &initialTime, const TimeInstant &finalTime)
 Constructor.
 
std::string toString () const
 It returns the time period in the ISO textual format (YYYYMMDDThhmmss/YYYYMMDDThhmmss).
 
virtual ~TimePeriod ()
 Destructor.
 

Protected Attributes

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

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

◆ TimePeriod() [1/3]

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

Constructor.

◆ TimePeriod() [2/3]

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

Constructor.

Parameters
initialTimeA initial time instant.
finalTimeA final time instant.

◆ TimePeriod() [3/3]

te::dt::TimePeriod::TimePeriod ( const boost::posix_time::time_period &  t)

Constructor.

Parameters
tA time period.

◆ ~TimePeriod()

virtual te::dt::TimePeriod::~TimePeriod ( )
virtual

Destructor.

Member Function Documentation

◆ clone()

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

It returns a clone of this object.

Returns
A clone of this object.

Implements te::dt::AbstractData.

◆ getDateTimeType()

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.

◆ getFinalInstant()

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.

◆ getFinalTimeInstant()

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

It gets the final time instant.

Returns
The final time instant

◆ getInitialInstant()

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.

◆ getInitialTimeInstant()

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

It gets the initial time instant.

Returns
The initial time instant

◆ getTimePeriod() [1/2]

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.

◆ getTimePeriod() [2/2]

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.

◆ getTypeCode()

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.

◆ operator!=()

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.

◆ operator<()

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.

◆ operator==()

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.

◆ operator>()

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.

◆ toString()

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

◆ m_timePeriod

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: