RLogChannel.h

00001 /*****************************************************************************
00002  * Author:   Valient Gough <vgough@pobox.com>
00003  *
00004  *****************************************************************************
00005  * Copyright (c) 2003, Valient Gough
00006  *
00007  * This library is free software; you can distribute it and/or modify it under
00008  * the terms of the GNU Lesser General Public License (LGPL), as published by
00009  * the Free Software Foundation; either version 2.1 of the License, or (at your
00010  * option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014  * FITNESS FOR A PARTICULAR PURPOSE.  See the LGPL in the file COPYING for more
00015  * details.
00016  *
00017  */
00018                                                                                                 
00019                              
00020 #ifndef _RLogChannel_incl_
00021 #define _RLogChannel_incl_
00022 
00023 #include <string>
00024 #include <map>
00025 
00026 #include <rlog/rlog.h>
00027 #include <rlog/RLogNode.h>
00028 
00029 namespace rlog
00030 {
00031     class RLOG_DECL RLogPublisher;
00032     class RLOG_DECL RLogChannel;
00033     typedef std::map<std::string, RLogChannel*> ComponentMap;
00034 
00035     // documentation in implementation file
00036     class RLOG_DECL RLogChannel : public RLogNode
00037     {
00038     public:
00039         RLogChannel( const std::string &name, LogLevel level );
00040         virtual ~RLogChannel();
00041 
00042 
00043         virtual void publish(const RLogData &data);
00044 
00045 
00046         const std::string &name() const;
00047 
00048         LogLevel logLevel() const;
00049         void setLogLevel(LogLevel level);
00050 
00051     protected:
00052         friend RLogChannel *rlog::GetComponentChannel( const char *component,
00053                 const char *path, LogLevel level );
00054         RLogChannel *getComponent(RLogChannel *componentParent, 
00055                                   const char *component);
00056 
00057     private:
00059         std::string _name; 
00060         LogLevel _level;
00061 
00062         ComponentMap subChannels;
00063         ComponentMap components;
00064 
00065         RLogChannel( const RLogChannel & );
00066         RLogChannel &operator = ( const RLogChannel & );
00067     };
00068 
00069 }
00070 
00071 #endif

Generated on Mon Nov 20 22:57:44 2006 for rlog by  doxygen 1.5.0