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

exotkTrace_Root.cxx

Go to the documentation of this file.
00001 
00002 //   exotkTrace_Root.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_Root.hxx>
00029 #ifndef  _exotkTrace_Level_HeaderFile
00030 #include <exotkTrace_Level.hxx>
00031 #endif
00032 #ifndef  _exotkTrace_LogMessage_HeaderFile
00033 #include <exotkTrace_LogMessage.hxx>
00034 #endif
00035 
00036 //
00037 IMPLEMENT_STANDARD_HANDLE(exotkTrace_Root, MMgt_TShared)
00038 IMPLEMENT_STANDARD_RTTI(exotkTrace_Root, MMgt_TShared)
00039 //
00040 // Foreach ancestors, we add a IMPLEMENT_STANDARD_SUPERTYPE and 
00041 // a IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY macro.
00042 // We must respect the order: from the direct ancestor class
00043 // to the base class.
00044 //
00045 
00046 IMPLEMENT_STANDARD_TYPE(exotkTrace_Root)
00047 IMPLEMENT_STANDARD_SUPERTYPE(MMgt_TShared) 
00048 IMPLEMENT_STANDARD_SUPERTYPE(Standard_Transient)
00049 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY()
00050 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(MMgt_TShared)
00051 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(Standard_Transient)
00052 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END()
00053 IMPLEMENT_STANDARD_TYPE_END(exotkTrace_Root)
00054 
00055 
00056 //==================================================================================
00057 // Function name        : exotkTrace_Root::exotkTrace_Root
00058 //==================================================================================
00059 // Written by       : Stephane Routelous - 2001-12-29 00:49:09
00060 // Description      : 
00061 // Return type          : 
00062 //==================================================================================
00063 exotkTrace_Root::exotkTrace_Root()
00064 {
00065         myLevel = exotkTrace_Verbose;
00066 }
00067 
00068 
00069 //==================================================================================
00070 // Function name        : exotkTrace_Root::~exotkTrace_Root
00071 //==================================================================================
00072 // Written by       : Stephane Routelous - 2001-12-29 00:49:10
00073 // Description      : 
00074 // Return type          : 
00075 //==================================================================================
00076 exotkTrace_Root::~exotkTrace_Root()
00077 {
00078 
00079 }
00080 
00081 
00082 //==================================================================================
00083 // Function name        : exotkTrace_Root::SetLevel
00084 //==================================================================================
00085 // Written by       : Stephane Routelous - 2001-12-29 00:49:12
00086 // Description      : 
00087 // Return type          : exotkTrace_Level 
00088 //==================================================================================
00089 // Argument         : const enum exotkTrace_Level aLevel
00090 exotkTrace_Level exotkTrace_Root::SetLevel(const enum exotkTrace_Level aLevel)
00091 {
00092         exotkTrace_Level theOldLevel = myLevel;
00093         myLevel = aLevel;
00094         return theOldLevel;
00095 }
00096 
00097 
00098 //==================================================================================
00099 // Function name        : exotkTrace_Root::Level
00100 //==================================================================================
00101 // Written by       : Stephane Routelous - 2001-12-29 00:49:14
00102 // Description      : 
00103 // Return type          : exotkTrace_Level 
00104 //==================================================================================
00105 exotkTrace_Level exotkTrace_Root::Level()
00106 {
00107         return myLevel;
00108 }
00109 
00110 //==================================================================================
00111 // Function name        : exotkTrace_Root::Trace
00112 //==================================================================================
00113 // Written by       : Stephane Routelous - 2001-12-29 00:49:15
00114 // Description      : 
00115 // Return type          : void 
00116 //==================================================================================
00117 // Argument         : const enum exotkTrace_Level aLevel
00118 // Argument         : const Standard_CString aString
00119 void exotkTrace_Root::Trace(const enum exotkTrace_Level aLevel,const Standard_CString aString)
00120 {
00121         if ( !IsValid() )
00122         {
00123                 exotkTrace_LogMessage theLogMessage;
00124                 theLogMessage.SetValues(aLevel,aString);
00125                 myQueue.Push(theLogMessage);
00126         }
00127         else
00128         {
00129                 TraceQueue();
00130                 if ( aLevel <= myLevel )
00131                 {
00132                         Print(aLevel,aString);
00133                 }
00134         }
00135 }
00136 
00137 
00138 //==================================================================================
00139 // Function name        : exotkTrace_Root::TraceQueue
00140 //==================================================================================
00141 // Written by       : Stephane Routelous - 2001-12-29 00:49:18
00142 // Description      : 
00143 // Return type          : void 
00144 //==================================================================================
00145 void exotkTrace_Root::TraceQueue()
00146 {
00147         if ( !myQueue.IsEmpty() )
00148         {
00149                 if ( IsValid() )
00150                 {
00151                         do
00152                         {
00153                                 exotkTrace_LogMessage theLogMessage = myQueue.Front();
00154                                 exotkTrace_Level theLevel;
00155                                 TCollection_AsciiString theMessage;
00156                                 theLogMessage.Values(theLevel,theMessage);
00157                                 if ( theLevel!=exotkTrace_Unknown )
00158                                 {
00159                                         if ( theLevel <= myLevel )
00160                                         {
00161                                                 Print(theLevel,theMessage.ToCString());
00162                                         }
00163 
00164                                 }
00165                                 myQueue.Pop();
00166                         }
00167                         while(!myQueue.IsEmpty() );
00168                 }
00169         }
00170 }

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