21, m_Time(-1.0), m_ReferenceTime(0.0)
48 if (m_RealTimeClock.IsNull())
52 if ( s_Instance.IsNotNull() )
54 if (m_DeviceMap.empty())
56 m_ReferenceTime = GetCurrentStamp();
59 m_DeviceMap.insert( std::pair<itk::Object::Pointer, double>(device, this->GetElapsed()) );
63 itkGenericOutputMacro(
"Trying to use mitk::TimeStamp::Start() "
64 <<
"without an available singleton instance. Either no instance has "
65 <<
"been created (use TimeStamp::CreateInstance) or it has already "
66 <<
"been destroyed.");
72 if ( s_Instance.IsNotNull() )
74 m_MapIterator = m_DeviceMap.find(device);
75 if ( m_MapIterator != m_DeviceMap.end() )
77 m_DeviceMap.erase( m_MapIterator );
80 if (m_DeviceMap.empty())
88 itkGenericOutputMacro(
"Trying to use mitk::TimeStamp::Stop() "
89 <<
"without an available singleton instance. Either no instance has "
90 <<
"been created (use TimeStamp::CreateInstance) or it has already "
91 <<
"been destroyed.");
100 m_Time = GetCurrentStamp();
101 m_Time = m_Time - m_ReferenceTime;
103 return (
double) m_Time;
109 double offset = this->GetOffset( device );
112 double time = this->GetElapsed();
113 return (
double) time - this->GetOffset(device);
123 if (m_RealTimeClock.IsNotNull())
125 return m_RealTimeClock->GetCurrentStamp();
132 m_RealTimeClock = Clock;
137 m_MapIterator = m_DeviceMap.find(Device);
138 if ( m_MapIterator != m_DeviceMap.end() )
140 return m_MapIterator->second;
150 if ( m_RealTimeClock.IsNull() )
Time stamp in milliseconds.
static IGTTimeStamp * CreateInstance()
creates a new instance of mitkTimeStamp
static IGTTimeStamp * GetInstance()
returns a pointer to the current instance of mitkTimeStamp
static mitk::IGTTimeStamp::Pointer s_Instance
void Start(itk::Object::Pointer device)
starts the time-acquisition
void Stop(itk::Object::Pointer device)
stops the time-acqusition
void Initialize()
creates a new RealTimeClock
double GetElapsed()
returns the time elapsed since calling Start() for the first time in milliseconds
void SetRealTimeClock(mitk::RealTimeClock::Pointer Clock)
setter for the internally used RealTimeClock()
double GetOffset(itk::Object::Pointer Device)
returns the offset of this device's starting-time to the reference-time in ms
static Pointer New(void)
instanciates a new, operating-system dependant, instance of mitk::RealTimeClock.