Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlTimeStamp.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Open IGT Link Library
00004   Module:    $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink/Source/igtlTimeStamp.h $
00005   Language:  C++
00006   Date:      $Date: 2011-03-24 00:08:23 -0400 (Thu, 24 Mar 2011) $
00007   Version:   $Revision: 7354 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010 
00011   This software is distributed WITHOUT ANY WARRANTY; without even
00012   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00013   PURPOSE.  See the above copyright notices for more information.
00014 
00015 =========================================================================*/
00016 
00017 #ifndef __igtlTimeStamp_h
00018 #define __igtlTimeStamp_h
00019 
00020 #include "igtlMacro.h"
00021 #include "igtlObject.h"
00022 #include "igtlObjectFactory.h"
00023 #include "igtlTypes.h"
00024 
00025 #if defined(WIN32) || defined(_WIN32)
00026 #include <ctime>
00027 #endif
00028 
00029 namespace igtl
00030 {
00031 
00032 class IGTLCommon_EXPORT TimeStamp : public Object
00033 {
00034 public:
00035   typedef TimeStamp                  Self;
00036   typedef Object                     Superclass;
00037   typedef SmartPointer< Self >       Pointer;
00038   typedef SmartPointer< const Self > ConstPointer;
00039 
00040   igtlTypeMacro(TimeStamp, Object);
00041   igtlNewMacro(Self);
00042 
00044   igtlGetConstMacro(Frequency,  igtlUint32);
00045   igtlGetConstMacro(Second,     igtlUint32);
00046   igtlGetConstMacro(Nanosecond, igtlUint32);
00048 
00049   void   GetTime();
00050   void   SetTime(double tm);
00051   void   SetTime(igtlUint32 second, igtlUint32 nanosecond);
00052   void   SetTime(igtlUint64 tm);  /* 64-bit fixed-point expression used in OpenIGTLink */
00053 
00054   double GetTimeStamp();
00055   void   GetTimeStamp(igtlUint32* second, igtlUint32* nanosecond);
00056   igtlUint64 GetTimeStampUint64();     /* 64-bit fixed-point expression used in OpenIGTLink */
00057 
00058 
00059 protected:
00060 
00062   TimeStamp();
00063 
00065   virtual ~TimeStamp();
00066 
00068   virtual void PrintSelf( std::ostream& os) const;
00069 
00070 private:
00071 
00072   igtlInt32       m_Frequency;   /* Clock frequency (Hz)*/
00073   igtlInt32       m_Second;      /* Second part of the time relative to 00:00:00 January 1, 1970 UTC */
00074   igtlInt32       m_Nanosecond;  /* Nano-second part of -- */
00075 
00076 
00077 #if defined(WIN32) || defined(_WIN32)
00078   //typedef double        TimeStampType;
00079   //typedef double        FrequencyType;
00080   //
00081   //FrequencyType   m_WinFrequency;
00082   //TimeStampType   m_WinDifference;
00083   //TimeStampType   m_WinOrigin;
00084 
00085   time_t  m_WinTimeOrigin;
00086   clock_t m_WinClockOrigin;
00087 
00088 #endif
00089 
00090 };
00091 
00092 } // end of namespace igtl
00093 
00094 #endif  // __igtlTimeStamp_h
00095 
00096 
00097 

Generated at Wed Apr 27 2011 00:08:07 for OpenIGTLink by doxygen 1.7.4 written by Dimitri van Heesch, © 1997-2000