00001 // $Id: EventMsg.cc,v 1.3 2011/03/08 18:44:55 mommsen Exp $ 00003 00004 #include "EventFilter/SMProxyServer/interface/EventMsg.h" 00005 00006 00007 namespace smproxy 00008 { 00009 00010 EventMsg::EventMsg() : 00011 faulty_(true), 00012 droppedEventsCount_(0) 00013 {} 00014 00015 00016 EventMsg::EventMsg(const EventMsgView& eventMsgView) : 00017 faulty_(false) 00018 { 00019 buf_.reset( new EventMsgBuffer(eventMsgView.size()) ); 00020 std::copy( 00021 eventMsgView.startAddress(), 00022 eventMsgView.startAddress()+eventMsgView.size(), 00023 &(*buf_)[0] 00024 ); 00025 droppedEventsCount_ = eventMsgView.droppedEventsCount(); 00026 } 00027 00028 00029 void EventMsg::tagForEventConsumers(const stor::QueueIDs& queueIDs) 00030 { 00031 queueIDs_ = queueIDs; 00032 } 00033 00034 00035 const stor::QueueIDs& EventMsg::getEventConsumerTags() const 00036 { 00037 return queueIDs_; 00038 } 00039 00040 00041 unsigned int EventMsg::droppedEventsCount() const 00042 { 00043 return droppedEventsCount_; 00044 } 00045 00046 00047 void EventMsg::setDroppedEventsCount(unsigned int count) 00048 { 00049 EventHeader* header = (EventHeader*)dataLocation(); 00050 convert(count,header->droppedEventsCount_); 00051 } 00052 00053 00054 size_t EventMsg::memoryUsed() const 00055 { 00056 return sizeof(buf_); 00057 } 00058 00059 00060 unsigned long EventMsg::totalDataSize() const 00061 { 00062 return buf_->size(); 00063 } 00064 00065 00066 unsigned char* EventMsg::dataLocation() const 00067 { 00068 return &(*buf_)[0]; 00069 } 00070 00071 00072 bool EventMsg::empty() const 00073 { 00074 return (buf_.get() == 0); 00075 } 00076 00077 00078 bool EventMsg::faulty() const 00079 { 00080 return faulty_; 00081 } 00082 00083 } // namespace smproxy 00084