00001 // $Id: EventConsumerRegistrationInfo.h,v 1.15 2011/08/31 20:11:59 wmtan Exp $ 00003 00004 #ifndef EventFilter_StorageManager_EventConsumerRegistrationInfo_h 00005 #define EventFilter_StorageManager_EventConsumerRegistrationInfo_h 00006 00007 #include <iosfwd> 00008 #include <string> 00009 00010 #include <boost/shared_ptr.hpp> 00011 00012 #include "toolbox/net/Utils.h" 00013 00014 #include "EventFilter/StorageManager/interface/Configuration.h" 00015 #include "EventFilter/StorageManager/interface/RegistrationInfoBase.h" 00016 #include "EventFilter/StorageManager/interface/Utils.h" 00017 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00018 #include "IOPool/Streamer/interface/MsgHeader.h" 00019 #include "IOPool/Streamer/interface/MsgTools.h" 00020 00021 #include <boost/enable_shared_from_this.hpp> 00022 00023 00024 namespace stor 00025 { 00034 class EventConsumerRegistrationInfo : 00035 public RegistrationInfoBase, 00036 public boost::enable_shared_from_this<EventConsumerRegistrationInfo> 00037 { 00038 00039 public: 00040 00041 EventConsumerRegistrationInfo 00042 ( 00043 const edm::ParameterSet& pset, 00044 const EventServingParams& eventServingParams, 00045 const std::string& remoteHost = toolbox::net::getHostName() 00046 ); 00047 00048 EventConsumerRegistrationInfo 00049 ( 00050 const edm::ParameterSet& pset, 00051 const std::string& remoteHost = toolbox::net::getHostName() 00052 ); 00053 00054 ~EventConsumerRegistrationInfo() {}; 00055 00056 // Accessors: 00057 const std::string& triggerSelection() const { return triggerSelection_; } 00058 const Strings& eventSelection() const { return eventSelection_; } 00059 const std::string& outputModuleLabel() const { return outputModuleLabel_; } 00060 const int& prescale() const { return prescale_; } 00061 const bool& uniqueEvents() const { return uniqueEvents_; } 00062 const int& headerRetryInterval() const { return headerRetryInterval_; } 00063 uint32 eventRequestCode() const { return Header::EVENT_REQUEST; } 00064 uint32 eventCode() const { return Header::EVENT; } 00065 std::string eventURL() const { return sourceURL() + "/geteventdata"; } 00066 std::string registerURL() const { return sourceURL() + "/registerConsumer"; } 00067 00068 // Comparison: 00069 bool operator<(const EventConsumerRegistrationInfo&) const; 00070 bool operator==(const EventConsumerRegistrationInfo&) const; 00071 bool operator!=(const EventConsumerRegistrationInfo&) const; 00072 00073 // Output: 00074 std::ostream& write(std::ostream& os) const; 00075 00076 // Implementation of Template Method pattern. 00077 virtual void do_registerMe(EventDistributor*); 00078 virtual void do_eventType(std::ostream&) const; 00079 virtual void do_appendToPSet(edm::ParameterSet&) const; 00080 00081 private: 00082 00083 void parsePSet(const edm::ParameterSet&); 00084 00085 std::string triggerSelection_; 00086 Strings eventSelection_; 00087 std::string outputModuleLabel_; 00088 int prescale_; 00089 bool uniqueEvents_; 00090 int headerRetryInterval_; 00091 }; 00092 00093 typedef boost::shared_ptr<stor::EventConsumerRegistrationInfo> EventConsRegPtr; 00094 00095 } // namespace stor 00096 00097 #endif // EventFilter_StorageManager_EventConsumerRegistrationInfo_h 00098