ATLAS Offline Software
Loading...
Searching...
No Matches
PayloadHelpers Namespace Reference

Collection of helper functions for raw pointer operations on the bytestream payload. More...

Typedefs

using TDA = TriggerEDMDeserialiserAlg

Functions

constexpr CLID collectionCLID (TDA::PayloadIterator start)
 CLID of the collection stored in the next fragment.
constexpr size_t nameLength (TDA::PayloadIterator start)
 Length of the serialised name payload.
constexpr size_t dataSize (TDA::PayloadIterator start)
 Size in bytes of the buffer that is needed to decode next fragment data content.
constexpr TDA::PayloadIterator toNextFragment (TDA::PayloadIterator start)
 Returns starting point of the next fragment, can be == end()
std::vector< std::string > collectionDescription (TDA::PayloadIterator start)
 String description of the collection stored in the next fragment, returns persistent type name and the SG key.
void toBuffer (TDA::PayloadIterator start, char *buffer)
 Copies fragment to the buffer, no size checking, use dataSize to do so.

Detailed Description

Collection of helper functions for raw pointer operations on the bytestream payload.

Most functions can be constexpr if the compiler implements ConstexprIterator (P0858R0) Tested it works in clang9 (and 10 and 11?) regardless of –std flag and in gcc10+ only with –std=c++20 But clang12 requires –std=c++20. TODO: Remove the C++ version checks when the release is built with –std=c++20 or newer

Typedef Documentation

◆ TDA

Function Documentation

◆ collectionCLID()

CLID PayloadHelpers::collectionCLID ( TDA::PayloadIterator start)
constexpr

CLID of the collection stored in the next fragment.

Definition at line 169 of file TriggerEDMDeserialiserAlg.cxx.

169 {
170 return *( start + TDA::CLIDOffset );
171 }
static constexpr size_t CLIDOffset

◆ collectionDescription()

std::vector< std::string > PayloadHelpers::collectionDescription ( TDA::PayloadIterator start)

String description of the collection stored in the next fragment, returns persistent type name and the SG key.

Definition at line 193 of file TriggerEDMDeserialiserAlg.cxx.

193 {
195 std::vector<std::string> labels;
196 ss.deserialize( start + TDA::NameOffset, start + TDA::NameOffset + nameLength(start), labels );
197 return labels;
198 }
static Double_t ss
Utility class (not a tool or so) to serialize strings into stream of 32bit integers.
static constexpr size_t NameOffset
constexpr size_t nameLength(TDA::PayloadIterator start)
Length of the serialised name payload.

◆ dataSize()

size_t PayloadHelpers::dataSize ( TDA::PayloadIterator start)
constexpr

Size in bytes of the buffer that is needed to decode next fragment data content.

Definition at line 179 of file TriggerEDMDeserialiserAlg.cxx.

179 {
180 return *( start + TDA::NameOffset + nameLength(start) );
181 }

◆ nameLength()

size_t PayloadHelpers::nameLength ( TDA::PayloadIterator start)
constexpr

Length of the serialised name payload.

Definition at line 174 of file TriggerEDMDeserialiserAlg.cxx.

174 {
175 return *( start + TDA::NameLengthOffset );
176 }
static constexpr size_t NameLengthOffset

◆ toBuffer()

void PayloadHelpers::toBuffer ( TDA::PayloadIterator start,
char * buffer )

Copies fragment to the buffer, no size checking, use dataSize to do so.

Definition at line 201 of file TriggerEDMDeserialiserAlg.cxx.

201 {
202 // move to the beginning of the buffer memory
203 TDA::PayloadIterator dataStart = start + TDA::NameOffset + nameLength(start) + 1 /*skip size*/;
204 // we rely on continuous memory layout of std::vector ...
205 std::memcpy( buffer, &(*dataStart), dataSize(start) );
206 }
Payload::const_iterator PayloadIterator
constexpr size_t dataSize(TDA::PayloadIterator start)
Size in bytes of the buffer that is needed to decode next fragment data content.

◆ toNextFragment()

TDA::PayloadIterator PayloadHelpers::toNextFragment ( TDA::PayloadIterator start)
constexpr

Returns starting point of the next fragment, can be == end()

Intended to be used like this: start = advance(start); if ( start != data.end() )... decode else ... done

Definition at line 188 of file TriggerEDMDeserialiserAlg.cxx.

188 {
189 return start + (*start); // point ahead by the number of words pointed to by start iterator
190 }