freValidityTag.cxx

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   F.R.E.E. - flexible registration evaluation engine
00004   Version:   v.1.0.0
00005   Date:      $Date: 2006/09/01 12:00:00 $
00006   Module:    $RCSfile: freValidityTag.cxx,v $
00007   Language:  C++
00008 
00009 
00010   Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics,
00011   Institute for Medical Biometry and Informatics, University of Heidelberg,
00012   Germany). All rights reserved.
00013   See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm
00014   for details.
00015 
00016      This software is distributed WITHOUT ANY WARRANTY; without even 
00017      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00018      PURPOSE.  See the above copyright notices for more information.
00019 
00020 =========================================================================*/
00021 #include "freValidityTag.h"
00022 
00023 #include "freConvert.h"
00024 
00025 namespace FREE
00026 {
00027 
00031 
00032 ValidityTag::Pointer
00033 ValidityTag::
00034 New(const ValidityTag& tag)
00035 {
00036   Pointer smpTag = New();
00037   smpTag->SetTag(tag);
00038   return smpTag;
00039 };
00040 
00041 ValidityTag::Pointer
00042 ValidityTag::
00043 New(const TagType& tag)
00044 {
00045   Pointer smpTag = New();
00046   smpTag->SetTimeStamp(tag);
00047   return smpTag;
00048 };
00049 
00050 ValidityTag::Pointer
00051 ValidityTag::
00052 NewNull()
00053 {
00054   Pointer smpTag = New();
00055   smpTag->SetTimeStamp(0);
00056   return smpTag;
00057 };
00058 
00059 bool
00060 ValidityTag::
00061 IsOutdated(const ValidityTag& referenceTag) const
00062 {
00063   return m_Tag<referenceTag.GetTimeStamp();
00064 };
00065 
00066 bool
00067 ValidityTag::
00068 IsUpdated(const ValidityTag& referenceTag) const
00069 {
00070   return m_Tag>=referenceTag.GetTimeStamp();
00071 };
00072 
00073 bool
00074 ValidityTag::
00075 Equals(const ValidityTag& referenceTag) const
00076 {
00077   return m_Tag==referenceTag.GetTimeStamp();
00078 };
00079 
00080 bool
00081 ValidityTag::
00082 IsOutdated(const ValidityTag* pReferenceTag) const
00083 {
00084   if (!pReferenceTag) throwStaticExceptionMacro("Passed reference ValidityTag is Null; unable to check tag.");
00085   return IsOutdated(*pReferenceTag);
00086 };
00087 
00088 bool
00089 ValidityTag::
00090 IsUpdated(const ValidityTag* pReferenceTag) const
00091 {
00092   if (!pReferenceTag) throwStaticExceptionMacro("Passed reference ValidityTag is Null; unable to check tag.");
00093   return IsUpdated(*pReferenceTag);
00094 };
00095 
00096 bool
00097 ValidityTag::
00098 Equals(const ValidityTag* pReferenceTag) const
00099 {
00100   if (!pReferenceTag) throwStaticExceptionMacro("Passed reference ValidityTag is Null; unable to check tag.");
00101   return Equals(*pReferenceTag);
00102 };
00103 
00104 void
00105 ValidityTag::
00106 SetTag (const ValidityTag& tag)
00107 {
00108   m_Tag=tag.GetTimeStamp();
00109 };
00110 
00111 void
00112 ValidityTag::
00113 SetTag (const ValidityTag* pTag)
00114 {
00115   if (!pTag) throwStaticExceptionMacro("Passed reference ValidityTag is Null; unable to set tag.");
00116   SetTag(*pTag);
00117 };
00118 
00119 void
00120 ValidityTag::
00121 SetTimeStamp (const TagType& tag)
00122 {
00123   m_Tag=tag;
00124 };
00125 
00126 const ValidityTag::TagType&
00127 ValidityTag::
00128  GetTimeStamp () const
00129 {
00130   return m_Tag;
00131 };
00132 
00133 void
00134 ValidityTag::
00135 Actualize()
00136 {
00137   m_Tag = clock();
00138 };
00139   
00140 ValidityTag::
00141 ValidityTag()
00142 {
00143   Actualize();
00144 };
00145 
00146 } //end of namespace FREE

Generated at Sat Oct 13 18:02:04 2007 for f.r.e.e. - Flexible Registration and Evaluation Engine by doxygen 1.5.3 written by Dimitri van Heesch, © 1997-2000