| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkTimeStamp.cxx.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 |
DEF |
=========================================================================*/ |
| 20 |
|
#include "itkTimeStamp.h" |
| 21 |
|
#include "itkFastMutexLock.h" |
| 22 |
|
|
| 23 |
|
namespace itk |
| 24 |
|
{ |
| 25 |
|
|
| 26 |
|
/** |
| 27 |
|
* Instance creation. |
| 28 |
|
*/ |
| 29 |
|
TimeStamp* |
| 30 |
|
TimeStamp |
| 31 |
|
::New() |
| 32 |
|
{ |
| 33 |
|
return new Self; |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
/** Used for mutex locking */ |
| 37 |
|
static SimpleFastMutexLock TimeStampMutex; |
| 38 |
|
|
| 39 |
|
/** |
| 40 |
|
* Make sure the new time stamp is greater than all others so far. |
| 41 |
|
*/ |
| 42 |
|
void |
| 43 |
|
TimeStamp |
| 44 |
|
::Modified() |
| 45 |
|
{ |
| 46 |
|
/** |
| 47 |
|
* Initialize static member |
| 48 |
|
*/ |
| 49 |
|
static unsigned long itkTimeStampTime = 0; |
| 50 |
|
|
| 51 |
|
TimeStampMutex.Lock(); |
| 52 |
|
m_ModifiedTime = ++itkTimeStampTime; |
| 53 |
|
TimeStampMutex.Unlock(); |
| 54 |
|
} |
| 55 |
|
|
| 56 |
|
} // end namespace itk |
| 57 |
|
|