X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=libctsim%2Ftrace.cpp;h=5caa3849f799737718db687b62d59c389a654a6a;hb=a4501a7fb46ba0a87303add92d06ea400e21fec5;hp=dced2c66cd9dd4d3bdb40b145730f804b6c5fa54;hpb=1e88cf0f7fa4f690ea9f110e8ed3f2b5338d0a10;p=ctsim.git diff --git a/libctsim/trace.cpp b/libctsim/trace.cpp index dced2c6..5caa384 100644 --- a/libctsim/trace.cpp +++ b/libctsim/trace.cpp @@ -1,14 +1,14 @@ /***************************************************************************** ** FILE IDENTIFICATION ** -** Name: trace.cpp Class for trace +** Name: trace.cpp Class for trace ** Programmer: Kevin Rosenberg ** Date Started: June 2000 ** ** 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$ ** ** 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) { - 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 *name = ""; + + if (idTrace >= 0 && idTrace < s_iTraceCount) + return (s_aszTraceName[idTrace]); + + return (name); } +const char* +Trace::convertTraceIDToTitle (const int idTrace) +{ + 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); +}