Project
Loading...
Searching...
No Matches
o2::header::Stack Struct Reference

a move-only header stack with serialized headers This is the flat buffer where all the headers in a multi-header go. This guy knows how to move the serialized content to FairMQ and inform it how to release when all is sent. methods to construct a multi-header intended use: More...

#include <Stack.h>

Public Types

using memory_resource = o2::pmr::memory_resource
 
using allocator_type = boost::container::pmr::polymorphic_allocator< std::byte >
 
using value_type = std::byte
 
using BufferType = std::unique_ptr< value_type[], freeobj >
 

Public Member Functions

 Stack ()=default
 
 Stack (Stack &&)=default
 
 Stack (Stack &)=delete
 
Stackoperator= (Stack &)=delete
 
Stackoperator= (Stack &&)=default
 
value_typedata () const
 
size_t size () const
 
allocator_type get_allocator () const
 
const BaseHeaderfirst () const
 
template<typename FirstArgType , typename... Headers, typename std::enable_if_t< !std::is_convertible< FirstArgType, boost::container::pmr::polymorphic_allocator< std::byte > >::value, int > = 0>
 Stack (FirstArgType &&firstHeader, Headers &&... headers)
 
template<typename... Headers>
 Stack (const allocator_type allocatorArg, Headers &&... headers)
 

Static Public Member Functions

static const BaseHeaderfirstHeader (std::byte const *buf)
 
static const BaseHeaderlastHeader (std::byte const *buf)
 
static size_t headerStackSize (std::byte const *buf)
 
template<typename T , typename... Args>
static constexpr size_t calculateSize (T &&h, Args &&... args) noexcept
 
template<typename T >
static constexpr size_t calculateSize (T &&h) noexcept
 
static constexpr size_t calculateSize ()
 

Detailed Description

a move-only header stack with serialized headers This is the flat buffer where all the headers in a multi-header go. This guy knows how to move the serialized content to FairMQ and inform it how to release when all is sent. methods to construct a multi-header intended use:

  • returns a Stack ready to be shipped.

    • as a variadic intializer list (as an argument to a function)

    One can also use the ctor directly:

Definition at line 36 of file Stack.h.

Member Typedef Documentation

◆ allocator_type

using o2::header::Stack::allocator_type = boost::container::pmr::polymorphic_allocator<std::byte>

Definition at line 48 of file Stack.h.

◆ BufferType

using o2::header::Stack::BufferType = std::unique_ptr<value_type[], freeobj>

Definition at line 50 of file Stack.h.

◆ memory_resource

using o2::header::Stack::memory_resource = o2::pmr::memory_resource

Definition at line 38 of file Stack.h.

◆ value_type

using o2::header::Stack::value_type = std::byte

Definition at line 49 of file Stack.h.

Constructor & Destructor Documentation

◆ Stack() [1/5]

o2::header::Stack::Stack ( )
default

◆ Stack() [2/5]

o2::header::Stack::Stack ( Stack &&  )
default

◆ Stack() [3/5]

o2::header::Stack::Stack ( Stack )
delete

◆ Stack() [4/5]

template<typename FirstArgType , typename... Headers, typename std::enable_if_t< !std::is_convertible< FirstArgType, boost::container::pmr::polymorphic_allocator< std::byte > >::value, int > = 0>
o2::header::Stack::Stack ( FirstArgType &&  firstHeader,
Headers &&...  headers 
)
inline

The magic constructors: take arbitrary number of headers and serialize them into the buffer allocated by the specified polymorphic allocator. By default allocation is done using new_delete_resource. In the final stack the first header must be DataHeader. all headers must derive from BaseHeader, in addition also other stacks can be passed to ctor.

Definition at line 94 of file Stack.h.

◆ Stack() [5/5]

template<typename... Headers>
o2::header::Stack::Stack ( const allocator_type  allocatorArg,
Headers &&...  headers 
)
inline

Definition at line 102 of file Stack.h.

Member Function Documentation

◆ calculateSize() [1/3]

static constexpr size_t o2::header::Stack::calculateSize ( )
inlinestaticconstexpr

Definition at line 143 of file Stack.h.

◆ calculateSize() [2/3]

template<typename T >
static constexpr size_t o2::header::Stack::calculateSize ( T &&  h)
inlinestaticconstexprnoexcept

Definition at line 123 of file Stack.h.

◆ calculateSize() [3/3]

template<typename T , typename... Args>
static constexpr size_t o2::header::Stack::calculateSize ( T &&  h,
Args &&...  args 
)
inlinestaticconstexprnoexcept

Definition at line 116 of file Stack.h.

◆ data()

value_type * o2::header::Stack::data ( ) const
inline

Definition at line 58 of file Stack.h.

◆ first()

const BaseHeader * o2::header::Stack::first ( ) const
inline

Definition at line 61 of file Stack.h.

◆ firstHeader()

static const BaseHeader * o2::header::Stack::firstHeader ( std::byte const *  buf)
inlinestatic

Definition at line 62 of file Stack.h.

◆ get_allocator()

allocator_type o2::header::Stack::get_allocator ( ) const
inline

Definition at line 60 of file Stack.h.

◆ headerStackSize()

static size_t o2::header::Stack::headerStackSize ( std::byte const *  buf)
inlinestatic

Definition at line 71 of file Stack.h.

◆ lastHeader()

static const BaseHeader * o2::header::Stack::lastHeader ( std::byte const *  buf)
inlinestatic

Definition at line 63 of file Stack.h.

◆ operator=() [1/2]

Stack & o2::header::Stack::operator= ( Stack &&  )
default

◆ operator=() [2/2]

Stack & o2::header::Stack::operator= ( Stack )
delete

◆ size()

size_t o2::header::Stack::size ( ) const
inline

Definition at line 59 of file Stack.h.


The documentation for this struct was generated from the following file: