ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkRealTimeInterval.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkRealTimeInterval_h
00019 #define __itkRealTimeInterval_h
00020 
00021 #include "itkIntTypes.h"
00022 #include "itkMacro.h"
00023 #include <iostream>
00024 
00025 namespace itk
00026 {
00045 class ITKCommon_EXPORT RealTimeInterval
00046 {
00047 public:
00048 
00049   typedef RealTimeInterval    Self;
00050 
00052   typedef   int64_t   SecondsDifferenceType;
00053   typedef   int64_t   MicroSecondsDifferenceType;
00054 
00056   RealTimeInterval();
00057 
00059   RealTimeInterval( SecondsDifferenceType, MicroSecondsDifferenceType );
00060 
00062   ~RealTimeInterval();
00063 
00065   typedef   double    TimeRepresentationType;
00066 
00068   TimeRepresentationType GetTimeInMicroSeconds() const;
00069   TimeRepresentationType GetTimeInMilliSeconds() const;
00070   TimeRepresentationType GetTimeInSeconds() const;
00071   TimeRepresentationType GetTimeInMinutes() const;
00072   TimeRepresentationType GetTimeInHours() const;
00073   TimeRepresentationType GetTimeInDays() const;
00075 
00077   Self operator-( const Self & ) const;
00078   Self operator+( const Self & ) const;
00079   const Self & operator-=( const Self & );
00080   const Self & operator+=( const Self & );
00082 
00084   bool operator>( const Self & ) const;
00085   bool operator<( const Self & ) const;
00086   bool operator==( const Self & ) const;
00087   bool operator!=( const Self & ) const;
00088   bool operator<=( const Self & ) const;
00089   bool operator>=( const Self & ) const;
00091 
00094   void Set( SecondsDifferenceType, MicroSecondsDifferenceType );
00095 
00097   friend ITKCommon_EXPORT std::ostream & operator<<(std::ostream & os, const RealTimeInterval & v);
00098 
00099 private:
00100 
00101   friend class RealTimeStamp;
00102 
00104   SecondsDifferenceType        m_Seconds;
00105 
00110   MicroSecondsDifferenceType   m_MicroSeconds;
00111 
00112 };
00113 
00114 } // end of namespace itk
00115 
00116 #endif  // __itkRealTimeInterval_h
00117