$treeview $search $mathjax $extrastylesheet
artdaq_mfextensions
v1_03_03
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #ifndef MESSAGEFACILITY_EXTENSIONS_QT_MF_MSG_H 00002 #define MESSAGEFACILITY_EXTENSIONS_QT_MF_MSG_H 00003 00004 // Wrapped mf message type to be used by msgviewer for 00005 // the purpose of fast processing 00006 00007 #include <QtCore/QString> 00008 #include <QtGui/QColor> 00009 00010 #include <list> 00011 #include <map> 00012 #include <string> 00013 #include <vector> 00014 00015 #include <sys/time.h> 00016 #include "messagefacility/Utilities/ELseverityLevel.h" 00017 00018 namespace mf { 00019 class ErrorObj; 00020 } 00021 00025 enum sev_code_t { SDEBUG, SINFO, SWARNING, SERROR }; 00026 00030 class qt_mf_msg { 00031 public: 00040 qt_mf_msg(std::string hostname, std::string category, std::string application, pid_t pid, timeval time); 00041 00043 qt_mf_msg() {} 00045 qt_mf_msg(const qt_mf_msg&) = default; 00046 00047 virtual ~qt_mf_msg() = default; 00048 00049 // get method 00055 QString const& text(bool mode) const { return mode ? shortText_ : text_; } 00060 QColor const& color() const { return color_; } 00065 sev_code_t sev() const { return sev_; } 00070 QString const& host() const { return host_; } 00075 QString const& cat() const { return cat_; } 00080 QString const& app() const { return app_; } 00085 timeval time() const { return time_; } 00090 size_t seq() const { return seq_; } 00091 00096 void setSeverity(mf::ELseverityLevel sev); 00101 void setSeverityLevel(sev_code_t sev) { sev_ = sev; } 00108 void setMessage(std::string prefix, int iteration, std::string msg); 00113 void setHostAddr(std::string hostaddr) { hostaddr_ = QString(hostaddr.c_str()).toHtmlEscaped(); } 00118 void setFileName(std::string file) { file_ = QString(file.c_str()).toHtmlEscaped(); } 00123 void setLineNumber(std::string line) { line_ = QString(line.c_str()).toHtmlEscaped(); } 00128 void setModule(std::string module) { module_ = QString(module.c_str()).toHtmlEscaped(); } 00133 void setEventID(std::string eventID) { eventID_ = QString(eventID.c_str()).toHtmlEscaped(); } 00134 00138 void updateText(); 00139 00140 private: 00141 QString text_; 00142 QString shortText_; 00143 QColor color_; 00144 sev_code_t sev_; 00145 QString host_; 00146 QString cat_; 00147 QString app_; 00148 timeval time_; 00149 size_t seq_; 00150 static size_t sequence; 00151 00152 QString msg_; 00153 QString application_; 00154 QString pid_; 00155 QString hostaddr_; 00156 QString file_; 00157 QString line_; 00158 QString module_; 00159 QString eventID_; 00160 QString sourceType_; 00161 int sourceSequence_; 00162 }; 00163 00167 typedef std::list<qt_mf_msg> msgs_t; 00168 00172 class msg_iter_t { 00173 public: 00178 msg_iter_t(msgs_t::iterator it) { 00179 iter_ = it; 00180 seq_ = it->seq(); 00181 } 00182 00188 bool operator==(msg_iter_t const& other) const { return seq_ == other.seq_; } 00189 00195 bool operator<(msg_iter_t const& other) const { return seq_ < other.seq_; } 00196 00201 msgs_t::iterator get() const { return iter_; }; 00202 00203 private: 00204 msgs_t::iterator iter_; 00205 size_t seq_; 00206 }; 00207 00211 typedef std::list<msg_iter_t> msg_iters_t; 00215 typedef std::map<QString, msg_iters_t> msg_iters_map_t; 00216 00217 #endif