mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
Add new Send/Receive methods with smart pointers and no flag checks.
This commit is contained in:
committed by
Mohammad Al-Turany
parent
105e734808
commit
a7ab33a10e
@@ -95,6 +95,24 @@ void FairMQMessageZMQ::SetMessage(void* data, size_t size)
|
||||
}
|
||||
|
||||
void FairMQMessageZMQ::Copy(FairMQMessage* msg)
|
||||
{
|
||||
// DEPRECATED: Use Copy(const unique_ptr<FairMQMessage>&)
|
||||
|
||||
// Shares the message buffer between msg and this fMessage.
|
||||
if (zmq_msg_copy(&fMessage, (zmq_msg_t*)msg->GetMessage()) != 0)
|
||||
{
|
||||
LOG(ERROR) << "failed copying message, reason: " << zmq_strerror(errno);
|
||||
}
|
||||
|
||||
// Alternatively, following code does a hard copy of the message, which allows to modify the original after making a copy, without affecting the new msg.
|
||||
|
||||
// CloseMessage();
|
||||
// size_t size = msg->GetSize();
|
||||
// zmq_msg_init_size(&fMessage, size);
|
||||
// memcpy(zmq_msg_data(&fMessage), msg->GetData(), size);
|
||||
}
|
||||
|
||||
void FairMQMessageZMQ::Copy(const unique_ptr<FairMQMessage>& msg)
|
||||
{
|
||||
// Shares the message buffer between msg and this fMessage.
|
||||
if (zmq_msg_copy(&fMessage, (zmq_msg_t*)msg->GetMessage()) != 0)
|
||||
|
@@ -40,6 +40,7 @@ class FairMQMessageZMQ : public FairMQMessage
|
||||
|
||||
virtual void CloseMessage();
|
||||
virtual void Copy(FairMQMessage* msg);
|
||||
virtual void Copy(const std::unique_ptr<FairMQMessage>& msg);
|
||||
|
||||
static void CleanUp(void* data, void* hint);
|
||||
|
||||
|
Reference in New Issue
Block a user