IGSTK
igstkTimeStamp.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Image Guided Surgery Software Toolkit
4  Module: $RCSfile: igstkTimeStamp.h,v $
5  Language: C++
6  Date: $Date: 2008-03-20 16:47:43 $
7  Version: $Revision: 1.17 $
8 
9  Copyright (c) ISC Insight Software Consortium. All rights reserved.
10  See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __igstkTimeStamp_h
18 #define __igstkTimeStamp_h
19 
20 
21 #include <iostream>
22 #include "igstkRealTimeClock.h"
23 #include "itkNumericTraits.h"
24 
25 namespace igstk
26 {
27 
55 class TimeStamp
56 {
57 
58 public:
59 
60  typedef double TimePeriodType;
61 
64 
66  static TimePeriodType GetZeroValue();
67 
70 
72  TimeStamp();
73  virtual ~TimeStamp();
74 
75 
77  const TimeStamp & operator=( const TimeStamp & inputTimeStamp );
78 
83  void SetStartTimeNowAndExpireAfter( TimePeriodType millisecondsToExpire);
84 
85 
90 
91 
97 
98 
106  bool IsValidAtTime( TimePeriodType milliseconds ) const;
107 
111  bool IsValidNow( ) const;
112 
113  void Print(std::ostream& os, itk::Indent indent) const;
114 
115 protected:
116 
117  void PrintHeader(std::ostream& os, itk::Indent indent) const;
118 
119  void PrintTrailer(std::ostream& itkNotUsed(os),
120  itk::Indent itkNotUsed(indent)) const;
121 
123  virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
124 
125 
126 private:
127 
128  TimePeriodType m_StartTime;
129  TimePeriodType m_ExpirationTime;
130 
131 };
132 
133 std::ostream& operator<<(std::ostream& os, const TimeStamp& o);
134 
135 }
136 
137 #endif