GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ADFCentralLog.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 by Olivier Stezowski *
3  * stezow(AT)ipnl.in2p3.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
25 #ifndef ADF_CentralLog
26 #define ADF_CentralLog
27 #define ADF_CENTRALLOG_H ADF_CentralLog
28 
29 #include <string>
30 #include <list>
31 
32 namespace ADF {
33 
34 class CentralLog;
35 
37 
41 {
42 public:
45 
46  void SetCentralLog(CentralLog *);
47 
48 private:
49  CentralLog *fCentralLog;
50 };
51 
52 class LogCollector;
53 class LogMessage;
54 
56 
59 class CentralLog
60 {
61 private:
62  static CentralLog *gTheCentralLog;
63  static CentralLogDestroyer gTheCentralLogDestroyer;
64 
65 protected:
66  friend class CentralLogDestroyer;
67 
68 private:
70  LogCollector *fCurrentCollector;
72  std::list < LogCollector * > fListOfCollectors;
73 
74 private:
75  CentralLog();
76  ~CentralLog();
77 
78 public:
80  static CentralLog *theCentralLog();
81 
83  bool ChangeCollector(std::string whichlog = std::string("Null"));
84 
86 
88  bool IsCollector(std::string whichlog);
89 
92 
94 
100 
102 
104  // void Remove( std::string );
105 
106 };
107 
108 } // namespace
109 
110 #endif
111 
112 
113 
114 
115 
CentralLog is a singleton that should be destroyed at exit time.
Definition: ADFCentralLog.h:59
Base class for a Log collector.
void SetCentralLog(CentralLog *)
LogCollector * GetCurrentLogCollector() const
Return the current logcollector.
bool IsCollector(std::string whichlog)
Check if the given collector already exists.
Base class for a Log message.
Definition: ADFLogMessage.h:80
To properly destroy the singleton.
Definition: ADFCentralLog.h:40
LogCollector * Add(LogCollector *)
Add a new LogCollector to the list of known collectors.
CentralLogDestroyer(CentralLog *s=0x0)
bool ChangeCollector(std::string whichlog=std::string("Null"))
to change the current collector
static CentralLog * theCentralLog()
CentralLog is a singleton.