00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __Trace_h_
00009 #define __Trace_h_
00010
00011 #include "Tools/Streams/InOut.h"
00012 #include "Tools/RingBuffer.h"
00013
00014 class Trace;
00015
00016
00017
00018
00019
00020
00021
00022 In& operator>>(In& stream, Trace& trace);
00023
00024
00025
00026
00027
00028
00029
00030 Out& operator<<(Out& stream, const Trace& trace);
00031
00032 class Trace
00033 {
00034 private:
00035
00036
00037
00038 class Line
00039 {
00040 public:
00041 char file[256];
00042 int line;
00043
00044
00045
00046
00047
00048
00049 Line(const char* f = "", int l = 0);
00050 };
00051
00052 RingBuffer<Line, 10> buffer;
00053
00054 public:
00055
00056
00057
00058
00059
00060 void setCurrentLine(const char* file, int line);
00061
00062 friend In& operator>>(In& stream, Trace& trace);
00063 friend Out& operator<<(Out& stream, const Trace& trace);
00064 };
00065
00066
00067
00068
00069
00070 Trace& getTrace();
00071
00072
00073
00074
00075
00076 void setTrace(Trace& t);
00077
00078 #ifdef _WIN32 // On Windows, no trace points are generated
00079 #define GT_TRACE
00080 #else
00081 #ifdef NDEBUG // Neither in the release configuration
00082 #define GT_TRACE
00083 #else // But in debug configurations on the robot
00084 #define GT_TRACE getTrace().setCurrentLine(__FILE__, __LINE__);
00085 #endif
00086 #endif
00087
00088 #endif