X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=include%2Ftrace.h;h=64826e9a47ab6b5e97ec471b231eff7f1e2e4fec;hp=d302d3c2f7e1f8afa61e73c2e63c66db55d3fdc9;hb=1e88cf0f7fa4f690ea9f110e8ed3f2b5338d0a10;hpb=2d39e823ba389fc68e5317c422b55be006094252 diff --git a/include/trace.h b/include/trace.h index d302d3c..64826e9 100644 --- a/include/trace.h +++ b/include/trace.h @@ -1,47 +1,40 @@ #ifndef TRACE_H #define TRACE_H -// Trace levels -static const char TRACE_NONE_STR[]= "none"; -static const char TRACE_TEXT_STR[]= "text"; -static const char TRACE_PHM_STR[]= "phm"; -static const char TRACE_RAYS_STR[]= "rays"; -static const char TRACE_PLOT_STR[]= "plot"; -static const char TRACE_CLIPPING_STR[]= "clipping"; - -enum { - TRACE_NONE, /* No tracing */ - TRACE_TEXT, /* Minimal status */ - TRACE_PHM, /* Show phantom */ - TRACE_RAYS, /* Show all rays */ - TRACE_PLOT, /* Plot raysums */ - TRACE_CLIPPING /* Plot clipping */ -}; - -inline int -opt_set_trace (const char *optarg) +static const int TRACE_INVALID = 0xFFFF; +static const int TRACE_NONE = 0x0000; +static const int TRACE_TEXT = 0x0001; +static const int TRACE_PHM = 0x0002; +static const int TRACE_RAYS = 0x0004; +static const int TRACE_PLOT = 0x0008; +static const int TRACE_CLIPPING = 0x0010; + +class TraceLevel { - int opt; - - if (strcmp(optarg, TRACE_NONE_STR) == 0) - opt = TRACE_NONE; - else if (strcmp(optarg, TRACE_TEXT_STR) == 0) - opt = TRACE_TEXT; - else if (strcmp(optarg, TRACE_PHM_STR) == 0) - opt = TRACE_PHM; - else if (strcmp(optarg, TRACE_PLOT_STR) == 0) - opt = TRACE_PLOT; - else if (strcmp(optarg, TRACE_CLIPPING_STR) == 0) - opt = TRACE_CLIPPING; - else if (strcmp(optarg, TRACE_RAYS_STR) == 0) - opt = TRACE_RAYS; - else { - sys_error(ERR_WARNING,"Invalid trace option %s\n", optarg); - opt = -1; - } - - return (opt); -} + public: + static const char TRACE_NONE_STR[]; + static const char TRACE_TEXT_STR[]; + static const char TRACE_PHM_STR[]; + static const char TRACE_RAYS_STR[]; + static const char TRACE_PLOT_STR[]; + static const char TRACE_CLIPPING_STR[]; + + TraceLevel (const char* const traceString); + + void addTrace (const char* const traceString); + + bool isTrace (const char* const traceQuery) const; + + int getTraceLevel(void) const { return m_traceLevel; } + + static int convertTraceNameToID (const char* traceName); + + private: + + int m_traceLevel; + + bool addTraceElements (const char* const traceString); +}; #endif