/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/ers/ers-00-00-03/ers/Issue.h

Go to the documentation of this file.
00001 /*
00002  *  Issue.h
00003  *  ers
00004  *
00005  *  Created by Matthias Wiesmann on 08.12.04.
00006  *  Copyright 2004 CERN. All rights reserved.
00007  *
00008  */
00009 
00010 #ifndef ERS_Issue_
00011 #define ERS_Issue_
00012 
00013 #include <map>
00014 #include <string>
00015 #include <stdint.h>
00016 
00017 #include "ers/Core.h"
00018 #include "ers/Stream.h"
00019 #include "ers/Context.h"
00020 #include "ers/IssueFactory.h"
00021 
00022 namespace ers {
00023     
00040     class Issue : public std::exception  {  
00041         friend class Stream ; 
00042         friend class IssueFactory ; 
00043 public: 
00044         static const char *const CLASS_KEY ;                               
00045         static const char *const COMPILATION_TIME_KEY ;                    
00046         static const char *const COMPILATION_TARGET_KEY ;                  
00047         static const char *const COMPILER_KEY ;                            
00048         static const char *const COMPILATION_DEBUG_LVL_KEY ;            
00049         static const char *const CPP_CLASS_KEY ;                           
00050         static const char *const ERS_VERSION_KEY ;                         
00051         static const char *const HOST_NAME_KEY ;                           
00052         static const char *const HOST_TYPE_KEY ;                           
00053         static const char *const HOST_IP_ADDR_KEY ;                        
00054         static const char *const MESSAGE_KEY ;                             
00055         static const char *const PROCESS_ID_KEY ;                          
00056         static const char *const PROCESS_PWD_KEY ;                         
00057         static const char *const PROGRAM_NAME_KEY ;                        
00058         static const char *const RESPONSIBILITY_KEY ;                      
00059         static const char *const SEVERITY_KEY ;                            
00060         static const char *const SOURCE_POSITION_KEY ;                     
00061         static const char *const SOURCE_PACKAGE_KEY ;                      
00062         static const char *const TIME_KEY ;                                
00063         static const char *const TRANSIENCE_KEY ;                          
00064         static const char *const USER_ID_KEY ;                             
00065         static const char *const USER_NAME_KEY ;                           
00066         static const char *const CAUSE_PSEUDO_KEY ;                        
00067         static const char *const CAUSE_TEXT_KEY ;                          
00068         static const char *const QUALIFIER_LIST_KEY ;                      
00069         static const char *const EXIT_VALUE_KEY ;                          
00070         static const char *const ISSUE_CLASS_NAME ;                        
00072 protected:
00073             Issue *m_cause ;                                               
00074         mutable std::string m_class_name ;                             
00075         mutable std::string m_human_description ;                      
00076         string_map_type m_value_table  ;                               
00077         void insert(const Context *context) throw() ;                  
00078         void insert_time() throw() ;                                   
00079         void setup_common(const Context *context) throw() ;            
00080         void finish_setup(const std::string &message) throw() ;        
00081         Issue(const Context &context, severity_t s);                 
00082         void set_values(const string_map_type &values) throw();        
00083 public:
00084             Issue();  
00085         Issue(const Issue &issue); 
00086         Issue(const string_map_type &values); 
00087         Issue(const Context &context, severity_t s, const std::string &message);   
00088         Issue(const Context &context, severity_t s, const std::exception *cause); 
00089         virtual ~Issue() throw() ;
00090         Issue *clone() const ; 
00091         
00092         const Issue *cause() const throw() ;                           
00093         void cause(const std::exception *cause=0);                     
00094         operator std::string() const ;                                 
00096         Issue operator=(const Issue &issue);                           
00097         bool operator==(const Issue &other) const throw();             
00098         const std::string& operator[](const std::string &key) const throw(); 
00099         
00100         const std::string &get_value(const std::string &key, const std::string &def) const throw() ;       
00101         const std::string &get_value(const std::string &key) const throw(); 
00102         int get_int_value(const std::string &key, int def=0) const throw() ;       
00103         long get_long_value(const std::string &key, long def=0) const throw() ;    
00104         double get_double_value(const std::string key, double def) const throw() ; 
00105         void set_value(const std::string &key, uint8_t value) throw() ;            
00106         void set_value(const std::string &key, uint16_t value) throw() ; 
00107         void set_value(const std::string &key, uint32_t value) throw() ;    
00108         void set_value(const std::string &key, uint64_t value) throw() ;           
00109         void set_value(const std::string &key, int8_t value) throw() ;            
00110         void set_value(const std::string &key, int16_t value) throw() ; 
00111         void set_value(const std::string &key, int32_t value) throw() ;    
00112         void set_value(const std::string &key, int64_t value) throw() ;                 
00113         void set_value(const std::string &key, double value) throw() ;             
00114         void set_value(const std::string &key, const std::string &value) throw() ; 
00115         void set_value(const std::string &key, const char* value) throw() ;        
00116         void set_value(const std::string &key, const void* ptr) throw() ; 
00117         int values_number() const ;                                                
00119         virtual const char *get_class_name() const throw() ;           
00120         const string_map_type* get_value_table() const ;               
00121         severity_t severity() const throw()  ;                         
00122         void severity(severity_t s) ;                                  
00123         bool is_error();                                               
00124         std::string severity_message() const ;                         
00125         void responsibility(responsibility_t r) ;                      
00126         responsibility_t responsibility() const throw() ;              
00127         void transience(bool tr);                                      
00128         int transience() const throw() ;                               
00129         const std::string &human_description() const throw()  ;        
00130         const char* what() const throw() ;                             
00131         const std::string &message() const throw() ;                   
00132         virtual int exit_value() const throw();                        
00133         void add_qualifier(const std::string &qualif) ;                
00134         std::vector<std::string> qualifiers() const ;                  
00135     } ; // Issue
00136 
00137 std::ostream& operator<<(std::ostream&, const Issue&);
00138 Stream& operator<<(Stream&, const Issue&); 
00139 } // ers
00140 
00141 // This macro suppresses assertion if N_DEBUG is defined 
00142 // 
00143 
00144 #if defined(N_DEBUG)
00145 #define N_ERS_STATIC_ASSERT
00146 #define N_ERS_ASSERT
00147 #endif
00148 
00149 #endif
00150 

Generated on Tue Nov 29 22:58:25 2016 for BOSS_7.0.2 by  doxygen 1.4.7