Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

exotkTrace.cxx

Go to the documentation of this file.
00001 
00002 //   exotkTrace.cxx
00004 //    Copyright (C) 2001  Stephane Routelous
00005 //
00006 //    This file is part of exoTK.
00007 //
00008 //    exoTK is free software; you can redistribute it and/or modify
00009 //    it under the terms of the GNU General Public License as published by
00010 //    the Free Software Foundation; either version 2 of the License, or
00011 //    (at your option) any later version.
00012 //
00013 //    exoTK is distributed in the hope that it will be useful,
00014 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 //    GNU General Public License for more details.
00017 //
00018 //    You should have received a copy of the GNU General Public License
00019 //    along with exoTK; if not, write to the Free Software
00020 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 
00028 #include <exotkTrace.hxx>
00029 #ifndef  _exotkTrace_Root_HeaderFile
00030 #include <exotkTrace_Root.hxx>
00031 #endif
00032 #ifndef  _exotkTrace_Level_HeaderFile
00033 #include <exotkTrace_Level.hxx>
00034 #endif
00035 #ifndef  _TCollection_AsciiString_HeaderFile
00036 #include <TCollection_AsciiString.hxx>
00037 #endif
00038 #include <stdarg.h>
00039 #include <stdio.h>
00040 
00046 namespace exotkTrace_Datas
00047 {
00049         Handle_exotkTrace_Root theRoot;
00050 };
00051 
00052 
00053 //==================================================================================
00054 // Function name        : exotkTrace::SetLevel
00055 //==================================================================================
00056 // Written by       : Stephane Routelous - 2001-12-29 00:47:28
00057 // Description      : 
00058 // Return type          : void 
00059 //==================================================================================
00060 // Argument         : const enum exotkTrace_Level aLevel
00061 void exotkTrace::SetLevel(const enum exotkTrace_Level aLevel)
00062 {
00063         if ( !exotkTrace_Datas::theRoot.IsNull() )
00064         {
00065                 exotkTrace_Datas::theRoot->SetLevel(aLevel);
00066         }
00067 }
00068 
00069 //==================================================================================
00070 // Function name        : exotkTrace::Level
00071 //==================================================================================
00072 // Written by       : Stephane Routelous - 2001-12-29 00:47:29
00073 // Description      : 
00074 // Return type          : exotkTrace_Level 
00075 //==================================================================================
00076 exotkTrace_Level exotkTrace::Level()
00077 {
00078         if ( exotkTrace_Datas::theRoot.IsNull() )
00079                 return exotkTrace_Unknown;
00080         else
00081                 return exotkTrace_Datas::theRoot->Level();
00082 }
00083 
00084 //==================================================================================
00085 // Function name        : exotkTrace::SetHandler
00086 //==================================================================================
00087 // Written by       : Stephane Routelous - 2001-12-29 00:47:31
00088 // Description      : 
00089 // Return type          : void 
00090 //==================================================================================
00091 // Argument         : const Handle_exotkTrace_Root& anHandler
00092 void exotkTrace::SetHandler(const Handle_exotkTrace_Root& anHandler)
00093 {
00094         exotkTrace_Datas::theRoot = anHandler;
00095 }
00096 
00097 //==================================================================================
00098 // Function name        : exotkTrace::Handler
00099 //==================================================================================
00100 // Written by       : Stephane Routelous - 2001-12-29 00:47:33
00101 // Description      : 
00102 // Return type          : Handle_exotkTrace_Root 
00103 //==================================================================================
00104 Handle_exotkTrace_Root exotkTrace::Handler()
00105 {
00106         return exotkTrace_Datas::theRoot;
00107 }
00108 
00109 
00110 //==================================================================================
00111 // Function name        : exotkTrace::TraceLevelToAsciiString
00112 //==================================================================================
00113 // Written by       : Stephane Routelous - 2001-12-29 00:47:36
00114 // Description      : 
00115 // Return type          : TCollection_AsciiString 
00116 //==================================================================================
00117 // Argument         : const enum exotkTrace_Level aLevel
00118 TCollection_AsciiString exotkTrace::TraceLevelToAsciiString(const enum exotkTrace_Level aLevel)
00119 {
00120         TCollection_AsciiString theString;
00121         switch ( aLevel )
00122         {
00123         case exotkTrace_Quiet:
00124                 theString = TCollection_AsciiString("[ quiet ]");
00125                 break;
00126         case exotkTrace_Error:
00127                 theString = TCollection_AsciiString("[ error ]");
00128                 break;
00129         case exotkTrace_Warning:
00130                 theString = TCollection_AsciiString("[warning]");
00131                 break;
00132         case exotkTrace_Info:
00133                 theString = TCollection_AsciiString("[ info  ]");
00134                 break;
00135         case exotkTrace_Verbose:
00136                 theString = TCollection_AsciiString("[verbose]");
00137                 break;
00138         case exotkTrace_Debug:
00139                 theString = TCollection_AsciiString("[ debug ]");
00140                 break;
00141         default:
00142                 break;
00143         }
00144         return theString;
00145 }
00146 
00147 
00148 //==================================================================================
00149 // Function name        : exotkTrace::Debug
00150 //==================================================================================
00151 // Written by       : Stephane Routelous - 2002-01-10 16:11:43
00152 // Description      : 
00153 // Return type          : void 
00154 //==================================================================================
00155 // Argument         : char* aFormat
00156 // Argument         : ...
00157 void exotkTrace::Debug(char* aFormat,...)
00158 {
00159         if ( !exotkTrace_Datas::theRoot.IsNull() )
00160         {
00161                 char Line[2048];
00162                 va_list ArgPtr;
00163                 
00164                 va_start(ArgPtr, aFormat);
00165                 
00166                 vsprintf(Line, aFormat, ArgPtr);
00167                 va_end(ArgPtr);
00168                 exotkTrace_Datas::theRoot->Debug(Line);
00169         }
00170 }
00171 void exotkTrace::Verbose(char* aFormat,...)
00172 {
00173         if ( !exotkTrace_Datas::theRoot.IsNull() )
00174         {
00175                 char Line[2048];
00176                 va_list ArgPtr;
00177                 
00178                 va_start(ArgPtr, aFormat);
00179                 
00180                 vsprintf(Line, aFormat, ArgPtr);
00181                 va_end(ArgPtr);
00182                 exotkTrace_Datas::theRoot->Verbose(Line);
00183         }
00184 }
00185 void exotkTrace::Error(char* aFormat,...)
00186 {
00187         if ( !exotkTrace_Datas::theRoot.IsNull() )
00188         {
00189                 char Line[2048];
00190                 va_list ArgPtr;
00191                 
00192                 va_start(ArgPtr, aFormat);
00193                 
00194                 vsprintf(Line, aFormat, ArgPtr);
00195                 va_end(ArgPtr);
00196                 exotkTrace_Datas::theRoot->Error(Line);
00197         }
00198 }
00199 void exotkTrace::Warning(char* aFormat,...)
00200 {
00201         if ( !exotkTrace_Datas::theRoot.IsNull() )
00202         {
00203                 char Line[2048];
00204                 va_list ArgPtr;
00205                 
00206                 va_start(ArgPtr, aFormat);
00207                 
00208                 vsprintf(Line, aFormat, ArgPtr);
00209                 va_end(ArgPtr);
00210                 exotkTrace_Datas::theRoot->Warning(Line);
00211         }
00212 }
00213 void exotkTrace::Quiet(char* aFormat,...)
00214 {
00215         if ( !exotkTrace_Datas::theRoot.IsNull() )
00216         {
00217                 char Line[2048];
00218                 va_list ArgPtr;
00219                 
00220                 va_start(ArgPtr, aFormat);
00221                 
00222                 vsprintf(Line, aFormat, ArgPtr);
00223                 va_end(ArgPtr);
00224                 exotkTrace_Datas::theRoot->Quiet(Line);
00225         }
00226 }
00227 void exotkTrace::Info(char* aFormat,...)
00228 {
00229         if ( !exotkTrace_Datas::theRoot.IsNull() )
00230         {
00231                 char Line[2048];
00232                 va_list ArgPtr;
00233                 
00234                 va_start(ArgPtr, aFormat);
00235                 
00236                 vsprintf(Line, aFormat, ArgPtr);
00237                 va_end(ArgPtr);
00238                 exotkTrace_Datas::theRoot->Info(Line);
00239         }
00240 }

Generated on Wed Jan 23 12:16:43 2002 for exotk by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001