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& requestParameterSet); 00024 00025 uint32 bufferSize() const { return bufSize_; } 00026 uint8* startAddress() { return buf_; } 00027 uint32 size() const; 00028 00029 private: 00030 uint8* buf_; 00031 uint32 bufSize_; 00032 }; 00033 00034 // --------------- registration request viewer ----------------- 00035 00036 class ConsRegRequestView 00037 { 00038 public: 00039 ConsRegRequestView(void* buf); 00040 00041 uint32 code() const { return head_.code(); } 00042 uint32 size() const { return head_.size(); } 00043 uint8* startAddress() { return buf_; } 00044 00045 std::string getConsumerName() { return consumerName_; } 00046 std::string getRequestParameterSet() { return requestParameterSet_; } 00047 00048 private: 00049 uint8* buf_; 00050 HeaderView head_; 00051 std::string consumerName_; 00052 std::string requestParameterSet_; 00053 }; 00054 00055 // -------------- registration response builder ---------------- 00056 00057 class ConsRegResponseBuilder 00058 { 00059 public: 00060 ConsRegResponseBuilder(void* buf, uint32 bufSize, 00061 uint32 status, uint32 consumerId); 00062 00063 uint32 bufferSize() const { return bufSize_; } 00064 uint8* startAddress() { return buf_; } 00065 uint32 size() const; 00066 00067 void setStreamSelectionTable(std::map<std::string, Strings> const& selTable); 00068 00069 enum STATUS_CODES { ES_NOT_READY = 0x10000 }; 00070 00071 private: 00072 uint8* buf_; 00073 uint32 bufSize_; 00074 }; 00075 00076 // -------------- registration response viewer ----------------- 00077 00078 class ConsRegResponseView 00079 { 00080 public: 00081 ConsRegResponseView(void* buf); 00082 00083 uint32 code() const { return head_.code(); } 00084 uint32 size() const { return head_.size(); } 00085 uint8* startAddress() { return buf_; } 00086 00087 uint32 getStatus() { return status_; } 00088 uint32 getConsumerId() { return consumerId_; } 00089 std::map<std::string, Strings> getStreamSelectionTable(); 00090 00091 private: 00092 uint8* buf_; 00093 HeaderView head_; 00094 uint32 status_; 00095 uint32 consumerId_; 00096 }; 00097 00098 #endif