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