| # Gaudi Framework, version v21r7 |

Home |  | Generated: 22 Jan 2010

# Message.h

Go to the documentation of this file.

    00001 // $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/GaudiKernel/Message.h,v 1.5 2008/02/20 19:16:23 hmd Exp $
    00002 #ifndef GAUDIKERNEL_MESSAGE_H
    00003 #define GAUDIKERNEL_MESSAGE_H
    00004
    00005 #include <string>
    00006 #include <iostream>
    00007
    00015 class GAUDI_API Message {
    00016 public:
    00018   Message();
    00019
    00021   Message ( const char* src, int type, const char* msg );
    00022
    00024   Message ( const std::string& src, int type, const std::string& msg );
    00025
    00027   ~Message() {}
    00028
    00030   const std::string& getMessage() const;
    00031
    00033   void setMessage( const std::string& msg );
    00034
    00036   int getType() const;
    00037
    00039   void setType( int msg_type );
    00040
    00042   const std::string& getSource() const;
    00043
    00045   void setSource( const std::string& src );
    00046
    00048   const std::string& getFormat() const;
    00049
    00051   static const std::string getDefaultFormat();
    00052
    00054   void setFormat( const std::string& msg ) const;
    00055
    00057   const std::string& getTimeFormat() const;
    00058
    00060   static const std::string getDefaultTimeFormat() ;
    00061
    00063   void setTimeFormat( const std::string& timeFormat ) const;
    00064
    00066   bool operator < ( const Message& test );
    00067
    00069   friend std::ostream& operator << ( std::ostream& stream, const Message& msg );
    00070
    00072   friend bool operator == ( const Message& a, const Message& b );
    00073
    00074 protected:
    00076   void invalidFormat() const;
    00077
    00079   void makeFormattedMsg( const std::string& format ) const;
    00080
    00082   void decodeFormat( const std::string& format ) const;
    00083
    00085   void sizeField( const std::string& text ) const;
    00086
    00088   void setWidth( const std::string& formatArg ) const;
    00089
    00091   std::string m_message;
    00092
    00094   std::string m_source;
    00095
    00097   mutable std::string m_format;
    00098
    00100   mutable std::string m_time_format;
    00101
    00103   int m_type;
    00104
    00106   mutable std::string m_formatted_msg;
    00107
    00109   mutable char m_fill;
    00110
    00112   mutable int m_width;
    00113
    00115   mutable bool m_left;
    00116
    00118   static const char FORMAT_PREFIX;
    00119
    00121   static const char JUSTIFY_LEFT;
    00122
    00124   static const char JUSTIFY_RIGHT;
    00125
    00127   static const char MESSAGE;
    00128
    00130   static const char TYPE;
    00131
    00133   static const char TIME;
    00134
    00137   static const char UTIME;
    00138
    00140   static const char SOURCE;
    00141
    00145   static const char FILL;
    00146
    00150   static const char WIDTH;
    00151
    00153   static const char* DEFAULT_FORMAT;
    00154
    00156   static const char* DEFAULT_TIME_FORMAT;
    00157
    00158 };
    00159
    00161 GAUDI_API std::ostream& operator << ( std::ostream& stream, const Message& msg );
    00162
    00164 GAUDI_API bool operator == ( const Message& a, const Message& b );
    00165
    00166 #endif