LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
lsst.ctrl.events::Event Class Reference

Representation of an LSST Event. More...

#include <Event.h>

Inheritance diagram for lsst.ctrl.events::Event:
lsst.ctrl.events::CommandEvent lsst.ctrl.events::LogEvent lsst.ctrl.events::MonitorEvent lsst.ctrl.events::StatusEvent lsst.ctrl.events::PipelineLogEvent

Public Member Functions

 Event ()
 
 Event (const std::string &runid, const PropertySet::Ptr ps)
 
 Event (const std::string &runid, const PropertySet &ps)
 
 Event (cms::TextMessage *msg)
 
virtual ~Event ()
 destructor More...
 
PropertySet::Ptr getPropertySet () const
 
std::string getPubDate ()
 Get the publication date of this event. More...
 
long long getPubTime ()
 
void setPubTime (long long t)
 
long long getEventTime ()
 
void setEventTime (long long nsecs)
 
void updateEventTime ()
 
std::string getEventDate ()
 Get the creation date of this event. More...
 
std::string getHostId ()
 
std::string getRunId ()
 
std::string getType ()
 
std::string getStatus ()
 
void setStatus (std::string status)
 
void setTopic (std::string topic)
 
std::string getTopic ()
 
vector< std::string > getFilterablePropertyNames ()
 
vector< std::string > getCustomPropertyNames ()
 
PropertySet::Ptr getCustomPropertySet () const
 
virtual void populateHeader (cms::TextMessage *msg) const
 
void marshall (cms::TextMessage *msg)
 
 ExceptionEvent ()
 
 ExceptionEvent (const std::string &runid, const LSSTException ex)
 
 ExceptionEvent (cms::TextMessage *msg)
 
 ~LogEvent ()
 
void populateHeader (cms::TextMessage *msg)
 
std::string getExceptionType ()
 
std::string getStackTrace ()
 

Static Public Attributes

static const std::string TYPE = "TYPE"
 Creates Event which contains a PropertySet. More...
 
static const std::string EVENTTIME = "EVENTTIME"
 
static const std::string HOSTID = "HOSTID"
 
static const std::string RUNID = "RUNID"
 
static const std::string STATUS = "STATUS"
 
static const std::string TOPIC = "TOPIC"
 
static const std::string PUBTIME = "PUBTIME"
 
static const std::string UNINITIALIZED = "uninitialized"
 
static const std::string EXCEPTIONTYPE
 
static const std::string STACKTRACE
 

Protected Member Functions

void _init ()
 
void _constructor (const std::string &runid, const PropertySet &ps)
 
void splitString (std::string str, std::string delim, std::vector< std::string > &results)
 
void splitTuple (std::string str, std::string delim, std::vector< std::string > &results)
 

Protected Attributes

PropertySet::Ptr _psp
 
set< std::string > _keywords
 

Private Member Functions

std::string marshall (const PropertySet &ps)
 
PropertySet::Ptr processTextMessage (cms::TextMessage *textMessage)
 
PropertySet::Ptr unmarshall (const std::string &text)
 
void _init ()
 

Detailed Description

Representation of an LSST Event.

Representation of an LSST ExceptionEvent.

Definition at line 67 of file Event.h.

Constructor & Destructor Documentation

lsst.ctrl.events::Event::Event ( )

Definition at line 90 of file Event.cc.

90  {
91  _init();
92 }
lsst.ctrl.events::Event::Event ( const std::string &  runid,
const PropertySet::Ptr  ps 
)

Definition at line 145 of file Event.cc.

145  {
146  _constructor(runId, *psp);
147 }
void _constructor(const std::string &runid, const PropertySet &ps)
Definition: Event.cc:153
lsst.ctrl.events::Event::Event ( const std::string &  runid,
const PropertySet ps 
)

Definition at line 149 of file Event.cc.

149  {
150  _constructor(runId, ps);
151 }
void _constructor(const std::string &runid, const PropertySet &ps)
Definition: Event.cc:153
lsst.ctrl.events::Event::Event ( cms::TextMessage *  msg)

Definition at line 104 of file Event.cc.

104  {
105  _init();
106 
107  _psp = processTextMessage(msg);
108 
109  _psp->set(TYPE, msg->getStringProperty(TYPE));
110  _psp->set(HOSTID, msg->getStringProperty(HOSTID));
111  _psp->set(RUNID, msg->getStringProperty(RUNID));
112  _psp->set(STATUS, msg->getStringProperty(STATUS));
113  _psp->set(TOPIC, msg->getStringProperty(TOPIC));
114  _psp->set(EVENTTIME, msg->getLongProperty(EVENTTIME));
115  _psp->set(PUBTIME, msg->getLongProperty(PUBTIME));
116 /*
117 */
118 }
static const std::string HOSTID
Definition: Event.h:73
PropertySet::Ptr _psp
Definition: Event.h:117
static const std::string TYPE
Creates Event which contains a PropertySet.
Definition: Event.h:71
static const std::string TOPIC
Definition: Event.h:76
static const std::string RUNID
Definition: Event.h:74
static const std::string PUBTIME
Definition: Event.h:77
PropertySet::Ptr processTextMessage(cms::TextMessage *textMessage)
Definition: Event.cc:376
static const std::string STATUS
Definition: Event.h:75
static const std::string EVENTTIME
Definition: Event.h:72
lsst.ctrl.events::Event::~Event ( )
virtual

destructor

Definition at line 493 of file Event.cc.

493  {
494 }
lsst.ctrl.events::Event::~LogEvent ( )

Member Function Documentation

void lsst.ctrl.events::Event::_constructor ( const std::string &  runid,
const PropertySet ps 
)
protected

Definition at line 153 of file Event.cc.

153  {
154  long int host_len = sysconf(_SC_HOST_NAME_MAX);
155 
156  boost::scoped_array<char> hostname(new char[host_len]);
157  //time_t rawtime;
158 
159  _init();
160 
161  _psp = ps.deepCopy();
162 
163 
164  // do NOT alter the property set we were given. Make a copy of it,
165  // and modify that one.
166 
167  /*
168  std::string foo = psp->toString();
169  std::cout << "foo = " << foo << std::endl;
170  */
171 
172  if (!_psp->exists(STATUS)) {
173  _psp->set(STATUS, "unknown");
174  }
175 
176  if (!_psp->exists(EVENTTIME)) {
177  updateEventTime();
178  }
179 
180 
181  if (!_psp->exists(HOSTID)) {
182  std::string name;
183  gethostname(hostname.get(), host_len);
184  name = hostname.get();
185  _psp->set(HOSTID, name);
186  }
187 
188  // _runId is filled in here and is ignored in the passed PropertySet
189  _psp->set(RUNID, runId);
190 
191  // _type is filled in here and is ignored in the passed PropertySet
192  _psp->set(TYPE, EventTypes::EVENT);
193 
194  // _topic is filled in on publish and is ignored in the passed PropertySet
196 
197  // _pubTime is filled in on publish and is ignored in the passed PropertySet
198  _psp->set(PUBTIME, (long long)0);
199 }
static const std::string EVENT
Definition: EventTypes.h:46
static const std::string HOSTID
Definition: Event.h:73
PropertySet::Ptr _psp
Definition: Event.h:117
static const std::string TYPE
Creates Event which contains a PropertySet.
Definition: Event.h:71
static const std::string TOPIC
Definition: Event.h:76
static const std::string UNINITIALIZED
Definition: Event.h:78
virtual Ptr deepCopy(void) const
Definition: PropertySet.cc:70
static const std::string RUNID
Definition: Event.h:74
static const std::string PUBTIME
Definition: Event.h:77
static const std::string STATUS
Definition: Event.h:75
static const std::string EVENTTIME
Definition: Event.h:72
void lsst.ctrl.events::Event::_init ( )
private
void lsst.ctrl.events::Event::_init ( )
protected

Definition at line 94 of file Event.cc.

94  {
95  _keywords.insert(TYPE);
96  _keywords.insert(EVENTTIME);
97  _keywords.insert(HOSTID);
98  _keywords.insert(RUNID);
99  _keywords.insert(STATUS);
100  _keywords.insert(TOPIC);
101  _keywords.insert(PUBTIME);
102 }
static const std::string HOSTID
Definition: Event.h:73
static const std::string TYPE
Creates Event which contains a PropertySet.
Definition: Event.h:71
static const std::string TOPIC
Definition: Event.h:76
static const std::string RUNID
Definition: Event.h:74
static const std::string PUBTIME
Definition: Event.h:77
set< std::string > _keywords
Definition: Event.h:118
static const std::string STATUS
Definition: Event.h:75
static const std::string EVENTTIME
Definition: Event.h:72
lsst.ctrl.events::Event::ExceptionEvent ( )
lsst.ctrl.events::Event::ExceptionEvent ( const std::string &  runid,
const LSSTException  ex 
)
lsst.ctrl.events::Event::ExceptionEvent ( cms::TextMessage *  msg)
vector< std::string > lsst.ctrl.events::Event::getCustomPropertyNames ( )

Definition at line 129 of file Event.cc.

129  {
130  vector<std::string> names = _psp->names();
131 
132  vector<std::string>::iterator nameIterator;
133  set<std::string>::iterator keyIterator;
134 
135  for (nameIterator = names.begin(); nameIterator != names.end();) {
136  keyIterator = _keywords.find(*nameIterator);
137  if (keyIterator == _keywords.end())
138  nameIterator++;
139  else
140  names.erase(nameIterator);
141  }
142  return names;
143 }
PropertySet::Ptr _psp
Definition: Event.h:117
set< std::string > _keywords
Definition: Event.h:118
PropertySet::Ptr lsst.ctrl.events::Event::getCustomPropertySet ( ) const

Definition at line 235 of file Event.cc.

235  {
236  PropertySet::Ptr psp = _psp->deepCopy();
237 
238  set<std::string>::iterator keyIterator;
239  for (keyIterator = _keywords.begin(); keyIterator != _keywords.end(); keyIterator++)
240  psp->remove(*keyIterator);
241  return psp;
242 }
PropertySet::Ptr _psp
Definition: Event.h:117
boost::shared_ptr< PropertySet > Ptr
Definition: PropertySet.h:90
set< std::string > _keywords
Definition: Event.h:118
std::string lsst.ctrl.events::Event::getEventDate ( )

Get the creation date of this event.

Returns
A formatted date string representing the event creation time

Definition at line 226 of file Event.cc.

226  {
227  long long eventTime = _psp->get<long long>(EVENTTIME);
228  dafBase::DateTime dateTime(eventTime);
229 
230  struct tm gmTime = dateTime.gmtime();
231  return asctime(&gmTime);
232 }
PropertySet::Ptr _psp
Definition: Event.h:117
Class for handling dates/times, including MJD, UTC, and TAI.
Definition: DateTime.h:58
static const std::string EVENTTIME
Definition: Event.h:72
long long lsst.ctrl.events::Event::getEventTime ( )

Definition at line 211 of file Event.cc.

211  {
212  return _psp->get<long long>(EVENTTIME);
213 }
PropertySet::Ptr _psp
Definition: Event.h:117
static const std::string EVENTTIME
Definition: Event.h:72
std::string lsst.ctrl.events::Event::getExceptionType ( )
vector< std::string > lsst.ctrl.events::Event::getFilterablePropertyNames ( )

Definition at line 120 of file Event.cc.

120  {
121  vector<std::string> _names;
122  set<std::string>::iterator keyIterator;
123  for (keyIterator = _keywords.begin(); keyIterator != _keywords.end(); keyIterator++) {
124  _names.push_back(*keyIterator);
125  }
126  return _names;
127 }
set< std::string > _keywords
Definition: Event.h:118
std::string lsst.ctrl.events::Event::getHostId ( )

Definition at line 276 of file Event.cc.

276  {
277  return _psp->get<std::string>(HOSTID);
278 }
static const std::string HOSTID
Definition: Event.h:73
PropertySet::Ptr _psp
Definition: Event.h:117
PropertySet::Ptr lsst.ctrl.events::Event::getPropertySet ( ) const

Definition at line 244 of file Event.cc.

244  {
245  if (_psp != 0) {
246  PropertySet::Ptr psp = _psp->deepCopy();
247  return psp;
248  }
249  PropertySet::Ptr psp(new PropertySet);
250  return psp;
251 }
PropertySet::Ptr _psp
Definition: Event.h:117
boost::shared_ptr< PropertySet > Ptr
Definition: PropertySet.h:90
Class for storing generic metadata.
Definition: PropertySet.h:82
std::string lsst.ctrl.events::Event::getPubDate ( )

Get the publication date of this event.

Returns
A formatted date string represeting the publication time

Definition at line 264 of file Event.cc.

264  {
265  long long _pubTime = _psp->get<long long>(PUBTIME);
266  if (_pubTime == 0)
267  return std::string();
268 
269  dafBase::DateTime dateTime(_pubTime);
270 
271  struct tm pubTime = dateTime.gmtime();
272  return asctime(&pubTime);
273 }
PropertySet::Ptr _psp
Definition: Event.h:117
Class for handling dates/times, including MJD, UTC, and TAI.
Definition: DateTime.h:58
static const std::string PUBTIME
Definition: Event.h:77
long long lsst.ctrl.events::Event::getPubTime ( )

Definition at line 257 of file Event.cc.

257  {
258  return _psp->get<long long>(PUBTIME);
259 }
PropertySet::Ptr _psp
Definition: Event.h:117
static const std::string PUBTIME
Definition: Event.h:77
std::string lsst.ctrl.events::Event::getRunId ( )

Definition at line 280 of file Event.cc.

280  {
281  return _psp->get<std::string>(RUNID);
282 }
PropertySet::Ptr _psp
Definition: Event.h:117
static const std::string RUNID
Definition: Event.h:74
std::string lsst.ctrl.events::Event::getStackTrace ( )
std::string lsst.ctrl.events::Event::getStatus ( )

Definition at line 288 of file Event.cc.

288  {
289  return _psp->get<std::string>(STATUS);
290 }
PropertySet::Ptr _psp
Definition: Event.h:117
static const std::string STATUS
Definition: Event.h:75
std::string lsst.ctrl.events::Event::getTopic ( )

Definition at line 300 of file Event.cc.

300  {
301  return _psp->get<std::string>(TOPIC);
302 }
PropertySet::Ptr _psp
Definition: Event.h:117
static const std::string TOPIC
Definition: Event.h:76
std::string lsst.ctrl.events::Event::getType ( void  )

Definition at line 284 of file Event.cc.

284  {
285  return _psp->get<std::string>(TYPE);
286 }
PropertySet::Ptr _psp
Definition: Event.h:117
static const std::string TYPE
Creates Event which contains a PropertySet.
Definition: Event.h:71
void lsst.ctrl.events::Event::marshall ( cms::TextMessage *  msg)

Definition at line 304 of file Event.cc.

304  {
305  PropertySet::Ptr psp;
306 
307  populateHeader(msg);
308  psp = getCustomPropertySet();
309  std::string payload = marshall(*psp);
310  msg->setText(payload);
311 }
virtual void populateHeader(cms::TextMessage *msg) const
Definition: Event.cc:201
boost::shared_ptr< PropertySet > Ptr
Definition: PropertySet.h:90
void marshall(cms::TextMessage *msg)
Definition: Event.cc:304
PropertySet::Ptr getCustomPropertySet() const
Definition: Event.cc:235
std::string lsst.ctrl.events::Event::marshall ( const PropertySet ps)
private

Definition at line 314 of file Event.cc.

314  {
315  std::vector<std::string> v = ps.paramNames(false);
316 
317  // TODO: optimize this to get use getArray only when necessary
318  std::ostringstream payload;
319  unsigned int i;
320  payload << "nodelist||nodelist||" << (v.size()) << "~~";
321  for (i = 0; i < v.size(); i++) {
322  std::string name = v[i];
323  if (ps.typeOf(name) == typeid(bool)) {
324  std::vector<bool> vec = ps.getArray<bool>(name);
325  std::vector<bool>::iterator iter;
326  for (iter = vec.begin(); iter != vec.end(); iter++) {
327  payload << "bool||"<< name << "||" << *iter << "~~";
328  }
329  } else if (ps.typeOf(name) == typeid(long)) {
330  std::vector<long> vec = ps.getArray<long>(name);
331  std::vector<long>::iterator iter;
332  for (iter = vec.begin(); iter != vec.end(); iter++) {
333  payload << "long||" << name << "||"<< *iter << "~~";
334  }
335  } else if (ps.typeOf(name) == typeid(int)) {
336  std::vector<int> vec = ps.getArray<int>(name);
337  std::vector<int>::iterator iter;
338  for (iter = vec.begin(); iter != vec.end(); iter++) {
339  payload << "int||" << name << "||"<< *iter << "~~";
340  }
341  } else if (ps.typeOf(name) == typeid(float)) {
342  std::vector<float> vec = ps.getArray<float>(name);
343  std::vector<float>::iterator iter;
344  payload.precision(numeric_limits<float>::digits10+1);
345  for (iter = vec.begin(); iter != vec.end(); iter++) {
346  payload << "float||"<< name << "||"<< *iter << "~~";
347  }
348  } else if (ps.typeOf(name) == typeid(double)) {
349  std::vector<double> vec = ps.getArray<double>(name);
350  std::vector<double>::iterator iter;
351  payload.precision(numeric_limits<double>::digits10+1);
352  for (iter = vec.begin(); iter != vec.end(); iter++) {
353  payload << "double||"<< name << "||"<< *iter << "~~";
354  }
355  } else if (ps.typeOf(name) == typeid(std::string)) {
356  std::vector<std::string> vec = ps.getArray<std::string>(name);
357  std::vector<std::string>::iterator iter;
358  for (iter = vec.begin(); iter != vec.end(); iter++) {
359  payload << "string||" << name << "||"<< *iter << "~~";
360  }
361  } else if (ps.typeOf(name) == typeid(lsst::daf::base::DateTime)) {
362  std::vector<lsst::daf::base::DateTime> vec = ps.getArray<lsst::daf::base::DateTime>(name);
363  std::vector<lsst::daf::base::DateTime>::iterator iter;
364  for (iter = vec.begin(); iter != vec.end(); iter++) {
365  payload << "datetime||" << name << "||"<< (*iter).nsecs() << "~~";
366  }
367  } else {
368  std::cout << "Couldn't marshall "<< name << std::endl;
369  }
370  }
371  return payload.str();
372 }
std::vector< std::string > paramNames(bool topLevelOnly=true) const
Definition: PropertySet.cc:142
Class for handling dates/times, including MJD, UTC, and TAI.
Definition: DateTime.h:58
int iter
std::type_info const & typeOf(std::string const &name) const
Definition: PropertySet.cc:227
std::vector< T > getArray(std::string const &name) const
void lsst.ctrl.events::Event::populateHeader ( cms::TextMessage *  msg)
void lsst.ctrl.events::Event::populateHeader ( cms::TextMessage *  msg) const
virtual

Reimplemented in lsst.ctrl.events::PipelineLogEvent, lsst.ctrl.events::CommandEvent, lsst.ctrl.events::LogEvent, and lsst.ctrl.events::StatusEvent.

Definition at line 201 of file Event.cc.

201  {
202  msg->setStringProperty(TYPE, _psp->get<std::string>(TYPE));
203  msg->setLongProperty(EVENTTIME, _psp->get<long long>(EVENTTIME));
204  msg->setStringProperty(HOSTID, _psp->get<std::string>(HOSTID));
205  msg->setStringProperty(RUNID, _psp->get<std::string>(RUNID));
206  msg->setStringProperty(STATUS, _psp->get<std::string>(STATUS));
207  msg->setStringProperty(TOPIC, _psp->get<std::string>(TOPIC));
208  msg->setLongProperty(PUBTIME, _psp->get<long long>(PUBTIME));
209 }
static const std::string HOSTID
Definition: Event.h:73
PropertySet::Ptr _psp
Definition: Event.h:117
static const std::string TYPE
Creates Event which contains a PropertySet.
Definition: Event.h:71
static const std::string TOPIC
Definition: Event.h:76
static const std::string RUNID
Definition: Event.h:74
static const std::string PUBTIME
Definition: Event.h:77
static const std::string STATUS
Definition: Event.h:75
static const std::string EVENTTIME
Definition: Event.h:72
PropertySet::Ptr lsst.ctrl.events::Event::processTextMessage ( cms::TextMessage *  textMessage)
private

private method unmarshall the DataProperty from the TextMessage

Definition at line 376 of file Event.cc.

376  {
377  if (textMessage == NULL)
378  return PropertySet::Ptr();
379 
380  std::string text = textMessage->getText();
381 
382  return unmarshall(text);
383 }
boost::shared_ptr< PropertySet > Ptr
Definition: PropertySet.h:90
PropertySet::Ptr unmarshall(const std::string &text)
Definition: Event.cc:387
void lsst.ctrl.events::Event::setEventTime ( long long  nsecs)

Definition at line 215 of file Event.cc.

215  {
216  _psp->set(EVENTTIME, nsecs);
217 }
PropertySet::Ptr _psp
Definition: Event.h:117
static const std::string EVENTTIME
Definition: Event.h:72
void lsst.ctrl.events::Event::setPubTime ( long long  t)

Definition at line 253 of file Event.cc.

253  {
254  _psp->set(PUBTIME, t);
255 }
PropertySet::Ptr _psp
Definition: Event.h:117
static const std::string PUBTIME
Definition: Event.h:77
void lsst.ctrl.events::Event::setStatus ( std::string  status)

Definition at line 292 of file Event.cc.

292  {
293  return _psp->set(STATUS, status);
294 }
int status
PropertySet::Ptr _psp
Definition: Event.h:117
static const std::string STATUS
Definition: Event.h:75
void lsst.ctrl.events::Event::setTopic ( std::string  topic)

Definition at line 296 of file Event.cc.

296  {
297  _psp->set(TOPIC, topic);
298 }
PropertySet::Ptr _psp
Definition: Event.h:117
static const std::string TOPIC
Definition: Event.h:76
void lsst.ctrl.events::Event::splitString ( std::string  str,
std::string  delim,
std::vector< std::string > &  results 
)
protected

private method to split a string along it's delimiters and return the results in a vector

Definition at line 455 of file Event.cc.

456  {
457  std::string::size_type cutAt;
458  std::string::size_type delim_len = delim.length();
459 
460  while( (cutAt = str.find(delim)) != str.npos ) {
461  if(cutAt > 0) {
462  results.push_back(str.substr(0,cutAt));
463  }
464  str = str.substr(cutAt+delim_len);
465  }
466  if(str.length() > 0) {
467  results.push_back(str);
468  }
469 }
void lsst.ctrl.events::Event::splitTuple ( std::string  str,
std::string  delim,
std::vector< std::string > &  results 
)
protected

private method to split a tuple string along it's delimiters and return the results in a vector; don't try and modify splitString to do this.

Definition at line 474 of file Event.cc.

475  {
476  std::string::size_type cutAt;
477  std::string::size_type delim_len = delim.length();
478 
479  cutAt = str.find(delim);
480  results.push_back(str.substr(0,cutAt));
481  str = str.substr(cutAt+delim_len);
482 
483  cutAt = str.find(delim);
484  results.push_back(str.substr(0,cutAt));
485  str = str.substr(cutAt+delim_len);
486 
487  cutAt = str.find(delim);
488  results.push_back(str.substr(0,cutAt));
489 }
PropertySet::Ptr lsst.ctrl.events::Event::unmarshall ( const std::string &  text)
private

private method unmarshall the DataProperty from a text string

Definition at line 387 of file Event.cc.

387  {
388  std::vector<string> tuples;
389 
390  // split the text into tuples
391  splitString(text, "~~", tuples);
392 
393 
394  PropertySet::Ptr psp(new PropertySet);
395 
396  unsigned int i;
397  for (i = 0; i < tuples.size(); i++) {
398  std::string line = tuples.at(i);
399  std::vector<string> vec;
400  splitTuple(line, "||", vec);
401 
402  std::string type = vec.at(0);
403  std::string key = vec.at(1);
404  std::string val = vec.at(2);
405 
406  std::istringstream iss(val);
407  boost::any value;
408 
409  if (type == "int") {
410  int int_value;
411  iss >> int_value;
412  value = boost::any(int_value);
413  psp->add(key, int_value);
414  } else if (type == "bool") {
415  bool bool_value;
416  iss >> bool_value;
417  value = boost::any(bool_value);
418  psp->add(key, bool_value);
419  } else if (type == "long long") {
420  long long longlong_value;
421  iss >> longlong_value;
422  value = boost::any(longlong_value);
423  psp->add(key, longlong_value);
424  } else if (type == "long") {
425  long long_value;
426  iss >> long_value;
427  value = boost::any(long_value);
428  psp->add(key, long_value);
429  } else if (type == "float") {
430  float float_value;
431  iss >> float_value;
432  value = boost::any(float_value);
433  psp->add(key, float_value);
434  } else if (type == "double") {
435  double double_value;
436  iss >> double_value;
437  value = boost::any(double_value);
438  psp->add(key, double_value);
439  } else if (type == "string") {
440  psp->add(key, val);
441  } else if (type == "datetime") {
442  long long longlong_value;
443  iss >> longlong_value;
444  psp->add(key, lsst::daf::base::DateTime(longlong_value, lsst::daf::base::DateTime::UTC));
445  }
446  // type == nodelist can be ignored
447  }
448 
449  return psp;
450 }
Class for handling dates/times, including MJD, UTC, and TAI.
Definition: DateTime.h:58
boost::shared_ptr< PropertySet > Ptr
Definition: PropertySet.h:90
void splitString(std::string str, std::string delim, std::vector< std::string > &results)
Definition: Event.cc:455
Class for storing generic metadata.
Definition: PropertySet.h:82
void splitTuple(std::string str, std::string delim, std::vector< std::string > &results)
Definition: Event.cc:474
boost::enable_if< typename ExpressionTraits< Scalar >::IsScalar, bool >::type any(Scalar const &scalar)
Definition: operators.h:1165
ImageT val
Definition: CR.cc:154
void lsst.ctrl.events::Event::updateEventTime ( )

Definition at line 219 of file Event.cc.

219  {
220  _psp->set(EVENTTIME, (long long)dafBase::DateTime::now().nsecs());
221 }
static DateTime now(void)
Definition: DateTime.cc:553
PropertySet::Ptr _psp
Definition: Event.h:117
static const std::string EVENTTIME
Definition: Event.h:72

Member Data Documentation

set<std::string> lsst.ctrl.events::Event::_keywords
protected

Definition at line 118 of file Event.h.

PropertySet::Ptr lsst.ctrl.events::Event::_psp
protected

Definition at line 117 of file Event.h.

const std::string lsst.ctrl.events::Event::EVENTTIME = "EVENTTIME"
static

Definition at line 72 of file Event.h.

const std::string lsst.ctrl.events::Event::EXCEPTIONTYPE
static

Definition at line 57 of file ExceptionEvent.h.

const std::string lsst.ctrl.events::Event::HOSTID = "HOSTID"
static

Definition at line 73 of file Event.h.

const std::string lsst.ctrl.events::Event::PUBTIME = "PUBTIME"
static

Definition at line 77 of file Event.h.

const std::string lsst.ctrl.events::Event::RUNID = "RUNID"
static

Definition at line 74 of file Event.h.

const std::string lsst.ctrl.events::Event::STACKTRACE
static

Definition at line 58 of file ExceptionEvent.h.

const std::string lsst.ctrl.events::Event::STATUS = "STATUS"
static

Definition at line 75 of file Event.h.

const std::string lsst.ctrl.events::Event::TOPIC = "TOPIC"
static

Definition at line 76 of file Event.h.

const std::string lsst.ctrl.events::Event::TYPE = "TYPE"
static

Creates Event which contains a PropertySet.

Exceptions
throwsNotFoundError if expected keywords are missing a property set

Definition at line 71 of file Event.h.

const std::string lsst.ctrl.events::Event::UNINITIALIZED = "uninitialized"
static

Definition at line 78 of file Event.h.


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