LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Event.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008-2015 AURA/LSST.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <https://www.lsstcorp.org/LegalNotices/>.
23  */
24 
34 #ifndef LSST_CTRL_EVENTS_EVENT_H
35 #define LSST_CTRL_EVENTS_EVENT_H
36 
37 #include <cms/Connection.h>
38 #include <cms/Session.h>
39 #include <cms/Message.h>
40 
41 #include <stdlib.h>
42 #include <iostream>
43 #include <set>
44 
45 #include "lsst/utils/Utils.h"
47 #include "boost/property_tree/ptree.hpp"
48 
50 
51 using namespace std;
52 
53 namespace lsst {
54 namespace ctrl {
55 namespace events {
56 
62 class Event
63 {
64 public:
65 
66  static const std::string TYPE;
67  static const std::string EVENTTIME;
68  static const std::string RUNID;
69  static const std::string STATUS;
70  static const std::string TOPIC;
71  static const std::string PUBTIME;
72  static const std::string UNINITIALIZED;
73 
77  Event();
78 
83  Event(PropertySet const& properties);
84 
91  Event(PropertySet const& properties, PropertySet const& filterable);
92 
98  Event(std::string const& runid, PropertySet::Ptr const properties);
99 
105  Event(std::string const& runid, PropertySet const& properties);
106 
114  Event(std::string const& runid, PropertySet const& properties, PropertySet const& filterable);
119  Event(cms::TextMessage *msg);
120 
124  virtual ~Event();
125 
130  PropertySet::Ptr getPropertySet() const;
131 
135  std::string getPubDate();
136 
141  long long getPubTime();
142 
146  void setPubTime(long long t);
147 
152  long long getEventTime();
153 
157  void setEventTime(long long nsecs);
158 
162  void updateEventTime();
163 
168  std::string getEventDate();
169 
174  std::string getRunId();
175 
180  std::string getType();
181 
186  std::string getStatus();
187 
192  void setStatus(std::string status);
193 
198  void setTopic(std::string topic);
199 
204  std::string getTopic();
205 
210  vector<std::string> getFilterablePropertyNames();
211 
216  vector<std::string> getCustomPropertyNames();
217 
222  PropertySet::Ptr getCustomPropertySet() const;
223 
228  virtual void populateHeader(cms::TextMessage* msg) const;
229 
233  void marshall(cms::TextMessage *msg);
234 
235 protected:
238  set<std::string> _keywords;
239  void _init();
240  void _constructor(std::string const& runid, PropertySet const& properties, PropertySet const& filterable);
241 
242  template<typename T>void add(std::string const& name, std::string const& tag, PropertySet const& properties, boost::property_tree::ptree& child);
243 
244 
245 private:
246  std::string marshall(PropertySet const& properties);
247  PropertySet::Ptr processTextMessage(cms::TextMessage *textMessage);
248  PropertySet::Ptr unmarshall(std::string const& text);
249  PropertySet::Ptr parsePropertySet(boost::property_tree::ptree child);
250  bool addDataItem(std::string const& typeInfo, boost::property_tree::ptree& item, std::string const& key, PropertySet& properties);
251 };
252 
253 }
254 }
255 }
256 
257 
258 #endif /*end LSST_CTRL_EVENTS_EVENT_H*/
static const std::string STATUS
Definition: Event.h:69
static const std::string TOPIC
Definition: Event.h:70
table::Key< std::string > name
Definition: ApCorrMap.cc:71
static const std::string RUNID
Definition: Event.h:68
PropertySet::Ptr _psp
Definition: Event.h:236
boost::shared_ptr< PropertySet > Ptr
Definition: PropertySet.h:90
static const std::string EVENTTIME
Definition: Event.h:67
lsst::daf::base::PropertySet PropertySet
Definition: Wcs.cc:58
static const std::string PUBTIME
Definition: Event.h:71
set< std::string > _keywords
Definition: Event.h:238
PropertySet::Ptr _filterable
Definition: Event.h:237
int status
static const std::string TYPE
Definition: Event.h:66
Representation of an LSST Event.
Definition: Event.h:62
Class for storing generic metadata.
Definition: PropertySet.h:82
static const std::string UNINITIALIZED
Definition: Event.h:72
Interface for PropertySet class.