1414#include " MemoryResources/MemoryResources.h"
1515#include " Headers/DataHeader.h"
1616
17- namespace o2
18- {
19-
20- namespace header
17+ namespace o2 ::header
2118{
2219// __________________________________________________________________________________________________
2320// / @struct Stack
@@ -45,20 +42,20 @@ struct Stack {
4542 };
4643
4744 public:
48- using allocator_type = boost::container ::pmr::polymorphic_allocator<std::byte>;
45+ using allocator_type = fair::mq ::pmr::polymorphic_allocator<std::byte>;
4946 using value_type = std::byte;
50- using BufferType = std::unique_ptr<value_type[], freeobj>; // this gives us proper default move semantics for free
47+ using BufferType = std::unique_ptr<value_type[], freeobj>; // this gives us proper default move semantics for free
5148
5249 Stack () = default ;
5350 Stack (Stack&&) = default ;
5451 Stack (Stack&) = delete ;
5552 Stack& operator =(Stack&) = delete ;
56- Stack& operator =(Stack&&) = default ;
53+ Stack& operator =(Stack&&) = delete ;
5754
58- value_type* data () const { return buffer.get (); }
59- size_t size () const { return bufferSize; }
55+ [[nodiscard]] value_type* data () const { return buffer.get (); }
56+ [[nodiscard]] size_t size () const { return bufferSize; }
6057 allocator_type get_allocator () const { return allocator; }
61- const BaseHeader* first () const { return reinterpret_cast <const BaseHeader*>(this ->data ()); }
58+ [[nodiscard]] const BaseHeader* first () const { return reinterpret_cast <const BaseHeader*>(this ->data ()); }
6259 static const BaseHeader* firstHeader (std::byte const * buf) { return BaseHeader::get (buf); }
6360 static const BaseHeader* lastHeader (std::byte const * buf)
6461 {
@@ -90,9 +87,9 @@ struct Stack {
9087 // / all headers must derive from BaseHeader, in addition also other stacks can be passed to ctor.
9188 template <typename FirstArgType, typename ... Headers,
9289 typename std::enable_if_t <
93- !std::is_convertible<FirstArgType, boost::container ::pmr::polymorphic_allocator<std::byte>>::value, int > = 0 >
90+ !std::is_convertible<FirstArgType, fair::mq ::pmr::polymorphic_allocator<std::byte>>::value, int > = 0 >
9491 Stack (FirstArgType&& firstHeader, Headers&&... headers)
95- : Stack(boost::container ::pmr::new_delete_resource(), std::forward<FirstArgType>(firstHeader),
92+ : Stack(fair::mq ::pmr::new_delete_resource(), std::forward<FirstArgType>(firstHeader),
9693 std::forward<Headers>(headers)...)
9794 {
9895 }
@@ -122,7 +119,7 @@ struct Stack {
122119 template <typename T>
123120 constexpr static size_t calculateSize (T&& h) noexcept
124121 {
125- // if it's a pointer (to a stack) traverse it
122+ // if it's a pointer (to a stack) traverse it
126123 if constexpr (std::is_convertible_v<T, std::byte*>) {
127124 const BaseHeader* next = BaseHeader::get (std::forward<T>(h));
128125 if (!next) {
@@ -133,17 +130,17 @@ struct Stack {
133130 size += next->size ();
134131 }
135132 return size;
136- // otherwise get the size directly
133+ // otherwise get the size directly
137134 } else {
138135 return h.size ();
139136 }
140137 }
141138
142- // recursion terminator
139+ // recursion terminator
143140 constexpr static size_t calculateSize () { return 0 ; }
144141
145142 private:
146- allocator_type allocator{boost::container ::pmr::new_delete_resource ()};
143+ allocator_type allocator{fair::mq ::pmr::new_delete_resource ()};
147144 size_t bufferSize{0 };
148145 BufferType buffer{nullptr , freeobj{allocator.resource ()}};
149146
@@ -231,7 +228,6 @@ struct Stack {
231228 }
232229};
233230
234- } // namespace header
235- } // namespace o2
231+ } // namespace o2::header
236232
237233#endif // HEADERS_STACK_H
0 commit comments