 |
Belle II Software
release-05-02-19
|
12 #include <framework/pcore/EvtMessage.h>
39 explicit CharBuffer(
size_t initial_capacity = 0):
m_data{initial_capacity > 0 ?
new char[initial_capacity] :
nullptr}
68 std::unique_ptr<char[]> newbuf{
new char[
m_capacity]};
82 SetWhat(kMESS_OBJECT);
88 TBuffer::SetBuffer(
const_cast<void*
>(ptr), bufsize,
false);
94 SetBufferOffset(
sizeof(UInt_t) * 2);
100 TObject*
readTObject() {
return static_cast<TObject*
>(ReadObjectAny(TObject::Class())); }
121 virtual void clear();
123 virtual void add(
const TObject*,
const std::string& name);
128 virtual void decode_msg(
EvtMessage* msg, std::vector<TObject*>& objlist, std::vector<std::string>& namelist);
CharBuffer m_compBuf
EvtMessage character buffer for compressing/decompressing.
std::unique_ptr< TMessage > m_msg
Used for serialising objects into m_buf.
void SetBuffer(const void *ptr, UInt_t bufsize)
Replace buffer (doesn't take ownership).
Class to manage streamed object.
virtual ~MsgHandler()
Destructor.
void resize(size_t size)
resize, similar to std::vector<char>::resize in that it will copy the existing buffer to a new,...
virtual EvtMessage * encode_msg(ERecordType rectype)
Stream object list into an EvtMessage.
char * data()
return raw pointer.
virtual void clear()
Clear object list.
Reusable Message class derived from TMessage (for reading only)
InMessage m_inMsg
Used for deserializing in decode_msg()
CharBuffer m_buf
EvtMessage character buffer for encode_msg().
void clear()
reset (without deallocating)
void add(const void *data, size_t len)
copy data to end of buffer, expanding buffer if needed.
Abstract base class for different kinds of events.
int m_complevel
compression algorithm * 100 + compression level.
size_t m_size
current size, <= m_capacity
ERecordType
What type of message is this?
virtual void decode_msg(EvtMessage *msg, std::vector< TObject * > &objlist, std::vector< std::string > &namelist)
Decode an EvtMessage into a vector list of objects with names.
size_t m_capacity
size of allocated memory in m_data
std::unique_ptr< char[]> m_data
data buffer.
CharBuffer(size_t initial_capacity=0)
Constructor, with the initial capacity of the buffer to allocate (in bytes).
TObject * readTObject()
Read one object from the message assuming it inherits from TObject.
size_t size() const
return buffer size (do not access data() beyond this)
MsgHandler(int complevel=0)
Constructor.
virtual void add(const TObject *, const std::string &name)
Add an object to be streamed.
A class to encode/decode an EvtMessage.
dynamic character buffer that knows its size.