00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkTimeStamp.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-03-20 16:47:43 $ 00007 Version: $Revision: 1.17 $ 00008 00009 Copyright (c) ISC Insight Software Consortium. All rights reserved. 00010 See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __igstkTimeStamp_h 00018 #define __igstkTimeStamp_h 00019 00020 00021 #include <iostream> 00022 #include "igstkRealTimeClock.h" 00023 #include "itkNumericTraits.h" 00024 00025 namespace igstk 00026 { 00027 00055 class TimeStamp 00056 { 00057 00058 public: 00059 00060 typedef double TimePeriodType; 00061 00063 static TimePeriodType GetLongestPossibleTime(); 00064 00066 static TimePeriodType GetZeroValue(); 00067 00069 static TimeStamp ComputeOverlap( TimeStamp t1, TimeStamp t2 ); 00070 00072 TimeStamp(); 00073 virtual ~TimeStamp(); 00074 00075 00077 const TimeStamp & operator=( const TimeStamp & inputTimeStamp ); 00078 00083 void SetStartTimeNowAndExpireAfter( TimePeriodType millisecondsToExpire); 00084 00085 00089 TimePeriodType GetStartTime() const; 00090 00091 00096 TimePeriodType GetExpirationTime() const; 00097 00098 00106 bool IsValidAtTime( TimePeriodType milliseconds ) const; 00107 00111 bool IsValidNow( ) const; 00112 00113 void Print(std::ostream& os, itk::Indent indent) const; 00114 00115 protected: 00116 00117 void PrintHeader(std::ostream& os, itk::Indent indent) const; 00118 00119 void PrintTrailer(std::ostream& itkNotUsed(os), 00120 itk::Indent itkNotUsed(indent)) const; 00121 00123 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; 00124 00125 00126 private: 00127 00128 TimePeriodType m_StartTime; 00129 TimePeriodType m_ExpirationTime; 00130 00131 }; 00132 00133 std::ostream& operator<<(std::ostream& os, const TimeStamp& o); 00134 00135 } 00136 00137 #endif