Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

MessageSvc.h

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/GaudiSvc/src/MessageSvc/MessageSvc.h,v 1.1.1.2 2001/04/18 18:32:50 tlindner Exp $
00002 #ifndef GAUDI_MESSAGESVC_H
00003 #define GAUDI_MESSAGESVC_H
00004 
00005 // Include files
00006 #include <string>
00007 #include <map>
00008 
00009 #include "GaudiKernel/StatusCode.h"
00010 #include "GaudiKernel/Service.h"
00011 #include "GaudiKernel/IMessageSvc.h"
00012 #include "GaudiKernel/Message.h"
00013 
00014 // Forward declarations
00015 class ISvcLocator;
00016 
00017 //
00018 // ClassName:   MessageSvc 
00019 //  
00020 // Description: The MessageSvc service implements the IMessageSvc interface anbd provides the
00021 //              basic messaging needed by batch oriented applications. 
00022 //
00023 // Author:      Iain Last
00024 //
00025 class MessageSvc : virtual public Service,
00026                    virtual public IMessageSvc { 
00027 public:
00028   typedef std::pair< std::string, std::ostream* > NamedStream;
00029   typedef std::multimap< int, NamedStream > StreamMap;
00030   typedef std::multimap< StatusCode, Message > MessageMap;
00031   typedef std::map< std::string, int > ThresholdMap;
00032   
00033   // Default constructor.
00034   MessageSvc( const std::string& name, ISvcLocator* svcloc );
00035   // Destructor.
00036   virtual ~MessageSvc() {}
00037 
00038   // Implementation of IService::initialize()
00039   virtual StatusCode initialize();
00040   // Implementation of IService::finalize()
00041   virtual StatusCode finalize();
00042 
00043   // Implementation of IMessageSvc::reportMessage()
00044   virtual void reportMessage( const Message& message );
00045 
00046   // Implementation of IMessageSvc::reportMessage()
00047   virtual void reportMessage( const StatusCode& code, const std::string& source = "");
00048 
00049   // Implementation of IMessageSvc::reportMessage()
00050   virtual void reportMessage( const char* source, int type, const char* message);
00051 
00052   // Implementation of IMessageSvc::reportMessage()
00053   virtual void reportMessage( const std::string& source, int type, const std::string& message);
00054   
00055   // Implementation of IMessageSvc::insertMessage()
00056   virtual void insertMessage( const StatusCode& code, const Message& message );
00057 
00058   // Implementation of IMessageSvc::eraseMessage()
00059   virtual void eraseMessage();
00060 
00061   // Implementation of IMessageSvc::eraseMessage()
00062   virtual void eraseMessage( const StatusCode& code ) ;
00063 
00064   // Implementation of IMessageSvc::eraseMessage()
00065   virtual void eraseMessage( const StatusCode& code, const Message& message );
00066 
00067   // Implementation of IMessageSvc::insertStream()
00068   virtual void insertStream( int message_type, const std::string& name, std::ostream* stream );
00069   
00070   // Implementation of IMessageSvc::eraseStream()
00071   virtual void eraseStream();
00072   
00073   // Implementation of IMessageSvc::eraseStream()
00074   virtual void eraseStream( int message_type );
00075   
00076   // Implementation of IMessageSvc::eraseStream()
00077   virtual void eraseStream( int message_type, std::ostream* stream );
00078 
00079   // Implementation of IMessageSvc::eraseStream()
00080   virtual void eraseStream( std::ostream* stream );
00081 
00082   // Implementation of IMessageSvc::desaultStream()
00083   virtual std::ostream* defaultStream() const { 
00084     return m_defaultStream; 
00085   }
00086 
00087   // Implementation of IMessageSvc::setDefaultStream()
00088   virtual void setDefaultStream( std::ostream* stream ) { 
00089     m_defaultStream = stream;
00090   }
00091 
00092   // Implementation of IMessageSvc::ouputLevel()
00093   virtual int outputLevel()   const;
00094 
00095   // Implementation of IMessageSvc::ouputLevel()
00096   virtual int outputLevel(const std::string& source)   const;
00097 
00098   // Implementation of IMessageSvc::setOuputLevel()
00099   virtual void setOutputLevel(int new_level);
00100 
00101   // Implementation of IMessageSvc::setOuputLevel()
00102   virtual void setOutputLevel(const std::string& source, int new_level);
00103 
00104   // Implementation of IInterface::queryInterface()
00105   virtual StatusCode queryInterface(const IID& riid, void** ppvUnknown);
00106 
00107 private:
00108   std::ostream* m_defaultStream;      // Pointer to the output stream.
00109   Message m_defaultMessage;           // Default Message
00110   StreamMap m_streamMap;              // Stream map
00111   MessageMap m_messageMap;            // Message map
00112   ThresholdMap m_thresholdMap;        // Output level threshold map
00113 //  int m_outputLevel;                  // Current output level threshold
00114   std::string m_defaultFormat;        // Default format for the messages
00115 };
00116 
00117 #endif

Generated at Wed Nov 21 12:22:30 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000