CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/IOPool/Streamer/interface/ConsRegMessage.h

Go to the documentation of this file.
00001 #ifndef IOPool_Streamer_ConsumerRegMessage_h
00002 #define IOPool_Streamer_ConsumerRegMessage_h
00003 
00012 #include "IOPool/Streamer/interface/MsgTools.h"
00013 #include "IOPool/Streamer/interface/MsgHeader.h"
00014 #include <map>
00015 
00016 // --------------- registration request builder ----------------
00017 
00018 class ConsRegRequestBuilder
00019 {
00020  public:
00021   ConsRegRequestBuilder(void* buf, uint32 bufSize,
00022                         std::string const& consumerName,
00023                         std::string const& consumerPriority,
00024                         std::string const& requestParameterSet);
00025 
00026   uint32 bufferSize() const { return bufSize_; }
00027   uint8* startAddress() { return buf_; }
00028   uint32 size() const;
00029 
00030  private:
00031   uint8* buf_;
00032   uint32 bufSize_;
00033 };
00034 
00035 // --------------- registration request viewer -----------------
00036 
00037 class ConsRegRequestView
00038 {
00039  public:
00040   ConsRegRequestView(void* buf);
00041 
00042   uint32 code() const { return head_.code(); }
00043   uint32 size() const { return head_.size(); }
00044   uint8* startAddress() { return buf_; }
00045 
00046   std::string getConsumerName() { return consumerName_; }
00047   std::string getConsumerPriority() { return consumerPriority_; }
00048   std::string getRequestParameterSet() { return requestParameterSet_; }
00049 
00050  private:
00051   uint8* buf_;
00052   HeaderView head_;
00053   std::string consumerName_;
00054   std::string consumerPriority_;
00055   std::string requestParameterSet_;
00056 };
00057 
00058 // -------------- registration response builder ----------------
00059 
00060 class ConsRegResponseBuilder
00061 {
00062  public:
00063   ConsRegResponseBuilder(void* buf, uint32 bufSize,
00064                          uint32 status, uint32 consumerId);
00065 
00066   uint32 bufferSize() const { return bufSize_; }
00067   uint8* startAddress() { return buf_; }
00068   uint32 size() const;
00069 
00070   void setStreamSelectionTable(std::map<std::string, Strings> const& selTable);
00071 
00072   enum STATUS_CODES { ES_NOT_READY = 0x10000 };
00073 
00074  private:
00075   uint8* buf_;
00076   uint32 bufSize_;
00077 };
00078 
00079 // -------------- registration response viewer -----------------
00080 
00081 class ConsRegResponseView
00082 {
00083  public:
00084   ConsRegResponseView(void* buf);
00085 
00086   uint32 code() const { return head_.code(); }
00087   uint32 size() const { return head_.size(); }
00088   uint8* startAddress() { return buf_; }
00089 
00090   uint32 getStatus() { return status_; }
00091   uint32 getConsumerId() { return consumerId_; }
00092   std::map<std::string, Strings> getStreamSelectionTable();
00093 
00094  private:
00095   uint8* buf_;
00096   HeaderView head_;
00097   uint32 status_;
00098   uint32 consumerId_;
00099 };
00100 
00101 #endif