Salome HOME
merge from V4_1_0_maintainance branch (from tag mergeto_BR_QT4_Dev2_29Jul08)
[modules/kernel.git] / src / Logger / SALOME_Trace.hxx
1 //  SALOME Logger : CORBA server managing trace output
2 //
3 //  Copyright (C) 2003  CEA/DEN, EDF R&D
4 //
5 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
6 //
7 //  File   : SALOME_Trace.cxx
8 //  Author : Vasily Rusyaev
9 //  Module : SALOME
10
11 #if !defined(AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_)
12 #define AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_
13
14 #include <strstream>
15 #include <SALOMEconfig.h>
16 #include "Logger.hh"
17
18 //these declarations for files don't using OCC includes (for example HDF)
19 # ifdef WNT
20
21 #  ifndef Standard_EXPORT
22 #   define Standard_EXPORT __declspec( dllexport )
23 // For global variables :
24 #   define Standard_EXPORTEXTERN __declspec( dllexport ) extern
25 #   define Standard_EXPORTEXTERNC extern "C" __declspec( dllexport )
26 #  endif  /* Standard_EXPORT */
27
28 #  ifndef Standard_IMPORT
29 #   define Standard_IMPORT __declspec( dllimport ) extern
30 #   define Standard_IMPORTC extern "C" __declspec( dllimport )
31 #  endif  /* Standard_IMPORT */
32
33 # else  /* WNT */
34
35 #  ifndef Standard_EXPORT
36 #   define Standard_EXPORT
37 // For global variables :
38 #   define Standard_EXPORTEXTERN extern
39 #   define Standard_EXPORTEXTERNC extern "C"
40 #  endif  /* Standard_EXPORT */
41
42 #  ifndef Standard_IMPORT
43 #   define Standard_IMPORT extern
44 #   define Standard_IMPORTC extern "C"
45 #  endif  /* Standard_IMPORT */
46
47 # endif  /* WNT */
48
49 class SALOME_Trace : public std::ostrstream  
50 {
51 public:
52         virtual ~SALOME_Trace();
53         static Standard_EXPORT SALOME_Trace& Instance();
54         // initializes Logger (if USE_LOGGER variable is set) and returns true, in case success
55         int Initialize(CORBA::ORB_ptr theOrb);
56         Standard_EXPORT void putMessage(std::ostream& msg);
57 protected:
58         //disable creation of instances. It's necessary to use static SALOME_Logger& Instance()
59         SALOME_Trace();
60         SALOME_Logger::Logger_var m_pInterfaceLogger;// object reference on Logger server.
61         int isInitialized;
62 };
63
64 #define GLogger SALOME_Trace::Instance()
65
66 #endif // !defined(AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_)