X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=include%2Ftrace.h;h=ab532942b4939a2c416374d24527dd720991c93b;hp=20e3186e8cc70164c98c81f10b04c154b8eb736f;hb=1a050c98763fbbc0662731b0b76953acede6f5d7;hpb=7ef485116d6859eb1e31753b3e3a89de44985272 diff --git a/include/trace.h b/include/trace.h index 20e3186..ab53294 100644 --- a/include/trace.h +++ b/include/trace.h @@ -1,61 +1,78 @@ +/***************************************************************************** +** FILE IDENTIFICATION +** +** Name: trace.h +** Purpose: Header file for Trace class +** Author: Kevin Rosenberg +** Date Started: Oct 2000 +** +** This is part of the CTSim program +** Copyright (c) 1983-2001 Kevin Rosenberg +** +** $Id$ +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License (version 2) as +** published by the Free Software Foundation. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +******************************************************************************/ + #ifndef TRACE_H #define TRACE_H -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 */ -}; - -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"; -class TraceLevel +class Trace { public: - TraceLevel (const char* const traceString); + static const int TRACE_INVALID; + static const int TRACE_NONE; + static const int TRACE_CONSOLE; + static const int TRACE_PHANTOM; + static const int TRACE_PROJECTIONS; + static const int TRACE_PLOT; + static const int TRACE_CLIPPING; + + static const int BIT_CONSOLE; + static const int BIT_PHANTOM; + static const int BIT_PROJECTIONS; + static const int BIT_PLOT; + static const int BIT_CLIPPING; + + Trace (const char* const traceString); + + void addTrace (const char* const traceString); - addTrace (const char* const traceString); + bool isTrace (const char* const traceQuery) const; - bool isTrace (const char* const traceQuery) const; + int getTraceLevel(void) const { return m_traceLevel; } + + static int convertTraceNameToID (const char* traceName); + static const char* convertTraceIDToTitle (int idTrace); + static const char* convertTraceIDToName (int idTrace); + + static const int getTraceCount() {return s_iTraceCount;} + static const char** getTraceNameArray() {return s_aszTraceName;} + static const char** getTraceTitleArray() {return s_aszTraceTitle;} private: - bool addTraceElements (const char* const traceString); -}; + int m_traceLevel; + bool addTraceElements (const char* const traceString); -inline int -opt_set_trace (const char *traceString) -{ - int traceID; - - if (strcasecmp (traceString, TRACE_NONE_STR) == 0) - traceID = TRACE_NONE; - else if (strcasecmp (traceString, TRACE_TEXT_STR) == 0) - traceID = TRACE_TEXT; - else if (strcasecmp (traceString, TRACE_PHM_STR) == 0) - traceID = TRACE_PHM; - else if (strcasecmp (traceString, TRACE_PLOT_STR) == 0) - traceID = TRACE_PLOT; - else if (strcasecmp (traceString, TRACE_CLIPPING_STR) == 0) - traceID = TRACE_CLIPPING; - else if (strcasecmp (traceString, TRACE_RAYS_STR) == 0) - traceID = TRACE_RAYS; - else { - sys_error(ERR_WARNING,"Invalid trace option %s\n", traceString); - traceID = -1; - } - - return (traceID); -} + static const char* s_aszTraceName[]; + static const char* s_aszTraceTitle[]; + static const int s_iTraceCount; + +}; #endif