mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 17:41:45 +00:00
Equip FairMQMessage with pointer to factory (at creation)
the patch seems big but most of it is just propagating the new notion of constness of the factory - since it keeps track of created messages with the internal allocator it no longer is const
This commit is contained in:
@@ -17,9 +17,14 @@
|
||||
|
||||
void *fair::mq::ChannelResource::do_allocate(std::size_t bytes, std::size_t /*alignment*/)
|
||||
{
|
||||
FairMQMessagePtr message;
|
||||
message = factory->CreateMessage(bytes);
|
||||
void *addr = message->GetData();
|
||||
messageMap[addr] = std::move(message);
|
||||
return addr;
|
||||
return setMessage(factory->CreateMessage(bytes));
|
||||
};
|
||||
|
||||
fair::mq::MessageResource::MessageResource(FairMQMessagePtr message)
|
||||
: mUpstream{message->GetTransport()->GetMemoryResource()}
|
||||
, mMessageSize{message->GetSize()}
|
||||
, mMessageData{mUpstream ? mUpstream->setMessage(std::move(message))
|
||||
: throw std::runtime_error(
|
||||
"MessageResource::MessageResource message has no upstream resource set")}
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user