Version: 8.3.0
SALOME_Trace.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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 
23 // SALOME Logger : CORBA server managing trace output
24 // File : SALOME_Trace.cxx
25 // Author : Vasily Rusyaev
26 // Module : SALOME
27 //
28 #if !defined(AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_)
29 #define AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_
30 
31 #include <sstream>
32 #include <SALOMEconfig.h>
33 #include "Logger.hh"
34 
35 //these declarations for files don't using OCC includes (for example HDF)
36 # ifdef WIN32
37 
38 # ifndef Standard_EXPORT
39 # define Standard_EXPORT __declspec( dllexport )
40 // For global variables :
41 # define Standard_EXPORTEXTERN __declspec( dllexport ) extern
42 # define Standard_EXPORTEXTERNC extern "C" __declspec( dllexport )
43 # endif /* Standard_EXPORT */
44 
45 # ifndef Standard_IMPORT
46 # define Standard_IMPORT __declspec( dllimport ) extern
47 # define Standard_IMPORTC extern "C" __declspec( dllimport )
48 # endif /* Standard_IMPORT */
49 
50 # else /* WIN32 */
51 
52 # ifndef Standard_EXPORT
53 # define Standard_EXPORT
54 // For global variables :
55 # define Standard_EXPORTEXTERN extern
56 # define Standard_EXPORTEXTERNC extern "C"
57 # endif /* Standard_EXPORT */
58 
59 # ifndef Standard_IMPORT
60 # define Standard_IMPORT extern
61 # define Standard_IMPORTC extern "C"
62 # endif /* Standard_IMPORT */
63 
64 # endif /* WIN32 */
65 
66 class SALOME_Trace : public std::ostringstream
67 {
68 public:
69  virtual ~SALOME_Trace();
71  // initializes Logger (if USE_LOGGER variable is set) and returns true, in case success
72  int Initialize(CORBA::ORB_ptr theOrb);
73  Standard_EXPORT void putMessage(std::ostream& msg);
74 protected:
75  //disable creation of instances. It's necessary to use static SALOME_Logger& Instance()
76  SALOME_Trace();
77  SALOME_Logger::Logger_var m_pInterfaceLogger;// object reference on Logger server.
79 };
80 
81 #define GLogger SALOME_Trace::Instance()
82 
83 #endif // !defined(AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_)