Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages | Examples

ColCOWS_Debug.cc

00001 //===========================================================================//
00002 //    
00003 //    Description: Debug output Management
00004 //    Filename: colcows/ColCOWS_Debug.cc
00005 //    Authors: Michael Dussere and Aurélien Esnard
00006 //    
00007 //===========================================================================//
00008 //    
00009 //    Copyright (C) 2003 INRIA and CNRS
00010 //    
00011 //    This library is free software; you can redistribute it and/or
00012 //    modify it under the terms of the GNU Lesser General Public
00013 //    License as published by the Free Software Foundation; either
00014 //    version 2.1 of the License, or (at your option) any later version.
00015 //    
00016 //    This library is distributed in the hope that it will be useful,
00017 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 //    Lesser General Public License for more details.
00020 //    
00021 //    You should have received a copy of the GNU Lesser General Public
00022 //    License along with this library; if not, write to the Free Software
00023 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024 //    
00025 //===========================================================================//
00026 
00027 #include "ColCOWS_Debug.hh"
00028 #include "ColCOWS_Include.hh"
00029 #include "ColCOWS_Corba.hh"
00030 
00031 __COLCOWS_BEGIN__
00032 
00033 //------------------------------------------------------------------------
00034 // ColCOWS Debug
00035 //------------------------------------------------------------------------
00036 
00037 // bool _DebugInitialized = false;
00038 int  _DebugTraceLevel =  COLCOWS_DEBUG_LEVEL_DEFAULT;
00039 bool _DebugInitialized = InitDebug();
00040 
00041 //------------------------------------------------------------------------
00042 
00043 bool InitDebug() { 
00044   
00045   char * debugTraceLevel = getenv (COLCOWS_DEBUG_LEVEL_VARIABLE);
00046 
00047   if ((debugTraceLevel != NULL) && (atoi(debugTraceLevel) >= 0)) {
00048     //    COLCOWS_DEBUG( dblAccessory, "variable " << COLCOWS_DEBUG_LEVEL_VARIABLE << " was set to " << debugTraceLevel);
00049     _DebugTraceLevel = atoi(debugTraceLevel);
00050     _DebugInitialized = true;
00051   }
00052 
00053   return _DebugInitialized;
00054 }
00055  
00056 //------------------------------------------------------------------------
00057 
00058 char * ColCOWSExceptionKindName[] = { "Generical", 
00059                                       "CorbaException",
00060                                       "NotReady",
00061                                       "BadAssertException"
00062 };
00063 
00064 //------------------------------------------------------------------------
00065 
00066 ColCOWSException::ColCOWSException( CorbaException & ex ) 
00067 {
00068   _kind = cstCorbaException ;
00069   _info = ex.info ;
00070   _file = ex.file ;
00071   _line = ex.line ; 
00072 }
00073 
00074 //------------------------------------------------------------------------
00075 
00076 void ColCOWSException::forwardCorbaException ()
00077 {
00078   CorbaException ex( (int)this->_kind, this->_info.c_str(), this->_file.c_str(), this->_line );
00079   throw ex;
00080 }
00081 
00082 //------------------------------------------------------------------------
00083 
00084 std::ostream& operator <<(std::ostream& stream, const ColCOWSException& ex) {
00085   stream << "ColCOWSException" 
00086          << "("   << ColCOWSExceptionKindName[ex._kind] << ")"
00087          << " : " << ex._info
00088          << " ["  << ex._file << ":" << ex._line << "]";
00089 }
00090 
00091 //------------------------------------------------------------------------
00092 
00093 __COLCOWS_END__

Generated on Tue Jun 21 12:55:56 2005 for ColCOWS by  doxygen 1.4.1