Belle II Software light-2406-ragdoll
|
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). | |
EvtMessage (const EvtMessage &evtmsg) | |
Copy constructor (m_data is copied). | |
~EvtMessage () | |
Destructor. | |
EvtMessage & | operator= (const EvtMessage &obj) |
Assignment (m_data is copied). | |
char * | buffer () |
Get buffer address. | |
void | buffer (const char *) |
Set existing buffer address (copies buffer) | |
int | size () const |
Get size of message including headers. | |
int | paddedSize () const |
Same as size(), but as size of an integer array. | |
int | msg_size () const |
Get size of message body. | |
unsigned int | getVersion () const |
get version of the header. | |
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.
|
explicit |
build EvtMessage from existing buffer (no copy, but does not take ownership).
Definition at line 27 of file EvtMessage.cc.
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 | ( | ) |
|
inline |
Add flags to the message.
Definition at line 113 of file EvtMessage.h.
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.
void buffer | ( | const char * | bufadr | ) |
Set existing buffer address (copies buffer)
Definition at line 81 of file EvtMessage.cc.
int dest | ( | ) | const |
void dest | ( | int | dest | ) |
Set destination IP of message.
Definition at line 141 of file EvtMessage.cc.
const EvtHeader * getHeader | ( | ) | const |
Get pointer to EvtHeader.
Definition at line 166 of file EvtMessage.cc.
|
inline |
Get flags of the message.
Definition at line 109 of file EvtMessage.h.
|
inline |
get version of the header.
Returns 0 for no valid version information
Definition at line 107 of file EvtMessage.h.
|
inline |
Check if the message has the given flags.
Definition at line 115 of file EvtMessage.h.
EvtHeader * header | ( | ) |
Get pointer to EvtHeader.
Definition at line 161 of file EvtMessage.cc.
char * msg | ( | ) |
Get pointer to message body.
Definition at line 172 of file EvtMessage.cc.
int msg_size | ( | ) | const |
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.
|
private |
Copy message into newly allocated buffer.
Definition at line 179 of file EvtMessage.cc.
|
inline |
Set flags for the message.
Definition at line 111 of file EvtMessage.h.
void setTime | ( | const struct timeval & | time | ) |
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.
int src | ( | ) | const |
void src | ( | int | src | ) |
Set source IP of message.
Definition at line 130 of file EvtMessage.cc.
struct timeval time | ( | ) | const |
ERecordType type | ( | ) | const |
Get record type.
Definition at line 114 of file EvtMessage.cc.
void type | ( | ERecordType | type | ) |
Set record type.
Definition at line 119 of file EvtMessage.cc.
|
static |
maximal EvtMessage size, in bytes (200MB).
Definition at line 63 of file EvtMessage.h.
|
private |
Pointer to the internal EvtMessage buffer.
Definition at line 148 of file EvtMessage.h.
|
private |
Wether to clean up m_data in destructor.
Definition at line 149 of file EvtMessage.h.