Skip to content

Commit b3d985f

Browse files
committed
Remove references to boost::container::pmr
Use fair::mq::pmr instead, so that we can then easily migrate fair::mq to std::pmr while still having backward compatibility.
1 parent 7e04ea5 commit b3d985f

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

DataFormats/Headers/include/Headers/Stack.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct Stack {
4545
};
4646

4747
public:
48-
using allocator_type = boost::container::pmr::polymorphic_allocator<std::byte>;
48+
using allocator_type = fair::mq::pmr::polymorphic_allocator<std::byte>;
4949
using value_type = std::byte;
5050
using BufferType = std::unique_ptr<value_type[], freeobj>; //this gives us proper default move semantics for free
5151

@@ -90,9 +90,9 @@ struct Stack {
9090
/// all headers must derive from BaseHeader, in addition also other stacks can be passed to ctor.
9191
template <typename FirstArgType, typename... Headers,
9292
typename std::enable_if_t<
93-
!std::is_convertible<FirstArgType, boost::container::pmr::polymorphic_allocator<std::byte>>::value, int> = 0>
93+
!std::is_convertible<FirstArgType, fair::mq::pmr::polymorphic_allocator<std::byte>>::value, int> = 0>
9494
Stack(FirstArgType&& firstHeader, Headers&&... headers)
95-
: Stack(boost::container::pmr::new_delete_resource(), std::forward<FirstArgType>(firstHeader),
95+
: Stack(fair::mq::pmr::new_delete_resource(), std::forward<FirstArgType>(firstHeader),
9696
std::forward<Headers>(headers)...)
9797
{
9898
}
@@ -143,7 +143,7 @@ struct Stack {
143143
constexpr static size_t calculateSize() { return 0; }
144144

145145
private:
146-
allocator_type allocator{boost::container::pmr::new_delete_resource()};
146+
allocator_type allocator{fair::mq::pmr::new_delete_resource()};
147147
size_t bufferSize{0};
148148
BufferType buffer{nullptr, freeobj{allocator.resource()}};
149149

DataFormats/Headers/test/testDataHeader.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ BOOST_AUTO_TEST_CASE(headerStack_test)
314314
BOOST_CHECK(h3->secret == 42);
315315

316316
//test constructing from a buffer and an additional header
317-
using namespace boost::container::pmr;
317+
using namespace fair::mq::pmr;
318318
Stack s5(new_delete_resource(), s1.data(), Stack{}, meta);
319319
BOOST_CHECK(s5.size() == s1.size() + sizeof(meta));
320320
// check if we can find the header even though there was an empty stack in the middle

DataFormats/MemoryResources/include/MemoryResources/MemoryResources.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class MessageResource : public FairMQMemoryResource
115115
// A spectator pmr memory resource which only watches the memory of the underlying buffer, does not
116116
// carry out real allocation. It owns the underlying buffer which is destroyed on deallocation.
117117
template <typename BufferType>
118-
class SpectatorMemoryResource : public boost::container::pmr::memory_resource
118+
class SpectatorMemoryResource : public fair::mq::pmr::memory_resource
119119
{
120120
public:
121121
using buffer_type = BufferType;
@@ -183,10 +183,10 @@ class SpectatorMemoryResource : public boost::container::pmr::memory_resource
183183
// This in general (as in STL) is a bad idea, but here it is safe to inherit from an allocator since we
184184
// have no additional data and only override some methods so we don't get into slicing and other problems.
185185
template <typename T>
186-
class SpectatorAllocator : public boost::container::pmr::polymorphic_allocator<T>
186+
class SpectatorAllocator : public fair::mq::pmr::polymorphic_allocator<T>
187187
{
188188
public:
189-
using boost::container::pmr::polymorphic_allocator<T>::polymorphic_allocator;
189+
using fair::mq::pmr::polymorphic_allocator<T>::polymorphic_allocator;
190190
using propagate_on_container_move_assignment = std::true_type;
191191

192192
// skip default construction of empty elements
@@ -243,7 +243,7 @@ class OwningMessageSpectatorAllocator
243243
return OwningMessageSpectatorAllocator();
244244
}
245245

246-
boost::container::pmr::memory_resource* resource() { return &mResource; }
246+
fair::mq::pmr::memory_resource* resource() { return &mResource; }
247247

248248
// skip default construction of empty elements
249249
// this is important for two reasons: one: it allows us to adopt an existing buffer (e.g. incoming message) and
@@ -269,14 +269,14 @@ class OwningMessageSpectatorAllocator
269269

270270
// The NoConstructAllocator behaves like the normal pmr vector but does not call constructors / destructors
271271
template <typename T>
272-
class NoConstructAllocator : public boost::container::pmr::polymorphic_allocator<T>
272+
class NoConstructAllocator : public fair::mq::pmr::polymorphic_allocator<T>
273273
{
274274
public:
275-
using boost::container::pmr::polymorphic_allocator<T>::polymorphic_allocator;
275+
using fair::mq::pmr::polymorphic_allocator<T>::polymorphic_allocator;
276276
using propagate_on_container_move_assignment = std::true_type;
277277

278278
template <typename... Args>
279-
NoConstructAllocator(Args&&... args) : boost::container::pmr::polymorphic_allocator<T>(std::forward<Args>(args)...)
279+
NoConstructAllocator(Args&&... args) : fair::mq::pmr::polymorphic_allocator<T>(std::forward<Args>(args)...)
280280
{
281281
}
282282

@@ -302,9 +302,9 @@ class NoConstructAllocator : public boost::container::pmr::polymorphic_allocator
302302
//__________________________________________________________________________________________________
303303

304304
using ByteSpectatorAllocator = SpectatorAllocator<std::byte>;
305-
using BytePmrAllocator = boost::container::pmr::polymorphic_allocator<std::byte>;
305+
using BytePmrAllocator = fair::mq::pmr::polymorphic_allocator<std::byte>;
306306
template <class T>
307-
using vector = std::vector<T, o2::pmr::polymorphic_allocator<T>>;
307+
using vector = std::vector<T, fair::mq::pmr::polymorphic_allocator<T>>;
308308

309309
//__________________________________________________________________________________________________
310310
/// Return a std::vector spanned over the contents of the message, takes ownership of the message

DataFormats/MemoryResources/test/testMemoryResources.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(transportallocatormap_test)
6060
BOOST_CHECK(_tmp == allocZMQ);
6161
}
6262

63-
using namespace boost::container::pmr;
63+
using namespace fair::mq::pmr;
6464

6565
BOOST_AUTO_TEST_CASE(allocator_test)
6666
{

Framework/Core/test/test_FairMQ.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ TEST_CASE("addDataBlockForEach_test")
174174
int i;
175175
int j;
176176
};
177-
using namespace boost::container::pmr;
177+
using namespace fair::mq::pmr;
178178
fair::mq::Parts message;
179179
std::vector<elem, polymorphic_allocator<elem>> vec(polymorphic_allocator<elem>{allocZMQ});
180180
vec.reserve(100);

0 commit comments

Comments
 (0)