Updated German translation
[dasher.git] / Src / DasherCore / TimeSpan.h
blob6c4b750d75b4838dc9c2e7f7ae0a7e749bd467f2
2 // Object that keeps track of a time span.
3 // Span starts when the object is created, and
4 // ends when someone asks it for its XML representation.
5 // User can also call stop to cause timer to stop and
6 // call for XML representation later.
7 //
8 // Copyright 2005 by Keith Vertanen
10 #ifndef __TIME_SPAN_H__
11 #define __TIME_SPAN_H__
13 #include "FileLogger.h"
14 #include <string>
15 #include "SimpleTimer.h"
16 #include <time.h>
17 #include <vector>
18 #include "XMLUtil.h"
20 using namespace std;
22 extern CFileLogger* g_pLogger;
24 class CTimeSpan;
26 typedef vector<CTimeSpan> VECTOR_TIME_SPAN;
27 typedef vector<CTimeSpan*> VECTOR_TIME_SPAN_PTR;
29 /// \ingroup Logging
30 /// @{
31 class CTimeSpan
33 public:
34 CTimeSpan(const string& strName, bool bAddDate);
35 CTimeSpan(const string& strName, const string& strXML);
37 ~CTimeSpan();
39 void Stop();
40 string GetXML(const string& strPrefix = "", bool bSinglePointInTime = false);
42 void Continue();
43 bool IsStopped();
44 double GetElapsed();
46 static string GetTimeStamp();
47 static string GetDateStamp();
49 private:
50 string m_strName;
51 string m_strStartTime;
52 string m_strEndTime;
53 double m_dElapsed;
54 CSimpleTimer* m_pTimer;
55 string m_strStartDate;
57 void InitMemberVars();
60 /// @}
62 #endif