LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
mf::MessageFacilityMsg Class Reference

#include "MessageFacilityMsg.h"

Public Member Functions

 ~MessageFacilityMsg ()
 
 MessageFacilityMsg (ErrorObj const &errorobj)
 
 MessageFacilityMsg ()
 
bool empty () const
 
ErrorObj ErrorObject () const
 
timeval timestamp () const
 
std::string timestr () const
 
std::string severity () const
 
std::string category () const
 
std::string hostname () const
 
std::string hostaddr () const
 
long pid () const
 
std::string application () const
 
std::string module () const
 
std::string context () const
 
std::string iteration () const
 
std::string file () const
 
long line () const
 
std::string message () const
 
void setTimestamp (timeval const &)
 
void setSeverity (std::string const &)
 
void setCategory (std::string const &)
 
void setHostname (std::string const &)
 
void setHostaddr (std::string const &)
 
void setPid (long)
 
void setApplication (std::string const &)
 
void setModule (std::string const &)
 
void setContext (std::string const &)
 
void setIteration (std::string const &)
 
void setMessage (std::string const &file, std::string const &line, std::string const &message)
 

Private Attributes

std::unique_ptr< ErrorObjmsg_
 
bool empty_
 

Detailed Description

Definition at line 13 of file MessageFacilityMsg.h.

Constructor & Destructor Documentation

mf::MessageFacilityMsg::~MessageFacilityMsg ( )

Definition at line 11 of file MessageFacilityMsg.cc.

11 {}
mf::MessageFacilityMsg::MessageFacilityMsg ( ErrorObj const &  errorobj)

Definition at line 13 of file MessageFacilityMsg.cc.

14  : msg_(new ErrorObj(msg)), empty_(false)
15  {}
std::unique_ptr< ErrorObj > msg_
mf::MessageFacilityMsg::MessageFacilityMsg ( )

Definition at line 17 of file MessageFacilityMsg.cc.

18  : msg_(new ErrorObj(ELseverityLevel("INFO"), "")), empty_(true)
19  {}
std::unique_ptr< ErrorObj > msg_

Member Function Documentation

string mf::MessageFacilityMsg::application ( ) const

Definition at line 156 of file MessageFacilityMsg.cc.

References msg_.

157  {
158  return msg_->xid().application();
159  }
std::unique_ptr< ErrorObj > msg_
string mf::MessageFacilityMsg::category ( ) const

Definition at line 132 of file MessageFacilityMsg.cc.

References msg_.

133  {
134  return msg_->xid().id();
135  }
std::unique_ptr< ErrorObj > msg_
string mf::MessageFacilityMsg::context ( ) const

Definition at line 168 of file MessageFacilityMsg.cc.

References msg_.

169  {
170  return msg_->iteration();
171  }
std::unique_ptr< ErrorObj > msg_
bool mf::MessageFacilityMsg::empty ( void  ) const

Definition at line 101 of file MessageFacilityMsg.cc.

References empty_.

102  {
103  return empty_;
104  }
ErrorObj mf::MessageFacilityMsg::ErrorObject ( ) const

Definition at line 107 of file MessageFacilityMsg.cc.

References msg_.

108  {
109  return *msg_;
110  }
std::unique_ptr< ErrorObj > msg_
string mf::MessageFacilityMsg::file ( ) const

Definition at line 181 of file MessageFacilityMsg.cc.

References msg_.

182  {
183  int idx = 0;
184  for (list<string>::const_iterator it = msg_->items().begin();
185  it != msg_->items().end();
186  ++it) {
187  ++idx;
188  if (idx == 2) {
189  return *it;
190  }
191  }
192  return "";
193  }
intermediate_table::const_iterator const_iterator
std::unique_ptr< ErrorObj > msg_
string mf::MessageFacilityMsg::hostaddr ( ) const

Definition at line 144 of file MessageFacilityMsg.cc.

References msg_.

145  {
146  return msg_->xid().hostaddr();
147  }
std::unique_ptr< ErrorObj > msg_
string mf::MessageFacilityMsg::hostname ( ) const

Definition at line 138 of file MessageFacilityMsg.cc.

References msg_.

139  {
140  return msg_->xid().hostname();
141  }
std::unique_ptr< ErrorObj > msg_
string mf::MessageFacilityMsg::iteration ( ) const

Definition at line 174 of file MessageFacilityMsg.cc.

References msg_.

175  {
176  return msg_->iteration();
177  }
std::unique_ptr< ErrorObj > msg_
long mf::MessageFacilityMsg::line ( ) const

Definition at line 197 of file MessageFacilityMsg.cc.

References msg_, and ss.

198  {
199  int idx = 0;
200  int line = 0;
201  for (list<string>::const_iterator it = msg_->items().begin();
202  it != msg_->items().end();
203  ++it) {
204  ++idx;
205  if (idx == 4) {
206  istringstream ss(*it);
207  if (ss >> line) {
208  return line;
209  }
210  return 0;
211  }
212  }
213  return 0;
214  }
Float_t ss
Definition: plot.C:23
intermediate_table::const_iterator const_iterator
std::unique_ptr< ErrorObj > msg_
string mf::MessageFacilityMsg::message ( ) const

Definition at line 218 of file MessageFacilityMsg.cc.

References msg_.

Referenced by setMessage().

219  {
220  int idx = 0;
221  string msg;
222  for (list<string>::const_iterator it = msg_->items().begin();
223  it != msg_->items().end();
224  ++it) {
225  ++idx;
226  if (idx > 5) {
227  msg += *it;
228  }
229  }
230  return msg;
231  }
intermediate_table::const_iterator const_iterator
std::unique_ptr< ErrorObj > msg_
string mf::MessageFacilityMsg::module ( ) const

Definition at line 162 of file MessageFacilityMsg.cc.

References msg_.

163  {
164  return msg_->xid().module();
165  }
std::unique_ptr< ErrorObj > msg_
long mf::MessageFacilityMsg::pid ( ) const

Definition at line 150 of file MessageFacilityMsg.cc.

References msg_.

151  {
152  return msg_->xid().pid();
153  }
std::unique_ptr< ErrorObj > msg_
void mf::MessageFacilityMsg::setApplication ( std::string const &  app)

Definition at line 64 of file MessageFacilityMsg.cc.

References empty_, and msg_.

65  {
66  msg_->setApplication(app);
67  empty_ = false;
68  }
std::unique_ptr< ErrorObj > msg_
void mf::MessageFacilityMsg::setCategory ( std::string const &  category)

Definition at line 36 of file MessageFacilityMsg.cc.

References empty_, and msg_.

37  {
38  msg_->setID(category);
39  empty_ = false;
40  }
std::string category() const
std::unique_ptr< ErrorObj > msg_
void mf::MessageFacilityMsg::setContext ( std::string const &  s)

Definition at line 78 of file MessageFacilityMsg.cc.

References empty_, and msg_.

79  {
80  msg_->setIteration(s);
81  empty_ = false;
82  }
Float_t s
Definition: plot.C:23
std::unique_ptr< ErrorObj > msg_
void mf::MessageFacilityMsg::setHostaddr ( std::string const &  hostaddr)

Definition at line 50 of file MessageFacilityMsg.cc.

References empty_, and msg_.

51  {
52  msg_->setHostAddr(hostaddr);
53  empty_ = false;
54  }
std::string hostaddr() const
std::unique_ptr< ErrorObj > msg_
void mf::MessageFacilityMsg::setHostname ( std::string const &  hostname)

Definition at line 43 of file MessageFacilityMsg.cc.

References empty_, and msg_.

44  {
45  msg_->setHostName(hostname);
46  empty_ = false;
47  }
std::unique_ptr< ErrorObj > msg_
std::string hostname() const
void mf::MessageFacilityMsg::setIteration ( std::string const &  s)

Definition at line 85 of file MessageFacilityMsg.cc.

References empty_, and msg_.

86  {
87  msg_->setIteration(s);
88  empty_ = false;
89  }
Float_t s
Definition: plot.C:23
std::unique_ptr< ErrorObj > msg_
void mf::MessageFacilityMsg::setMessage ( std::string const &  file,
std::string const &  line,
std::string const &  message 
)

Definition at line 92 of file MessageFacilityMsg.cc.

References empty_, message(), and msg_.

95  {
96  *msg_ << " " << file << ":" << line << "\n" << message;
97  empty_ = false;
98  }
std::string message() const
std::string file() const
std::unique_ptr< ErrorObj > msg_
void mf::MessageFacilityMsg::setModule ( std::string const &  module)

Definition at line 71 of file MessageFacilityMsg.cc.

References empty_, and msg_.

72  {
73  msg_->setModule(module);
74  empty_ = false;
75  }
std::string module() const
std::unique_ptr< ErrorObj > msg_
void mf::MessageFacilityMsg::setPid ( long  pid)

Definition at line 57 of file MessageFacilityMsg.cc.

References empty_, and msg_.

58  {
59  msg_->setPID(pid);
60  empty_ = false;
61  }
std::unique_ptr< ErrorObj > msg_
void mf::MessageFacilityMsg::setSeverity ( std::string const &  severity)

Definition at line 29 of file MessageFacilityMsg.cc.

References empty_, and msg_.

30  {
31  msg_->setSeverity(mf::ELseverityLevel(severity));
32  empty_ = false;
33  }
std::string severity() const
std::unique_ptr< ErrorObj > msg_
void mf::MessageFacilityMsg::setTimestamp ( timeval const &  tv)

Definition at line 22 of file MessageFacilityMsg.cc.

References empty_, and msg_.

23  {
24  msg_->setTimestamp(tv);
25  empty_ = false;
26  }
std::unique_ptr< ErrorObj > msg_
string mf::MessageFacilityMsg::severity ( ) const

Definition at line 126 of file MessageFacilityMsg.cc.

References msg_.

127  {
128  return msg_->xid().severity().getInputStr();
129  }
std::unique_ptr< ErrorObj > msg_
timeval mf::MessageFacilityMsg::timestamp ( ) const

Definition at line 113 of file MessageFacilityMsg.cc.

References msg_.

114  {
115  return msg_->timestamp();
116  }
std::unique_ptr< ErrorObj > msg_
string mf::MessageFacilityMsg::timestr ( ) const

Definition at line 120 of file MessageFacilityMsg.cc.

References msg_.

121  {
122  return mf::timestamp::Legacy::get_time(msg_->timestamp());
123  }
std::unique_ptr< ErrorObj > msg_

Member Data Documentation

bool mf::MessageFacilityMsg::empty_
private

The documentation for this class was generated from the following files: