Back to index

salome-kernel  6.5.0
SALOME_Trace.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SALOME Logger : CORBA server managing trace output
00024 //  File   : SALOME_Trace.cxx
00025 //  Author : Vasily Rusyaev
00026 //  Module : SALOME
00027 //
00028 #if !defined(AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_)
00029 #define AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_
00030 
00031 #include <sstream>
00032 #include <SALOMEconfig.h>
00033 #include "Logger.hh"
00034 
00035 //these declarations for files don't using OCC includes (for example HDF)
00036 # ifdef WIN32
00037 
00038 #  ifndef Standard_EXPORT
00039 #   define Standard_EXPORT __declspec( dllexport )
00040 // For global variables :
00041 #   define Standard_EXPORTEXTERN __declspec( dllexport ) extern
00042 #   define Standard_EXPORTEXTERNC extern "C" __declspec( dllexport )
00043 #  endif  /* Standard_EXPORT */
00044 
00045 #  ifndef Standard_IMPORT
00046 #   define Standard_IMPORT __declspec( dllimport ) extern
00047 #   define Standard_IMPORTC extern "C" __declspec( dllimport )
00048 #  endif  /* Standard_IMPORT */
00049 
00050 # else  /* WIN32 */
00051 
00052 #  ifndef Standard_EXPORT
00053 #   define Standard_EXPORT
00054 // For global variables :
00055 #   define Standard_EXPORTEXTERN extern
00056 #   define Standard_EXPORTEXTERNC extern "C"
00057 #  endif  /* Standard_EXPORT */
00058 
00059 #  ifndef Standard_IMPORT
00060 #   define Standard_IMPORT extern
00061 #   define Standard_IMPORTC extern "C"
00062 #  endif  /* Standard_IMPORT */
00063 
00064 # endif  /* WIN32 */
00065 
00066 class SALOME_Trace : public std::ostringstream  
00067 {
00068 public:
00069         virtual ~SALOME_Trace();
00070         static Standard_EXPORT SALOME_Trace& Instance();
00071         // initializes Logger (if USE_LOGGER variable is set) and returns true, in case success
00072         int Initialize(CORBA::ORB_ptr theOrb);
00073         Standard_EXPORT void putMessage(std::ostream& msg);
00074 protected:
00075         //disable creation of instances. It's necessary to use static SALOME_Logger& Instance()
00076         SALOME_Trace();
00077         SALOME_Logger::Logger_var m_pInterfaceLogger;// object reference on Logger server.
00078         int isInitialized;
00079 };
00080 
00081 #define GLogger SALOME_Trace::Instance()
00082 
00083 #endif // !defined(AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_)