Belle II Software
release-08-01-10
|
Class to manage streamed object. More...
#include <EvtMessage.h>
Public Types | |
enum | EMessageFlags { c_MsgCompressed = 1 } |
Flags for the message. More... | |
Public Member Functions | |
EvtMessage (char *buf=nullptr) | |
build EvtMessage from existing buffer (no copy, but does not take ownership). | |
EvtMessage (const char *msg, int size, ERecordType type) | |
build EvtMessage by allocating new message buffer (sobjs is copied). More... | |
EvtMessage (const EvtMessage &evtmsg) | |
Copy constructor (m_data is copied). More... | |
~EvtMessage () | |
Destructor. More... | |
EvtMessage & | operator= (const EvtMessage &obj) |
Assignment (m_data is copied). More... | |
char * | buffer () |
Get buffer address. More... | |
void | buffer (const char *) |
Set existing buffer address (copies buffer) | |
int | size () const |
Get size of message including headers. More... | |
int | paddedSize () const |
Same as size(), but as size of an integer array. More... | |
int | msg_size () const |
Get size of message body. | |
unsigned int | getVersion () const |
get version of the header. More... | |
unsigned int | getMsgFlags () const |
Get flags of the message. | |
void | setMsgFlags (unsigned int flags) |
Set flags for the message. | |
void | addMsgFlags (unsigned int flags) |
Add flags to the message. | |
bool | hasMsgFlags (unsigned int flags) const |
Check if the message has the given flags. | |
ERecordType | type () const |
Get record type. | |
void | type (ERecordType) |
Set record type. | |
struct timeval | time () const |
Get time stamp. | |
void | setTime (const struct timeval &time) |
Set time stamp. | |
int | src () const |
Get source IP of message. | |
void | src (int src) |
Set source IP of message. | |
int | dest () const |
Get destination IP of message. | |
void | dest (int dest) |
Set destination IP of message. | |
EvtHeader * | header () |
Get pointer to EvtHeader. | |
const EvtHeader * | getHeader () const |
Get pointer to EvtHeader. | |
char * | msg () |
Get pointer to message body. | |
Static Public Attributes | |
static const unsigned int | c_MaxEventSize = 200000000 |
maximal EvtMessage size, in bytes (200MB). | |
Private Member Functions | |
void | setMsg (const char *msg, int size, ERecordType type) |
Copy message into newly allocated buffer. | |
Private Attributes | |
char * | m_data |
Pointer to the internal EvtMessage buffer. | |
bool | m_ownsBuffer |
Wether to clean up m_data in destructor. | |
Class to manage streamed object.
Binary stream consists of: Fields in EvtHeader (see definition) List of streamed objects, each consisting of: word 1 : size of object word 2- : streamed object
Definition at line 59 of file EvtMessage.h.
enum EMessageFlags |
Flags for the message.
Enumerator | |
---|---|
c_MsgCompressed | indicates that the message body is compressed and should be uncompressed using ROOT R__unzip_header and R__unzip before use |
Definition at line 66 of file EvtMessage.h.
EvtMessage | ( | const char * | msg, |
int | size, | ||
ERecordType | type = MSG_EVENT |
||
) |
build EvtMessage by allocating new message buffer (sobjs is copied).
Constructor of EvtMessage allocating new buffer.
msg | data |
size | Length of the data (TMessage) |
type | type of the message |
Definition at line 37 of file EvtMessage.cc.
EvtMessage | ( | const EvtMessage & | evtmsg | ) |
Copy constructor (m_data is copied).
Copy constructor of EvtMessage class.
evtmsg | Original EvtMessage object |
Definition at line 50 of file EvtMessage.cc.
~EvtMessage | ( | ) |
char * buffer | ( | ) |
Get buffer address.
If you own the EvtMessage object, the memory is guaranteed to be at least sizeof(int) * paddedSize() bytes. Bytes exceeding size() are zeroed.
Definition at line 76 of file EvtMessage.cc.
|
inline |
get version of the header.
Returns 0 for no valid version information
Definition at line 107 of file EvtMessage.h.
EvtMessage & operator= | ( | const EvtMessage & | obj | ) |
Assignment (m_data is copied).
Overridden assign operator.
obj | Source object |
Definition at line 64 of file EvtMessage.cc.
int paddedSize | ( | ) | const |
Same as size(), but as size of an integer array.
Use this for passing EvtMessage to RingBuffer::insq().
Definition at line 99 of file EvtMessage.cc.
int size | ( | ) | const |
Get size of message including headers.
Often, you'll want to use paddedSize() instead.
Definition at line 94 of file EvtMessage.cc.