Salome HOME
Base implementation of Notebook
[modules/kernel.git] / src / Logger / SALOME_Trace.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  SALOME Logger : CORBA server managing trace output
23 //  File   : SALOME_Trace.cxx
24 //  Author : Vasily Rusyaev
25 //  Module : SALOME
26 //
27 #if !defined(AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_)
28 #define AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_
29
30 #include <sstream>
31 #include <SALOMEconfig.h>
32 #include "Logger.hh"
33
34 //these declarations for files don't using OCC includes (for example HDF)
35 # ifdef WIN32
36
37 #  ifndef Standard_EXPORT
38 #   define Standard_EXPORT __declspec( dllexport )
39 // For global variables :
40 #   define Standard_EXPORTEXTERN __declspec( dllexport ) extern
41 #   define Standard_EXPORTEXTERNC extern "C" __declspec( dllexport )
42 #  endif  /* Standard_EXPORT */
43
44 #  ifndef Standard_IMPORT
45 #   define Standard_IMPORT __declspec( dllimport ) extern
46 #   define Standard_IMPORTC extern "C" __declspec( dllimport )
47 #  endif  /* Standard_IMPORT */
48
49 # else  /* WIN32 */
50
51 #  ifndef Standard_EXPORT
52 #   define Standard_EXPORT
53 // For global variables :
54 #   define Standard_EXPORTEXTERN extern
55 #   define Standard_EXPORTEXTERNC extern "C"
56 #  endif  /* Standard_EXPORT */
57
58 #  ifndef Standard_IMPORT
59 #   define Standard_IMPORT extern
60 #   define Standard_IMPORTC extern "C"
61 #  endif  /* Standard_IMPORT */
62
63 # endif  /* WIN32 */
64
65 class SALOME_Trace : public std::ostringstream  
66 {
67 public:
68         virtual ~SALOME_Trace();
69         static Standard_EXPORT SALOME_Trace& Instance();
70         // initializes Logger (if USE_LOGGER variable is set) and returns true, in case success
71         int Initialize(CORBA::ORB_ptr theOrb);
72         Standard_EXPORT void putMessage(std::ostream& msg);
73 protected:
74         //disable creation of instances. It's necessary to use static SALOME_Logger& Instance()
75         SALOME_Trace();
76         SALOME_Logger::Logger_var m_pInterfaceLogger;// object reference on Logger server.
77         int isInitialized;
78 };
79
80 #define GLogger SALOME_Trace::Instance()
81
82 #endif // !defined(AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_)