KWStyle - itkTimeStamp.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkTimeStamp.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:48 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12   Portions of this code are covered under the VTK copyright.
13   See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
14
15      This software is distributed WITHOUT ANY WARRANTY; without even 
16      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
17 IND *****PURPOSE.  See the above copyright notices for more information.
18
19 =========================================================================*/
20 #ifndef __itkTimeStamp_h
21 #define __itkTimeStamp_h
22
23 #include "itkMacro.h"
24
25 namespace itk
26 {
27
28 /** \class TimeStamp
29  * \brief Generate a unique, increasing time value.
30  *
31  * TimeStamp records a unique time when the method Modified() is 
32  * executed. This time is guaranteed to be monotonically increasing.
33  * Classes use this object to record modified and/or execution time.
34  * There is built in support for the binary < and > comparison
35  * operators between two TimeStamp objects. 
36  *
37  * \ingroup ITKSystemObjects
38  */
39 class ITKCommon_EXPORT TimeStamp 
40 {
41 public:
42   /** Standard class typedefs. */
43   typedef TimeStamp  Self;
44   
45   /** Create an instance of this class. We don't want to use reference
46    * counting. */
47   static Self* New();
48
49   /** Constructor must remain public because classes instantiate
50    * TimeStamps implicitly in their construction.  */
51   TimeStamp() 
52     {m_ModifiedTime = 0;}
53
54   /** Destoy this instance. */
55   void Delete() 
56     {delete this;}
57
58   /** The class name as a string.  */
59   static const char *GetNameOfClass() 
60     {return "TimeStamp";}
61
62   /** Set this objects time to the current time. The current time is just a
63    * monotonically increasing unsigned long integer. It is possible for this
64    * number to wrap around back to zero.  This should only happen for
65    * processes that have been running for a very long time, while constantly
66    * changing objects within the program. When this does occur, the typical
67    * consequence should be that some filters will update themselves when
68    * really they don't need to.   */
69   void Modified();
70
71   /** Return this object's Modified time.  */
72   unsigned long int GetMTime() const
73     {return m_ModifiedTime;};
74
75   /** Support comparisons of time stamp objects directly.  */
76   int operator>(TimeStamp& ts) 
77     {return (m_ModifiedTime > ts.m_ModifiedTime);}
78   int operator<(TimeStamp& ts) 
79     {return (m_ModifiedTime < ts.m_ModifiedTime);}
80
81   /** Allow for typcasting to unsigned long.  */
82   operator unsigned long() const
83     {return m_ModifiedTime;}
84
85 private:
86   unsigned long m_ModifiedTime;
87 };
88
89   
90 // end namespace itk
91   
92 #endif
93

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:50PM
© Kitware Inc.