mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 08:41:16 +00:00
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
31 lines
1.3 KiB
C++
31 lines
1.3 KiB
C++
/********************************************************************************
|
|
* Copyright (C) 2018 CERN and copyright holders of ALICE O2 *
|
|
* Copyright (C) 2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
|
* *
|
|
* This software is distributed under the terms of the *
|
|
* GNU Lesser General Public Licence (LGPL) version 3, *
|
|
* copied verbatim in the file "LICENSE" *
|
|
********************************************************************************/
|
|
|
|
/// @brief Memory allocators and interfaces related to managing memory via the
|
|
/// trasport layer
|
|
///
|
|
/// @author Mikolaj Krzewicki, mkrzewic@cern.ch
|
|
|
|
#include <fairmq/FairMQTransportFactory.h>
|
|
#include <fairmq/MemoryResources.h>
|
|
|
|
void *fair::mq::ChannelResource::do_allocate(std::size_t bytes, std::size_t /*alignment*/)
|
|
{
|
|
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")}
|
|
{
|
|
}
|