Time Interval Object Implementation. More...
#include <TAO_TIO.h>
Public Member Functions | |
TAO_TIO (TimeBase::TimeT lower, TimeBase::TimeT upper) | |
Constructor. | |
~TAO_TIO (void) | |
Destructor. | |
virtual TimeBase::IntervalT | time_interval () |
This is the get method for the attribute time interval. | |
virtual CosTime::OverlapType | spans (CosTime::UTO_ptr time, CosTime::TIO_out overlap) |
virtual CosTime::OverlapType | overlaps (CosTime::TIO_ptr interval, CosTime::TIO_out overlap) |
virtual CosTime::UTO_ptr | time (void) |
Private Attributes | |
TimeBase::IntervalT | attr_time_interval |
Time Interval Object Implementation.
The TIO represents a time interval and has operations to compare itself with a UTO or another TIO. It also has an operation to create a UTO from the value of it's time interval.
Definition at line 37 of file TAO_TIO.h.
TAO_TIO::TAO_TIO | ( | TimeBase::TimeT | lower, | |
TimeBase::TimeT | upper | |||
) |
Constructor.
Definition at line 8 of file TAO_TIO.cpp.
{ this->attr_time_interval.lower_bound = lower; this->attr_time_interval.upper_bound = upper; }
TAO_TIO::~TAO_TIO | ( | void | ) |
CosTime::OverlapType TAO_TIO::overlaps | ( | CosTime::TIO_ptr | interval, | |
CosTime::TIO_out | overlap | |||
) | [virtual] |
This operation returns a value of type OverlapType depending on how the interval in the object and interval in the parameter TIO overlap. If OverlapType is not OTNoOverlap, then the out parameter overlap contains the overlap interval, otherwise the out parameter contains the gap between the two intervals.
Definition at line 147 of file TAO_TIO.cpp.
{ TAO_TIO *tio_i = 0; TimeBase::TimeT lb1 = this->time_interval ().lower_bound; TimeBase::TimeT up1 = this->time_interval ().upper_bound; TimeBase::TimeT lb2 = tio->time_interval ().lower_bound; TimeBase::TimeT up2 = tio->time_interval ().upper_bound; if (lb1 == lb2 && up1 == up2) { ACE_NEW_THROW_EX (tio_i, TAO_TIO (lb1, up1), CORBA::NO_MEMORY ()); overlap = tio_i->_this (); return CosTime::OTOverlap; } else if (lb1 > lb2 && up1 < up2) { ACE_NEW_THROW_EX (tio_i, TAO_TIO (lb1, up1), CORBA::NO_MEMORY ()); overlap = tio_i->_this (); return CosTime::OTContained; } else if (lb1 < lb2 && up1 > up2) { ACE_NEW_THROW_EX (tio_i, TAO_TIO (lb2, up2), CORBA::NO_MEMORY ()); overlap = tio_i->_this (); return CosTime::OTContained; } else if (lb1 < lb2) { if (up1 < lb2) { ACE_NEW_THROW_EX (tio_i, TAO_TIO (0, 0), CORBA::NO_MEMORY ()); overlap = tio_i->_this (); return CosTime::OTNoOverlap; } else { ACE_NEW_THROW_EX (tio_i, TAO_TIO (lb2, up1), CORBA::NO_MEMORY ()); overlap = tio_i->_this (); return CosTime::OTOverlap; } } else if (up2 < lb1) { ACE_NEW_THROW_EX (tio_i, TAO_TIO (0, 0), CORBA::NO_MEMORY ()); overlap = tio_i->_this (); return CosTime::OTNoOverlap; } else { ACE_NEW_THROW_EX (tio_i, TAO_TIO (lb1, up2), CORBA::NO_MEMORY ()); overlap = tio_i->_this (); } return CosTime::OTNoOverlap; }
CosTime::OverlapType TAO_TIO::spans | ( | CosTime::UTO_ptr | time, | |
CosTime::TIO_out | overlap | |||
) | [virtual] |
This operation returns a value of type OverlapType depending on how the interval in the object and the time range represented by the parameter UTO overlap. If OverlapType is not OTNoOverlap, then the out parameter overlap contains the overlap interval, otherwise the out parameter contains the gap between the two intervals.
Definition at line 35 of file TAO_TIO.cpp.
{ TAO_TIO *tio = 0; try { TimeBase::TimeT lb1 = this->time_interval ().lower_bound; TimeBase::TimeT up1 = this->time_interval ().upper_bound; TimeBase::TimeT tmp1 = uto->time (); TimeBase::TimeT tmp2 = uto->inaccuracy (); TimeBase::TimeT lb2 = tmp1 - tmp2; tmp1 = uto->time (); tmp2 = uto->inaccuracy (); TimeBase::TimeT up2 = tmp1 + tmp2; if (lb1 == lb2 && up1 == up2) { ACE_NEW_RETURN (tio, TAO_TIO (lb1, up1), CosTime::OTNoOverlap); overlap = tio->_this (); return CosTime::OTOverlap; } else if (lb1 > lb2 && up1 < up2) { ACE_NEW_RETURN (tio, TAO_TIO (lb1, up1), CosTime::OTNoOverlap); overlap = tio->_this (); return CosTime::OTContained; } else if (lb1 < lb2 && up1 > up2) { ACE_NEW_RETURN (tio, TAO_TIO (lb2, up2), CosTime::OTNoOverlap); overlap = tio->_this (); return CosTime::OTContained; } else if (lb1 < lb2) { if (up1 < lb2) { ACE_NEW_RETURN (tio, TAO_TIO (0, 0), CosTime::OTNoOverlap); overlap = tio->_this (); return CosTime::OTNoOverlap; } else { ACE_NEW_RETURN (tio, TAO_TIO (lb2, up1), CosTime::OTNoOverlap); overlap = tio->_this (); return CosTime::OTOverlap; } } else if (up2 < lb1) { ACE_NEW_RETURN (tio, TAO_TIO (0, 0), CosTime::OTNoOverlap); overlap = tio->_this (); return CosTime::OTNoOverlap; } else { ACE_NEW_RETURN (tio, TAO_TIO (lb1, up2), CosTime::OTNoOverlap); overlap = tio->_this (); } } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception:"); } return CosTime::OTNoOverlap; }
CosTime::UTO_ptr TAO_TIO::time | ( | void | ) | [virtual] |
Returns a UTO in which the inaccuracy interval is equal to the time interval in the TIO and time value is the midpoint of the interval.
Definition at line 239 of file TAO_TIO.cpp.
{ TAO_UTO *uto = 0; ACE_NEW_THROW_EX (uto, TAO_UTO ((this->time_interval ().upper_bound - this->time_interval ().lower_bound) / 2, this->time_interval ().upper_bound - this->time_interval ().lower_bound, 0), CORBA::NO_MEMORY ()); return uto->_this (); }
TimeBase::IntervalT TAO_TIO::time_interval | ( | void | ) | [virtual] |
This is the get method for the attribute time interval.
Definition at line 23 of file TAO_TIO.cpp.
{ return attr_time_interval; }
TimeBase::IntervalT TAO_TIO::attr_time_interval [private] |