Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef TRACE_H
00028 #define TRACE_H
00029
00030 #include <vector>
00031
00032 #include "GpCoreToolsDLLExport.h"
00033 #include "TraceStamp.h"
00034
00035 namespace GpCoreTools {
00036
00037
00038 #define TRACE_ENABLED
00039
00040 #ifdef TRACE_ENABLED
00041
00042 #define TRACE \
00043 static TraceStamp _traceStamp_(__PRETTY_FUNCTION__, __LINE__); \
00044 Trace _trace_0(&_traceStamp_);
00045
00046
00047 #define TRACE_N(index) \
00048 static TraceStamp _traceStamp_##index(__PRETTY_FUNCTION__, __LINE__); \
00049 Trace _trace_##index(&_traceStamp_##index);
00050
00051 class GPCORETOOLS_EXPORT Trace
00052 {
00053 public:
00054 Trace(const TraceStamp * stamp);
00055 ~Trace();
00056
00057 static std::vector<const TraceStamp *> * mainStack() {return &_mainStack;}
00058 static std::string backTrace(const std::vector<const TraceStamp *> * stack);
00059 private:
00060 std::vector<const TraceStamp *> * _myStack;
00061 static std::vector<const TraceStamp *> _mainStack;
00062 };
00063
00064 #else
00065 #define TRACE
00066 #endif
00067
00068 }
00069
00070 #endif // TRACE_H