KaliVeda
Toolkit for HIC analysis
KVZMQMessage Class Reference

Detailed Description

Allow to send/receive ROOT/KV objects between ZeroMQ sockets.

Examples of use

Sending an object

// ZMQ socket
zmq::socket_t socket;
// pointer to object
TObject* obj;
KVZMQMessage message;
message.WriteObject(obj);
socket.send(message.GetMessage());
Allow to send/receive ROOT/KV objects between ZeroMQ sockets.
Definition: KVZMQMessage.h:46
virtual void WriteObject(const TObject *obj, Bool_t cacheReuse=kTRUE)
Definition: KVZMQMessage.h:71
zmq::message_t & GetMessage()
Definition: KVZMQMessage.h:77

Receiving an object

// ZMQ socket
zmq::socket_t socket;
// ZMQ message
zmq::message_t zmq_message;
if(socket.recv(&zmq_message))
{
KVZMQMessage message(zmq_message);
TObject* object = message.GetObject();
}
TObject * GetObject()
Definition: KVZMQMessage.h:82

Definition at line 46 of file KVZMQMessage.h.

#include <KVZMQMessage.h>

Inheritance diagram for KVZMQMessage:

Public Member Functions

 KVZMQMessage ()
 
 KVZMQMessage (zmq::message_t &g)
 
virtual ~KVZMQMessage ()
 
zmq::message_t & GetMessage ()
 
TObject * GetObject ()
 
template<class T >
T * GetObject ()
 
virtual void WriteObject (const TObject *obj, Bool_t cacheReuse=kTRUE)
 

Private Attributes

zmq::message_t fMessage
 
std::unique_ptr< TObject > fObject
 
Bool_t fReadNewObject
 

Constructor & Destructor Documentation

◆ KVZMQMessage() [1/2]

KVZMQMessage::KVZMQMessage ( )
inline

Definition at line 52 of file KVZMQMessage.h.

◆ KVZMQMessage() [2/2]

KVZMQMessage::KVZMQMessage ( zmq::message_t &  g)
inline

stop the underlying TBuffer from deleting the buffer which in our case belongs to the zmq::message_t object

Definition at line 57 of file KVZMQMessage.h.

◆ ~KVZMQMessage()

virtual KVZMQMessage::~KVZMQMessage ( )
inlinevirtual

Definition at line 65 of file KVZMQMessage.h.

Member Function Documentation

◆ GetMessage()

zmq::message_t& KVZMQMessage::GetMessage ( )
inline

Definition at line 77 of file KVZMQMessage.h.

◆ GetObject() [1/2]

TObject* KVZMQMessage::GetObject ( )
inline

Definition at line 82 of file KVZMQMessage.h.

◆ GetObject() [2/2]

template<class T >
T* KVZMQMessage::GetObject ( )
inline

Definition at line 91 of file KVZMQMessage.h.

◆ WriteObject()

virtual void KVZMQMessage::WriteObject ( const TObject *  obj,
Bool_t  cacheReuse = kTRUE 
)
inlinevirtual

Definition at line 71 of file KVZMQMessage.h.

Member Data Documentation

◆ fMessage

zmq::message_t KVZMQMessage::fMessage
private

Definition at line 49 of file KVZMQMessage.h.

◆ fObject

std::unique_ptr<TObject> KVZMQMessage::fObject
private

Definition at line 47 of file KVZMQMessage.h.

◆ fReadNewObject

Bool_t KVZMQMessage::fReadNewObject
private

Definition at line 48 of file KVZMQMessage.h.