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

CLID collectionCLID (TDA::PayloadIterator start)
 CLID of the collection stored in the next fragment.
size_t nameLength (TDA::PayloadIterator start)
 Length of the serialised name payload.
size_t dataSize (TDA::PayloadIterator start)
 Size in bytes of the buffer that is needed to decode next fragment data content.
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)

CLID of the collection stored in the next fragment.

Definition at line 172 of file TriggerEDMDeserialiserAlg.cxx.

172 {
173 return *( start + TDA::CLIDOffset );
174 }
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 205 of file TriggerEDMDeserialiserAlg.cxx.

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

◆ dataSize()

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

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

Definition at line 188 of file TriggerEDMDeserialiserAlg.cxx.

188 {
189 return *( start + TDA::NameOffset + nameLength(start) );
190 }

◆ nameLength()

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

Length of the serialised name payload.

Definition at line 180 of file TriggerEDMDeserialiserAlg.cxx.

180 {
181 return *( start + TDA::NameLengthOffset );
182 }
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 213 of file TriggerEDMDeserialiserAlg.cxx.

213 {
214 // move to the beginning of the buffer memory
215 TDA::PayloadIterator dataStart = start + TDA::NameOffset + nameLength(start) + 1 /*skip size*/;
216 // we rely on continuous memory layout of std::vector ...
217 std::memcpy( buffer, &(*dataStart), dataSize(start) );
218 }
Payload::const_iterator PayloadIterator
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)

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 200 of file TriggerEDMDeserialiserAlg.cxx.

200 {
201 return start + (*start); // point ahead by the number of words pointed to by start iterator
202 }