Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mvtx::PayLoadCont Class Reference

#include <online_distribution/blob/master/newbasic/mvtx_decoder/PayLoadCont.h>

+ Collaboration diagram for mvtx::PayLoadCont:

Public Member Functions

 PayLoadCont ()=default
 
 PayLoadCont (size_t sz)
 
 ~PayLoadCont ()=default
 
 PayLoadCont (const PayLoadCont &src)
 
PayLoadContoperator= (const PayLoadCont &src)
 
const uint8_t * data () const
 increase the buffer size
 
void expand (size_t sz)
 
bool isEmpty () const
 make buffer empty w/o deallocating it
 
void clear ()
 get unused size
 
size_t getUnusedSize () const
 get filled size
 
size_t getSize () const
 get offset of the current ptr from the head
 
size_t getOffset () const
 booked capacity
 
size_t getCapacity () const
 number of bytes still can accept w/o expanding the buffer
 
size_t getFreeCapacity () const
 make sure buffer may accept at least n bytes
 
void ensureFreeCapacity (size_t n)
 fill n bytes with given symbol w/o checking for the size
 
void fillFast (const uint8_t c, size_t n)
 add n bytes to the buffer w/o checking for the size
 
void addFast (const uint8_t *ptr, size_t n)
 add new byte to the buffer w/o checking for the size
 
void addFast (uint8_t val)
 add new short to the buffer w/o checking for the size
 
void addFast (uint16_t val)
 erase n bytes w/o checking for the underflow
 
void eraseFast (size_t n)
 erase n bytes
 
void erase (size_t n)
 fill n bytes with given symbol
 
void fill (const uint8_t c, size_t n)
 add n bytes to the buffer, expand if needed. no check for overlap
 
void add (const uint8_t *ptr, size_t n)
 add new byte to the buffer
 
void add (uint8_t val)
 add new short to the buffer
 
void add (uint16_t val)
 shrink buffer to requested size, no check on over/under flow
 
void shrinkToSize (size_t sz)
 direct const access to value at a given slot, w/o checking for overflow
 
uint8_t operator[] (size_t i) const
 direct access to value at a given slot, w/o checking for overflow
 
uint8_t & operator[] (size_t i)
 read current character value from buffer w/o stepping forward
 
bool current (uint8_t &v) const
 read character value from buffer
 
bool next (uint8_t &v)
 read short value from buffer
 
bool next (uint16_t &v)
 move current pointer to the head
 
void rewind ()
 move all data between the mPtr and mEnd to the head of the buffer
 
void moveUnusedToHead ()
 move unused data to the head and upload new chunk of data
 
size_t append (std::function< size_t(uint8_t *, size_t)> getNext)
 
uint8_t * getPtr ()
 direct write access
 
void setPtr (uint8_t *ptr)
 
void movePtr (size_t step)
 
uint8_t * getEnd ()
 
void setEnd (uint8_t *ptr)
 

Static Public Attributes

static constexpr size_t MinCapacity = 16
 allocate buffer
 

Private Attributes

std::vector< uint8_t > mBuffer
 
uint8_t * mPtr = nullptr
 continuons data buffer
 
uint8_t * mEnd = nullptr
 ! pointer on the position in the buffer
 

Detailed Description

Definition at line 18 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 18 of file PayLoadCont.h

Constructor & Destructor Documentation

mvtx::PayLoadCont::PayLoadCont ( )
default
mvtx::PayLoadCont::PayLoadCont ( size_t  sz)
inline

Definition at line 28 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 28 of file PayLoadCont.h

References expand().

+ Here is the call graph for this function:

mvtx::PayLoadCont::~PayLoadCont ( )
default
PayLoadCont::PayLoadCont ( const PayLoadCont src)

Definition at line 13 of file PayLoadCont.cxx.

View newest version in sPHENIX GitHub at line 13 of file PayLoadCont.cxx

References mBuffer, mEnd, and mPtr.

Member Function Documentation

void mvtx::PayLoadCont::add ( const uint8_t *  ptr,
size_t  n 
)
inline

add new byte to the buffer

Definition at line 117 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 117 of file PayLoadCont.h

References addFast(), and ensureFreeCapacity().

Referenced by oncsSub_idmvtxv3::loadInput().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mvtx::PayLoadCont::add ( uint8_t  val)
inline

add new short to the buffer

Definition at line 124 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 124 of file PayLoadCont.h

References addFast(), and ensureFreeCapacity().

+ Here is the call graph for this function:

void mvtx::PayLoadCont::add ( uint16_t  val)
inline

shrink buffer to requested size, no check on over/under flow

Definition at line 131 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 131 of file PayLoadCont.h

References addFast(), and ensureFreeCapacity().

+ Here is the call graph for this function:

void mvtx::PayLoadCont::addFast ( const uint8_t *  ptr,
size_t  n 
)
inline

add new byte to the buffer w/o checking for the size

Definition at line 80 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 80 of file PayLoadCont.h

References mEnd, and n.

Referenced by add().

+ Here is the caller graph for this function:

void mvtx::PayLoadCont::addFast ( uint8_t  val)
inline

add new short to the buffer w/o checking for the size

Definition at line 87 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 87 of file PayLoadCont.h

References mEnd.

void mvtx::PayLoadCont::addFast ( uint16_t  val)
inline

erase n bytes w/o checking for the underflow

Definition at line 90 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 90 of file PayLoadCont.h

References mEnd.

size_t mvtx::PayLoadCont::append ( std::function< size_t(uint8_t *, size_t)>  getNext)
inline

Definition at line 198 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 198 of file PayLoadCont.h

References getFreeCapacity(), mEnd, and moveUnusedToHead().

+ Here is the call graph for this function:

void mvtx::PayLoadCont::clear ( )
inline

get unused size

Definition at line 43 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 43 of file PayLoadCont.h

References mBuffer, mEnd, and mPtr.

Referenced by mvtx::GBTLink::AlpideByteError(), mvtx::GBTLink::clear(), erase(), and expand().

+ Here is the caller graph for this function:

bool mvtx::PayLoadCont::current ( uint8_t &  v) const
inline

read character value from buffer

Definition at line 150 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 150 of file PayLoadCont.h

References mEnd, and mPtr.

const uint8_t* mvtx::PayLoadCont::data ( ) const
inline

increase the buffer size

Definition at line 35 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 35 of file PayLoadCont.h

References mBuffer.

void mvtx::PayLoadCont::ensureFreeCapacity ( size_t  n)
inline

fill n bytes with given symbol w/o checking for the size

Definition at line 65 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 65 of file PayLoadCont.h

References expand(), getCapacity(), and getFreeCapacity().

Referenced by add(), and fill().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mvtx::PayLoadCont::erase ( size_t  n)
inline

fill n bytes with given symbol

Definition at line 100 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 100 of file PayLoadCont.h

References clear(), eraseFast(), and getSize().

+ Here is the call graph for this function:

void mvtx::PayLoadCont::eraseFast ( size_t  n)
inline

erase n bytes

Definition at line 97 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 97 of file PayLoadCont.h

References mEnd, and n.

Referenced by erase().

+ Here is the caller graph for this function:

void PayLoadCont::expand ( size_t  sz)

< increase the buffer size

Definition at line 40 of file PayLoadCont.cxx.

View newest version in sPHENIX GitHub at line 40 of file PayLoadCont.cxx

References clear(), mBuffer, mEnd, MinCapacity, and mPtr.

Referenced by ensureFreeCapacity(), mvtx::GBTLink::GBTLink(), and PayLoadCont().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mvtx::PayLoadCont::fill ( const uint8_t  c,
size_t  n 
)
inline

add n bytes to the buffer, expand if needed. no check for overlap

Definition at line 110 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 110 of file PayLoadCont.h

References ensureFreeCapacity(), and fillFast().

+ Here is the call graph for this function:

void mvtx::PayLoadCont::fillFast ( const uint8_t  c,
size_t  n 
)
inline

add n bytes to the buffer w/o checking for the size

Definition at line 73 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 73 of file PayLoadCont.h

References mEnd, and n.

Referenced by fill().

+ Here is the caller graph for this function:

size_t mvtx::PayLoadCont::getCapacity ( ) const
inline

number of bytes still can accept w/o expanding the buffer

Definition at line 59 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 59 of file PayLoadCont.h

References mBuffer.

Referenced by ensureFreeCapacity().

+ Here is the caller graph for this function:

uint8_t* mvtx::PayLoadCont::getEnd ( )
inline

Definition at line 211 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 211 of file PayLoadCont.h

References mEnd.

size_t mvtx::PayLoadCont::getFreeCapacity ( ) const
inline

make sure buffer may accept at least n bytes

Definition at line 62 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 62 of file PayLoadCont.h

References getSize(), and mBuffer.

Referenced by append(), and ensureFreeCapacity().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t mvtx::PayLoadCont::getOffset ( ) const
inline

booked capacity

Definition at line 56 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 56 of file PayLoadCont.h

References mBuffer, and mPtr.

Referenced by mvtx::GBTLink::decode_lane(), and moveUnusedToHead().

+ Here is the caller graph for this function:

uint8_t* mvtx::PayLoadCont::getPtr ( )
inline

direct write access

Definition at line 207 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 207 of file PayLoadCont.h

References mPtr.

Referenced by oncsSub_idmvtxv3::loadInput(), and mvtx::GBTLink::readFlxWord().

+ Here is the caller graph for this function:

size_t mvtx::PayLoadCont::getSize ( ) const
inline

get offset of the current ptr from the head

Definition at line 53 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 53 of file PayLoadCont.h

References mBuffer, and mEnd.

Referenced by mvtx::GBTLink::decode_lane(), erase(), and getFreeCapacity().

+ Here is the caller graph for this function:

size_t mvtx::PayLoadCont::getUnusedSize ( ) const
inline

get filled size

Definition at line 50 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 50 of file PayLoadCont.h

References mEnd, and mPtr.

Referenced by mvtx::GBTLink::decode_lane(), moveUnusedToHead(), and oncsSub_idmvtxv3::setupLinks().

+ Here is the caller graph for this function:

bool mvtx::PayLoadCont::isEmpty ( ) const
inline

make buffer empty w/o deallocating it

Definition at line 40 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 40 of file PayLoadCont.h

References mEnd, and mPtr.

Referenced by mvtx::GBTLink::clear(), and mvtx::GBTLink::decode_lane().

+ Here is the caller graph for this function:

void mvtx::PayLoadCont::movePtr ( size_t  step)
inline

Definition at line 209 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 209 of file PayLoadCont.h

References mPtr, and step.

void mvtx::PayLoadCont::moveUnusedToHead ( )
inline

move unused data to the head and upload new chunk of data

Definition at line 184 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 184 of file PayLoadCont.h

References getOffset(), getUnusedSize(), left(), mBuffer, mEnd, and mPtr.

Referenced by append(), and mvtx::GBTLink::clear().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool mvtx::PayLoadCont::next ( uint8_t &  v)
inline

read short value from buffer

Definition at line 160 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 160 of file PayLoadCont.h

References mEnd, and mPtr.

Referenced by mvtx::GBTLink::AlpideByteError(), and mvtx::GBTLink::decode_lane().

+ Here is the caller graph for this function:

bool mvtx::PayLoadCont::next ( uint16_t &  v)
inline

move current pointer to the head

Definition at line 170 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 170 of file PayLoadCont.h

References mEnd, and mPtr.

PayLoadCont & PayLoadCont::operator= ( const PayLoadCont src)

Definition at line 25 of file PayLoadCont.cxx.

View newest version in sPHENIX GitHub at line 25 of file PayLoadCont.cxx

References mBuffer, mEnd, and mPtr.

uint8_t mvtx::PayLoadCont::operator[] ( size_t  i) const
inline

direct access to value at a given slot, w/o checking for overflow

Definition at line 144 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 144 of file PayLoadCont.h

References i, and mBuffer.

uint8_t& mvtx::PayLoadCont::operator[] ( size_t  i)
inline

read current character value from buffer w/o stepping forward

Definition at line 147 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 147 of file PayLoadCont.h

References i, and mBuffer.

void mvtx::PayLoadCont::rewind ( )
inline

move all data between the mPtr and mEnd to the head of the buffer

Definition at line 181 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 181 of file PayLoadCont.h

References mBuffer, and mPtr.

Referenced by pylhef(), and pyslha().

+ Here is the caller graph for this function:

void mvtx::PayLoadCont::setEnd ( uint8_t *  ptr)
inline

Definition at line 212 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 212 of file PayLoadCont.h

References mEnd.

void mvtx::PayLoadCont::setPtr ( uint8_t *  ptr)
inline

Definition at line 208 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 208 of file PayLoadCont.h

References mPtr.

void mvtx::PayLoadCont::shrinkToSize ( size_t  sz)
inline

direct const access to value at a given slot, w/o checking for overflow

Definition at line 138 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 138 of file PayLoadCont.h

References mEnd, and mPtr.

Member Data Documentation

std::vector<uint8_t> mvtx::PayLoadCont::mBuffer
private

Definition at line 215 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 215 of file PayLoadCont.h

Referenced by clear(), data(), expand(), getCapacity(), getFreeCapacity(), getOffset(), getSize(), moveUnusedToHead(), operator=(), operator[](), PayLoadCont(), and rewind().

uint8_t* mvtx::PayLoadCont::mEnd = nullptr
private

! pointer on the position in the buffer

Definition at line 217 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 217 of file PayLoadCont.h

Referenced by addFast(), append(), clear(), current(), eraseFast(), expand(), fillFast(), getEnd(), getSize(), getUnusedSize(), isEmpty(), moveUnusedToHead(), next(), operator=(), PayLoadCont(), setEnd(), and shrinkToSize().

constexpr size_t PayLoadCont::MinCapacity = 16
static

allocate buffer

continous buffer for the payload, just a preallocated vector with current position and end pointer. Big endian is used.

Definition at line 24 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 24 of file PayLoadCont.h

Referenced by expand().

uint8_t* mvtx::PayLoadCont::mPtr = nullptr
private

continuons data buffer

Definition at line 216 of file PayLoadCont.h.

View newest version in sPHENIX GitHub at line 216 of file PayLoadCont.h

Referenced by clear(), current(), expand(), getOffset(), getPtr(), getUnusedSize(), isEmpty(), movePtr(), moveUnusedToHead(), next(), operator=(), PayLoadCont(), rewind(), setPtr(), and shrinkToSize().


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