mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 17:41:45 +00:00
First version of the shared memory transport.
Use via `--transport shmem` cmd option. No pub/sub.
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
string FairMQMessageZMQ::fDeviceID = string();
|
||||
|
||||
FairMQMessageZMQ::FairMQMessageZMQ()
|
||||
: fMessage()
|
||||
{
|
||||
@@ -94,22 +96,9 @@ void FairMQMessageZMQ::SetMessage(void*, const size_t)
|
||||
// dummy method to comply with the interface. functionality not allowed in zeromq.
|
||||
}
|
||||
|
||||
void FairMQMessageZMQ::Copy(FairMQMessage* msg)
|
||||
void FairMQMessageZMQ::SetDeviceId(const string& deviceId)
|
||||
{
|
||||
// DEPRECATED: Use Copy(const unique_ptr<FairMQMessage>&)
|
||||
|
||||
// Shares the message buffer between msg and this fMessage.
|
||||
if (zmq_msg_copy(&fMessage, static_cast<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);
|
||||
fDeviceID = deviceId;
|
||||
}
|
||||
|
||||
void FairMQMessageZMQ::Copy(const unique_ptr<FairMQMessage>& msg)
|
||||
@@ -128,7 +117,7 @@ void FairMQMessageZMQ::Copy(const unique_ptr<FairMQMessage>& msg)
|
||||
// memcpy(zmq_msg_data(&fMessage), msg->GetData(), size);
|
||||
}
|
||||
|
||||
inline void FairMQMessageZMQ::CloseMessage()
|
||||
void FairMQMessageZMQ::CloseMessage()
|
||||
{
|
||||
if (zmq_msg_close(&fMessage) != 0)
|
||||
{
|
||||
|
Reference in New Issue
Block a user