Salome HOME
Merging with WPDev
[modules/kernel.git] / src / Logger / SALOME_Logger_Server.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_Logger_Server.hxx
8 //  Author : Vasily Rusyaev
9 //  Module : SALOME
10
11 #if !defined SALOME_Logger_Server_include
12 #define SALOME_Logger_Server_include
13
14 #ifndef WNT
15 #include <fstream.h>
16 #else
17 #include <fstream>
18 #include <iosfwd>
19 #endif
20 #include <omnithread.h>
21 #include "Logger.hh"
22
23 #ifdef WNT
24 # if defined LOGGER_EXPORTS
25 #  define LOGGER_EXPORT __declspec( dllexport )
26 # else
27 #  define LOGGER_EXPORT __declspec( dllimport )
28 # endif
29 #else
30 # define LOGGER_EXPORT
31 #endif
32
33
34 class LOGGER_EXPORT Logger :
35   public POA_SALOME_Logger::Logger,
36   public PortableServer::RefCountServantBase 
37 {
38 public:
39         //constructor w/o parameters
40         //all messages will be put into terminal via cout
41         Logger();
42         //constructor with parameter, filename is output file
43         //all messages will be put into special file passed as parameter
44         Logger(const char *filename);
45         virtual ~Logger();
46         //put message into one special place for all servers
47         void putMessage(const char* message);
48         void ping();
49 private:
50         //if m_putIntoFile is true all messages will be put into special 
51         //otherwise all messages will be put into terminal via cout 
52         bool m_putIntoFile;
53         //ofstream class specialized for disk file output
54 #ifndef WNT
55         ofstream m_outputFile; 
56 #else
57                 std::ofstream m_outputFile; 
58 #endif
59         //synchronisation object
60         static omni_mutex myLock;
61 };
62
63 #endif // !defined(SALOME_Logger_Server_include)