X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsim%2Ftrace.cpp;h=3fe33f0f3cd0f4924be3a7fcb3a00cef1cb8cf32;hp=dced2c66cd9dd4d3bdb40b145730f804b6c5fa54;hb=ca7c001fce978b680543f8338a404b8c0701a935;hpb=1e88cf0f7fa4f690ea9f110e8ed3f2b5338d0a10 diff --git a/libctsim/trace.cpp b/libctsim/trace.cpp index dced2c6..3fe33f0 100644 --- a/libctsim/trace.cpp +++ b/libctsim/trace.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: trace.cpp,v 1.2 2000/08/25 15:59:13 kevin Exp $ +** $Id: trace.cpp,v 1.3 2000/08/27 20:32:55 kevin Exp $ ** ** 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 @@ -26,33 +26,76 @@ #include "ct.h" -const char TraceLevel::TRACE_NONE_STR[]= "none"; -const char TraceLevel::TRACE_TEXT_STR[]= "text"; -const char TraceLevel::TRACE_PHM_STR[]= "phm"; -const char TraceLevel::TRACE_RAYS_STR[]= "rays"; -const char TraceLevel::TRACE_PLOT_STR[]= "plot"; -const char TraceLevel::TRACE_CLIPPING_STR[]= "clipping"; +const int Trace::TRACE_INVALID = -1; +const int Trace::TRACE_NONE = 0; +const int Trace::TRACE_CONSOLE = 1; +const int Trace::TRACE_PHANTOM = 2; +const int Trace::TRACE_PROJECTIONS = 3; +const int Trace::TRACE_PLOT = 4; +const int Trace::TRACE_CLIPPING = 5; +const int Trace::BIT_CONSOLE = 0x0001; +const int Trace::BIT_PHANTOM = 0x0002; +const int Trace::BIT_PROJECTIONS = 0x0004; +const int Trace::BIT_PLOT = 0x0008; +const int Trace::BIT_CLIPPING = 0x0010; -int -TraceLevel::convertTraceNameToID (const char *traceString) +const char* Trace::s_aszTraceName[] = +{ + {"none"}, + {"console"}, + {"phantom"}, + {"proj"}, + {"plot"}, + {"clipping"}, +}; + +const char* Trace::s_aszTraceTitle[] = +{ + {"None"}, + {"Console"}, + {"Phantom"}, + {"Projections"}, + {"Plot"}, + {"Clipping"}, +}; + +const int Trace::s_iTraceCount = sizeof(s_aszTraceName) / sizeof(const char*); + + +const char* +Trace::convertTraceIDToName (const int idTrace) +{ + const char *name = ""; + + if (idTrace >= 0 && idTrace < s_iTraceCount) + return (s_aszTraceName[idTrace]); + + return (name); +} + +const char* +Trace::convertTraceIDToTitle (const int idTrace) { - int traceID = TRACE_INVALID; - - 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; - - return (traceID); + const char *title = ""; + + if (idTrace >= 0 && idTrace < s_iTraceCount) + return (s_aszTraceName[idTrace]); + + return (title); } + +int +Trace::convertTraceNameToID (const char* const traceName) +{ + int id = Trace::TRACE_INVALID; + for (int i = 0; i < s_iTraceCount; i++) + if (strcasecmp (traceName, s_aszTraceName[i]) == 0) { + id = i; + break; + } + + return (id); +}