Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

logserver.h

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
00002 
00003    this file is part of rcssserver3D
00004    Fri May 9 2003
00005    Copyright (C) 2002,2003 Koblenz University
00006    Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group
00007    $Id: logserver.h,v 1.5 2004/05/14 16:02:01 fruit Exp $
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; version 2 of the License.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021 
00022         LogServer
00023 
00024 
00025         HISTORY:
00026                 22.08.2002 MK
00027                         - initial version - reclaimed from rcssserver3D :)
00028 
00029 */
00030 #ifndef ZEITGEIST_LOGSERVER_H
00031 #define ZEITGEIST_LOGSERVER_H
00032 
00033 #include <iostream>
00034 #include "../node.h"
00035 
00036 namespace zeitgeist
00037 {
00038 
00039 class LogServerStreamBuf;
00040 
00045 class LogServer : public Node , public std::ostream
00046 {
00047     // types
00048     //
00049 public:
00050 
00054     enum EPriorityLevel
00055     {
00056         eNone    = 0,
00057         eDebug   = 1,
00058         eNormal  = 2,
00059         eWarning = 4,
00060         eError   = 8,
00061         eAll     = 0xffffffff
00062     };
00063 
00064     //
00065     // functions
00066     //
00067 public:
00069     LogServer(unsigned int size = 1024);
00070     virtual ~LogServer();
00071 
00079     void AddStream(std::ostream *stream, unsigned int mask = eAll);
00080 
00085     bool RemoveStream(const std::ostream *stream);
00086 
00093     bool SetPriorityMask(const std::ostream *stream, unsigned int mask);
00094 
00100     unsigned int GetPriorityMask(const std::ostream *stream) const;
00101 
00108     LogServer& Priority(unsigned int prio);
00109 
00112     LogServer& Debug()    { return Priority(eDebug); }
00113 
00116     LogServer& Normal()   { return Priority(eNormal); }
00117 
00120     LogServer& Warning()  { return Priority(eWarning); }
00121 
00124     LogServer& Error()    { return Priority(eError); }
00125 
00127     void Printf(const char *inFormat, ...);
00128 
00129 private:
00130     LogServer(const LogServer& obj);
00131     LogServer& operator=(const LogServer& obj);
00132 
00133     const LogServerStreamBuf& GetStreamBuf() const;
00134     LogServerStreamBuf& GetStreamBuf();
00135 };
00136 
00137 DECLARE_CLASS(LogServer);
00138 
00139 } //namespace zeitgeist
00140 
00141 #endif //ZEITGEIST_LOGSERVER_H

Generated on Thu Apr 6 15:25:38 2006 for rcssserver3d by  doxygen 1.4.4