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:
mkrzewic
2018-10-18 13:15:04 +02:00
committed by Dennis Klein
parent 310b9647b5
commit d40bbfe208
30 changed files with 195 additions and 177 deletions

View File

@@ -75,17 +75,15 @@ std::vector<const ElemT, boost::container::pmr::polymorphic_allocator<const Elem
};
//_________________________________________________________________________________________________
/// Return a vector of const ElemT, takes ownership of the message, needs an
/// upstream global
/// ChannelResource to register the message.
/// Return a vector of const ElemT, takes ownership of the message
template<typename ElemT>
std::vector<const ElemT, OwningMessageSpectatorAllocator<const ElemT>>
adoptVector(size_t nelem, ChannelResource *upstream, FairMQMessagePtr message)
adoptVector(size_t nelem, FairMQMessagePtr message)
{
return std::vector<const ElemT, OwningMessageSpectatorAllocator<const ElemT>>(
nelem,
OwningMessageSpectatorAllocator<const ElemT>(
MessageResource{std::move(message), upstream}));
MessageResource{std::move(message)}));
};
//_________________________________________________________________________________________________
@@ -93,7 +91,7 @@ std::vector<const ElemT, OwningMessageSpectatorAllocator<const ElemT>>
// This returns a unique_ptr of const vector, does not allow modifications at
// the cost of pointer
// semantics for access.
// use auto or decltype to catch the return value (or use span)
// use auto or decltype to catch the return type.
// template<typename ElemT>
// auto adoptVector(size_t nelem, FairMQMessage* message)
//{