Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ class AlpideCoder
{
// read record for single non-empty chip, updating on change module and cycle.
// return number of records filled (>0), EOFFlag or Error
// NOTE: decoder does not clean the chipData buffers, should be done outside
//
uint8_t dataC = 0, timestamp = 0;
uint16_t dataS = 0, region = 0;
Expand All @@ -117,6 +116,8 @@ class AlpideCoder

uint32_t expectInp = ExpectChipHeader | ExpectChipEmpty; // data must always start with chip header or chip empty flag

chipData.clear();

while (buffer.next(dataC)) {
//
// ---------- chip info ?
Expand Down Expand Up @@ -226,7 +227,8 @@ class AlpideCoder
}

if (!dataC) {
break; // 0 padding reached (end of the cable data)
buffer.clear(); // 0 padding reached (end of the cable data), no point in continuing
break;
}
return unexpectedEOF("Unknown word"); // either error
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ class PayLoadCont
// Big endian is used.

public:
static constexpr int MinCapacity = 16;
static constexpr size_t MinCapacity = 16;

///< allocate buffer
PayLoadCont(int iniSize = MinCapacity) { expand(iniSize); }
PayLoadCont(size_t iniSize = MinCapacity) { expand(iniSize); }
~PayLoadCont() = default;

const uint8_t* data() const { return mBuffer.data(); }

///< increase the buffer size
void expand(int sz);
void expand(size_t sz);

bool isEmpty() const { return mPtr >= mEnd; }

Expand All @@ -52,30 +52,30 @@ class PayLoadCont
}

///< get unused size
int getUnusedSize() const { return mEnd - mPtr; }
size_t getUnusedSize() const { return mEnd > mPtr ? mEnd - mPtr : 0; }

///< get filled size
int getSize() const { return mEnd - mBuffer.data(); }
size_t getSize() const { return mEnd - mBuffer.data(); }

///< get offset of the current ptr from the head
int getOffset() const { return mPtr - mBuffer.data(); }
size_t getOffset() const { return mPtr - mBuffer.data(); }

///< booked capacity
int getCapacity() const { return mBuffer.size(); }
size_t getCapacity() const { return mBuffer.size(); }

///< number of bytes still can accept w/o expanding the buffer
int getFreeCapacity() const { return mBuffer.size() - getSize(); }
size_t getFreeCapacity() const { return mBuffer.size() - getSize(); }

///< make sure buffer may accept at least n bytes
void ensureFreeCapacity(int n)
void ensureFreeCapacity(size_t n)
{
if (getFreeCapacity() < n) {
expand(getCapacity() + 2 * n);
}
}

///< add n bytes to the buffer w/o checking for the size
void addFast(const uint8_t* ptr, int n)
void addFast(const uint8_t* ptr, size_t n)
{
std::memcpy(mEnd, ptr, n);
mEnd += n;
Expand All @@ -92,10 +92,10 @@ class PayLoadCont
}

///< erase n bytes w/o checking for the underflow
void eraseFast(int n) { mEnd -= n; }
void eraseFast(size_t n) { mEnd -= n; }

///< erase n bytes
void erase(int n)
void erase(size_t n)
{
if (n > getSize()) {
clear();
Expand All @@ -105,7 +105,7 @@ class PayLoadCont
}

///< add n bytes to the buffer, expand if needed. no check for overlap
void add(const uint8_t* ptr, int n)
void add(const uint8_t* ptr, size_t n)
{
ensureFreeCapacity(n);
addFast(ptr, n);
Expand All @@ -126,16 +126,16 @@ class PayLoadCont
}

///< shrink buffer to requested size, no check on over/under flow
void shrinkToSize(int sz)
void shrinkToSize(size_t sz)
{
mEnd = mPtr + sz;
}

///< direct const access to value at a given slot, w/o checking for overflow
uint8_t operator[](int i) const { return mBuffer[i]; }
uint8_t operator[](size_t i) const { return mBuffer[i]; }

///< direct access to value at a given slot, w/o checking for overflow
uint8_t& operator[](int i) { return mBuffer[i]; }
uint8_t& operator[](size_t i) { return mBuffer[i]; }

///< read current character value from buffer w/o stepping forward
bool current(uint8_t& v) const
Expand Down Expand Up @@ -186,7 +186,7 @@ class PayLoadCont

///< move unused data to the head and upload new chunk of data
// (attemtint to use all free capacity) using the method provided via getNext
int append(std::function<int(uint8_t*, int)> getNext)
size_t append(std::function<size_t(uint8_t*, size_t)> getNext)
{
moveUnusedToHead();
auto nRead = getNext(mEnd, getFreeCapacity());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PayLoadSG
~PayLoadSG() = default;

///< add n bytes to the buffer
void add(const uint8_t* ptr, int n)
void add(const uint8_t* ptr, size_t n)
{
if (n) {
mBuffer.emplace_back(ptr, n);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ class PixelReader
{
return nullptr;
}
const o2::InteractionRecord& getInteractionRecordHB() const
{
return mInteractionRecordHB;
}
const o2::InteractionRecord& getInteractionRecord() const
{
return mInteractionRecord;
Expand All @@ -57,7 +61,8 @@ class PixelReader
//
protected:
//
o2::InteractionRecord mInteractionRecord = {};
o2::InteractionRecord mInteractionRecordHB = {}; // interation record for the HB
o2::InteractionRecord mInteractionRecord = {}; // interation record for the trigger
uint32_t mTrigger = 0;

ClassDef(PixelReader, 1);
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.