X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=include%2Ftrace.h;h=88aa2718b0690277b64b863a71f5b607a87edd19;hb=08a5cd04c3994d5ea24713b9b000791bd2e406fe;hp=d302d3c2f7e1f8afa61e73c2e63c66db55d3fdc9;hpb=2d39e823ba389fc68e5317c422b55be006094252;p=ctsim.git diff --git a/include/trace.h b/include/trace.h index d302d3c..88aa271 100644 --- a/include/trace.h +++ b/include/trace.h @@ -1,47 +1,42 @@ #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 */ +enum TraceID { + TRACE_INVALID=-1, + TRACE_NONE=0, /* 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) +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 TraceID convertTraceNameToID (const char* traceName); + + private: + + int m_traceLevel; + + bool addTraceElements (const char* const traceString); +}; #endif