Rename adoptVector into getVector

This commit is contained in:
mkrzewic 2018-10-29 11:37:25 +01:00 committed by Dennis Klein
parent 1f42f49ae5
commit 1a07137dda
2 changed files with 4 additions and 4 deletions

View File

@ -66,7 +66,7 @@ FairMQMessagePtr getMessage(ContainerT &&container_, FairMQMemoryResource *targe
/// Resource must be kept alive throughout the lifetime of the /// Resource must be kept alive throughout the lifetime of the
/// container and associated message. /// container and associated message.
template<typename ElemT> template<typename ElemT>
std::vector<const ElemT, boost::container::pmr::polymorphic_allocator<const ElemT>> adoptVector( std::vector<const ElemT, boost::container::pmr::polymorphic_allocator<const ElemT>> getVector(
size_t nelem, size_t nelem,
SpectatorMessageResource *resource) SpectatorMessageResource *resource)
{ {
@ -78,7 +78,7 @@ std::vector<const ElemT, boost::container::pmr::polymorphic_allocator<const Elem
/// Return a vector of const ElemT, takes ownership of the message /// Return a vector of const ElemT, takes ownership of the message
template<typename ElemT> template<typename ElemT>
std::vector<const ElemT, OwningMessageSpectatorAllocator<const ElemT>> std::vector<const ElemT, OwningMessageSpectatorAllocator<const ElemT>>
adoptVector(size_t nelem, FairMQMessagePtr message) getVector(size_t nelem, FairMQMessagePtr message)
{ {
return std::vector<const ElemT, OwningMessageSpectatorAllocator<const ElemT>>( return std::vector<const ElemT, OwningMessageSpectatorAllocator<const ElemT>>(
nelem, nelem,
@ -93,7 +93,7 @@ std::vector<const ElemT, OwningMessageSpectatorAllocator<const ElemT>>
// semantics for access. // semantics for access.
// use auto or decltype to catch the return type. // use auto or decltype to catch the return type.
// template<typename ElemT> // template<typename ElemT>
// auto adoptVector(size_t nelem, FairMQMessage* message) // auto getVector(size_t nelem, FairMQMessage* message)
//{ //{
// using DataType = std::vector<ElemT, ByteSpectatorAllocator>; // using DataType = std::vector<ElemT, ByteSpectatorAllocator>;
// //

View File

@ -166,7 +166,7 @@ TEST(MemoryResources, adoptVector_test)
std::memcpy(message->GetData(), tmpBuf, 3 * sizeof(testData)); std::memcpy(message->GetData(), tmpBuf, 3 * sizeof(testData));
auto adoptedOwner = auto adoptedOwner =
adoptVector<testData>(3, std::move(message)); getVector<testData>(3, std::move(message));
EXPECT_TRUE(adoptedOwner[0].i == 3); EXPECT_TRUE(adoptedOwner[0].i == 3);
EXPECT_TRUE(adoptedOwner[1].i == 2); EXPECT_TRUE(adoptedOwner[1].i == 2);
EXPECT_TRUE(adoptedOwner[2].i == 1); EXPECT_TRUE(adoptedOwner[2].i == 1);