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

the base header struct Every header type must begin (i.e. derive) with this. Don't use this struct directly. The derived header must initialize BaseHeader fields with appropriate values More...

#include <DataHeader.h>

Inherited by o2::cpv::CPVBlockHeader, o2::emcal::EMCALBlockHeader, o2::framework::DataProcessingHeader, o2::framework::DomainInfoHeader, o2::framework::OutputObjHeader, o2::framework::SourceInfoHeader, o2::header::DataHeader, o2::header::HeartbeatFrameEnvelope, o2::header::NameHeader< N >, o2::header::test::MetaHeader, o2::phos::PHOSBlockHeader, o2::tpc::TPCSectorHeader, o2::utilities::DataSamplingHeader, test::MetaHeader, test::SequenceDesc, and test_header::MsgModeHeader.

Public Member Functions

 BaseHeader ()=delete
 dont construct directly
 
 BaseHeader (const BaseHeader &)=default
 
constexpr BaseHeader (uint32_t mySize, HeaderType desc, SerializationMethod ser, uint32_t version)
 Special ctor for initialization in derived types.
 
constexpr uint32_t size () const noexcept
 
const std::byte * data () const noexcept
 
const BaseHeadernext () const noexcept
 get the next header if any (const version)
 
BaseHeadernext () noexcept
 get the next header if any (non-const version)
 
bool sanityCheck (uint32_t expectedVersion) const
 
void throwInconsistentStackError () const
 

Static Public Member Functions

static const BaseHeaderget (const std::byte *b, size_t=0)
 access header in buffer
 
static BaseHeaderget (std::byte *b, size_t=0)
 access header in buffer
 

Public Attributes

union { 
 
   char   magicString [gSizeMagicString
 
   uint32_t   magicStringInt 
 
};  
 a magic string, used to identify an O2 header in a raw stream of bytes
 
uint32_t headerSize
 
union { 
 
   uint32_t   flags 
 
   struct { 
 
      uint32_t   flagsNextHeader: 1 
 
      uint32_t   flagsReserved: 15 
 
      uint32_t   flagsDerivedHeader: 16 
 
   }  
 
};  
 flags, first bit indicates that a sub header follows
 
uint32_t headerVersion
 version of the entire header, set by the derived header
 
o2::header::HeaderType description
 header type description, set by derived header
 
o2::header::SerializationMethod serialization
 header serialization method, set by derived header
 

Static Public Attributes

static constexpr uint32_t sMagicString {String2<uint32_t>("O2O2")}
 
static const uint32_t sVersion = o2::header::gInvalidToken32
 
static const o2::header::HeaderType sHeaderType = o2::header::gInvalidToken64
 
static const o2::header::SerializationMethod sSerializationMethod = o2::header::gInvalidToken64
 

Detailed Description

the base header struct Every header type must begin (i.e. derive) with this. Don't use this struct directly. The derived header must initialize BaseHeader fields with appropriate values

  • headerSize must be initialized to sizeof(DerivedHeader) 3 static members MUST be defined in each derived type:
  • sHeaderType; description must be initialized with a static const member of type BaseHeader::HeaderType with a gloablly unique value.
  • sSerializationMethod; the contents of a derived header (content defined after the BaseHeader) can be serialized using any method. The serialization member must be initialized with a gloablly unique static const BaseHeader::SerializationMethod value defined in the Derived header.
  • sVersion; the version of the header described by this base header. Call the special BaseHeader constructor in the DerivedHeader ctor to easily achieve the above.

Definition at line 351 of file DataHeader.h.

Constructor & Destructor Documentation

◆ BaseHeader() [1/3]

o2::header::BaseHeader::BaseHeader ( )
delete

dont construct directly

◆ BaseHeader() [2/3]

o2::header::BaseHeader::BaseHeader ( const BaseHeader )
default

◆ BaseHeader() [3/3]

constexpr o2::header::BaseHeader::BaseHeader ( uint32_t  mySize,
HeaderType  desc,
SerializationMethod  ser,
uint32_t  version 
)
inlineconstexpr

Special ctor for initialization in derived types.

Definition at line 396 of file DataHeader.h.

Member Function Documentation

◆ data()

const std::byte * o2::header::BaseHeader::data ( ) const
inlinenoexcept

Definition at line 422 of file DataHeader.h.

◆ get() [1/2]

static const BaseHeader * o2::header::BaseHeader::get ( const std::byte *  b,
size_t  = 0 
)
inlinestatic

access header in buffer

this is to guess if the buffer starting at b looks like a header

Definition at line 405 of file DataHeader.h.

◆ get() [2/2]

static BaseHeader * o2::header::BaseHeader::get ( std::byte *  b,
size_t  = 0 
)
inlinestatic

access header in buffer

this is to guess if the buffer starting at b looks like a header

Definition at line 415 of file DataHeader.h.

◆ next() [1/2]

const BaseHeader * o2::header::BaseHeader::next ( ) const
inlinenoexcept

get the next header if any (const version)

Definition at line 425 of file DataHeader.h.

◆ next() [2/2]

BaseHeader * o2::header::BaseHeader::next ( )
inlinenoexcept

get the next header if any (non-const version)

Definition at line 433 of file DataHeader.h.

◆ sanityCheck()

bool o2::header::BaseHeader::sanityCheck ( uint32_t  expectedVersion) const

check if the header matches expected version throws runtime error if not matching we might change this behavior if we want to support multiple version of a particular header but until we have this support we need to be strict to catch a problem early and with meaningful error message

Definition at line 36 of file DataHeader.cxx.

◆ size()

constexpr uint32_t o2::header::BaseHeader::size ( ) const
inlineconstexprnoexcept

Definition at line 421 of file DataHeader.h.

◆ throwInconsistentStackError()

void o2::header::BaseHeader::throwInconsistentStackError ( ) const

throw runtime error to report inconsistent header stack when the next-header flag is set but no next header is found; implemented only once, no template overloads

Definition at line 50 of file DataHeader.cxx.

Member Data Documentation

◆ [union]

union { ... } o2::header::BaseHeader

a magic string, used to identify an O2 header in a raw stream of bytes

◆ [union]

union { ... } o2::header::BaseHeader

flags, first bit indicates that a sub header follows

◆ description

o2::header::HeaderType o2::header::BaseHeader::description

header type description, set by derived header

Definition at line 385 of file DataHeader.h.

◆ flags

uint32_t o2::header::BaseHeader::flags

Definition at line 373 of file DataHeader.h.

◆ flagsDerivedHeader

uint32_t o2::header::BaseHeader::flagsDerivedHeader

Definition at line 377 of file DataHeader.h.

◆ flagsNextHeader

uint32_t o2::header::BaseHeader::flagsNextHeader

Definition at line 375 of file DataHeader.h.

◆ flagsReserved

uint32_t o2::header::BaseHeader::flagsReserved

Definition at line 376 of file DataHeader.h.

◆ headerSize

uint32_t o2::header::BaseHeader::headerSize

size of the header that starts with this sequence (base + derived header) set by the derived header

Definition at line 369 of file DataHeader.h.

◆ headerVersion

uint32_t o2::header::BaseHeader::headerVersion

version of the entire header, set by the derived header

Definition at line 382 of file DataHeader.h.

◆ magicString

char o2::header::BaseHeader::magicString[gSizeMagicString]

Definition at line 363 of file DataHeader.h.

◆ magicStringInt

uint32_t o2::header::BaseHeader::magicStringInt

Definition at line 364 of file DataHeader.h.

◆ serialization

o2::header::SerializationMethod o2::header::BaseHeader::serialization

header serialization method, set by derived header

Definition at line 388 of file DataHeader.h.

◆ sHeaderType

const o2::header::HeaderType o2::header::BaseHeader::sHeaderType = o2::header::gInvalidToken64
static

Definition at line 356 of file DataHeader.h.

◆ sMagicString

constexpr uint32_t o2::header::BaseHeader::sMagicString {String2<uint32_t>("O2O2")}
staticconstexpr

Definition at line 353 of file DataHeader.h.

◆ sSerializationMethod

const o2::header::SerializationMethod o2::header::BaseHeader::sSerializationMethod = o2::header::gInvalidToken64
static

Definition at line 357 of file DataHeader.h.

◆ sVersion

const uint32_t o2::header::BaseHeader::sVersion = o2::header::gInvalidToken32
static

License text in a separate file.

In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction.

Definition at line 355 of file DataHeader.h.


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