TAO_UTO Class Reference

Universal Time Object Implementation. More...

#include <TAO_UTO.h>

List of all members.

Public Member Functions

 TAO_UTO (TimeBase::TimeT time, TimeBase::InaccuracyT inaccuracy, TimeBase::TdfT tdf)
 Constructor.
 ~TAO_UTO (void)
 Destructor.
virtual TimeBase::TimeT time ()
 For the readonly attribute <time>.
virtual TimeBase::InaccuracyT inaccuracy (void)
 For the readonly attribute <inaccuracy>.
virtual TimeBase::TdfT tdf (void)
virtual TimeBase::UtcT utc_time (void)
 For the readonly attribute <utc_time>.
CosTime::UTO_ptr absolute_time (void)
CosTime::TimeComparison compare_time (CosTime::ComparisonType comparison_type, CosTime::UTO_ptr uto)
CosTime::TIO_ptr time_to_interval (CosTime::UTO_ptr)
CosTime::TIO_ptr interval (void)

Private Attributes

TimeBase::UtcT attr_utc_time_


Detailed Description

Universal Time Object Implementation.

This is an encapsulation of the time. It provides the following operations on basic time.

Definition at line 44 of file TAO_UTO.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_UTO::TAO_UTO ( TimeBase::TimeT  time,
TimeBase::InaccuracyT  inaccuracy,
TimeBase::TdfT  tdf 
)

Constructor.

Definition at line 16 of file TAO_UTO.cpp.

00019 {
00020 
00021   this->attr_utc_time_.time = time;
00022 
00023   // Extract the lower 32 bits in the inacclo.
00024   this->attr_utc_time_.inacclo = (CORBA::ULong) ACE_U64_TO_U32 (inaccuracy);
00025 
00026   // Extract the lower 16 bits of the remaining bits. 'And'ing with 0xFFFF
00027   // is only a sanity check.
00028 
00029 #if defined (ACE_LACKS_U_LONGLONG_T)
00030   this->attr_utc_time_.inacchi = 0;
00031 #else
00032   this->attr_utc_time_.inacchi =
00033     static_cast<CORBA::UShort> ((inaccuracy >> 32U) & 0xFFFF);
00034 
00035 #endif /* ACE_LACKS_U_LONGLONG_T */
00036 
00037   this->attr_utc_time_.tdf = tdf;
00038 
00039 }

TAO_UTO::~TAO_UTO ( void   ) 

Destructor.

Definition at line 43 of file TAO_UTO.cpp.

00044 {
00045 }


Member Function Documentation

CosTime::UTO_ptr TAO_UTO::absolute_time ( void   ) 

Absolute time = Relative time + Base time. ?? Find out more about the Base Time, UTC and Distributed Time Sync. Algos. [3

Definition at line 89 of file TAO_UTO.cpp.

00090 {
00091   return CosTime::UTO::_nil ();
00092 }

CosTime::TimeComparison TAO_UTO::compare_time ( CosTime::ComparisonType  comparison_type,
CosTime::UTO_ptr  uto 
)

Compares the time contained in the object with the time in the supplied uto according to the supplied comparison type.

Definition at line 98 of file TAO_UTO.cpp.

References inaccuracy(), CosTime::MidC, CosTime::TCEqualTo, CosTime::TCGreaterThan, CosTime::TCIndeterminate, and CosTime::TCLessThan.

00100 {
00101   TimeBase::TimeT uto_time = uto->time ();
00102 
00103   TimeBase::InaccuracyT this_inaccuracy =
00104     this->inaccuracy ();
00105 
00106   TimeBase::InaccuracyT uto_inaccuracy =
00107     uto->inaccuracy ();
00108 
00109   if (comparison_type == CosTime::MidC)
00110     {
00111       if (this->time () == uto_time)
00112         {
00113           return CosTime::TCEqualTo;
00114         }
00115       else if (this->time () > uto_time)
00116         {
00117           return CosTime::TCGreaterThan;
00118         }
00119       else
00120         return CosTime::TCLessThan;
00121     }
00122   else if (this->time () == uto_time)
00123     {
00124       if (this_inaccuracy == 0U
00125           && uto_inaccuracy  == 0U)
00126         {
00127           return CosTime::TCEqualTo;
00128         }
00129     }
00130   else
00131     {
00132       if (this->time () > uto_time)
00133         {
00134           if (this->time () - this_inaccuracy
00135               > uto_time  - uto_inaccuracy)
00136             {
00137               return CosTime::TCGreaterThan;
00138             }
00139         }
00140       else if (this->time () + this_inaccuracy
00141                < uto_time - uto_inaccuracy)
00142         {
00143           return CosTime::TCLessThan;
00144         }
00145     }
00146 
00147   return CosTime::TCIndeterminate;
00148 }

TimeBase::InaccuracyT TAO_UTO::inaccuracy ( void   )  [virtual]

For the readonly attribute <inaccuracy>.

Definition at line 58 of file TAO_UTO.cpp.

References attr_utc_time_.

Referenced by compare_time(), and interval().

00059 {
00060   // Construct the Inaccuracy from the
00061   // inacchi and inacclo.
00062 
00063   TimeBase::InaccuracyT inaccuracy = attr_utc_time_.inacchi;
00064   inaccuracy <<= 32;
00065   inaccuracy |= attr_utc_time_.inacclo;
00066   return inaccuracy;
00067 }

CosTime::TIO_ptr TAO_UTO::interval ( void   ) 

Returns a TIO object representing the error interval around the time value in the UTO.

Definition at line 195 of file TAO_UTO.cpp.

References CORBA::Exception::_tao_print_exception(), ACE_NEW_THROW_EX, inaccuracy(), and time().

00196 {
00197   TAO_TIO *tio = 0;
00198 
00199   try
00200     {
00201       TimeBase::TimeT this_inaccuracy =
00202           this->inaccuracy ();
00203 
00204       TimeBase::TimeT lower =
00205         this->time () - this_inaccuracy;
00206 
00207       TimeBase::TimeT upper =
00208         this->time () + this_inaccuracy;
00209 
00210       ACE_NEW_THROW_EX (tio,
00211                         TAO_TIO (lower,
00212                                  upper),
00213                         CORBA::NO_MEMORY ());
00214     }
00215   catch (const CORBA::Exception& ex)
00216     {
00217       ex._tao_print_exception ("Exception:");
00218       return CosTime::TIO::_nil ();
00219     }
00220 
00221   return tio->_this ();
00222 }

TimeBase::TdfT TAO_UTO::tdf ( void   )  [virtual]

For the readonly attribute <tdf>, which is the "time displacement factor".

Definition at line 72 of file TAO_UTO.cpp.

References attr_utc_time_.

00073 {
00074   return attr_utc_time_.tdf;
00075 }

TimeBase::TimeT TAO_UTO::time (  )  [virtual]

For the readonly attribute <time>.

Definition at line 50 of file TAO_UTO.cpp.

References attr_utc_time_.

Referenced by interval().

00051 {
00052   return attr_utc_time_.time;
00053 }

CosTime::TIO_ptr TAO_UTO::time_to_interval ( CosTime::UTO_ptr   ) 

Returns a TIO representing the time interval between the time in the object and the time in the UTO passed as a parameter. The interval returned is the interval between the mid-points of the two UTOs. Inaccuracies are ignored. Note the result of this operation is meaningless if the base times of UTOs are different.

Definition at line 157 of file TAO_UTO.cpp.

References CORBA::Exception::_tao_print_exception(), and ACE_NEW_THROW_EX.

00158 {
00159   TAO_TIO *tio = 0;
00160 
00161   try
00162     {
00163       TimeBase::TimeT uto_time = uto->time ();
00164 
00165       if (this->time () > uto_time)
00166         {
00167           ACE_NEW_THROW_EX (tio,
00168                             TAO_TIO (uto_time,
00169                                      this->time ()),
00170                             CORBA::NO_MEMORY ());
00171 
00172         }
00173       else
00174         {
00175           ACE_NEW_THROW_EX (tio,
00176                             TAO_TIO (this->time (),
00177                                      uto_time),
00178                             CORBA::NO_MEMORY ());
00179 
00180         }
00181     }
00182   catch (const CORBA::Exception& ex)
00183     {
00184       ex._tao_print_exception ("Exception:");
00185       return CosTime::TIO::_nil ();
00186     }
00187 
00188   return tio->_this ();
00189 }

TimeBase::UtcT TAO_UTO::utc_time ( void   )  [virtual]

For the readonly attribute <utc_time>.

Definition at line 80 of file TAO_UTO.cpp.

References attr_utc_time_.

00081 {
00082   return attr_utc_time_;
00083 }


Member Data Documentation

TimeBase::UtcT TAO_UTO::attr_utc_time_ [private]

The readonly attribute structure having the time, inaccuracy and displacement. The get methods for other readonly attributes (time, inaccuracy, tdf) defined in the IDL use the members of this structure and hence need not have separate member variables for them.

Definition at line 102 of file TAO_UTO.h.

Referenced by inaccuracy(), tdf(), time(), and utc_time().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:49:18 2010 for TAO_CosTime by  doxygen 1.4.7