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

Commit db65892

Browse filesBrowse files
committed
Support for multiple links per RU
1 parent ebac556 commit db65892
Copy full SHA for db65892

File tree

Expand file treeCollapse file tree

6 files changed

+380
-235
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

6 files changed

+380
-235
lines changed
Open diff view settings
Collapse file

‎Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/PayLoadCont.h‎

Copy file name to clipboardExpand all lines: Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/PayLoadCont.h
+17-17Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ class PayLoadCont
3131
// Big endian is used.
3232

3333
public:
34-
static constexpr int MinCapacity = 16;
34+
static constexpr size_t MinCapacity = 16;
3535

3636
///< allocate buffer
37-
PayLoadCont(int iniSize = MinCapacity) { expand(iniSize); }
37+
PayLoadCont(size_t iniSize = MinCapacity) { expand(iniSize); }
3838
~PayLoadCont() = default;
3939

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

4242
///< increase the buffer size
43-
void expand(int sz);
43+
void expand(size_t sz);
4444

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

@@ -52,30 +52,30 @@ class PayLoadCont
5252
}
5353

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

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

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

6363
///< booked capacity
64-
int getCapacity() const { return mBuffer.size(); }
64+
size_t getCapacity() const { return mBuffer.size(); }
6565

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

6969
///< make sure buffer may accept at least n bytes
70-
void ensureFreeCapacity(int n)
70+
void ensureFreeCapacity(size_t n)
7171
{
7272
if (getFreeCapacity() < n) {
7373
expand(getCapacity() + 2 * n);
7474
}
7575
}
7676

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

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

9797
///< erase n bytes
98-
void erase(int n)
98+
void erase(size_t n)
9999
{
100100
if (n > getSize()) {
101101
clear();
@@ -105,7 +105,7 @@ class PayLoadCont
105105
}
106106

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

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

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

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

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

187187
///< move unused data to the head and upload new chunk of data
188188
// (attemtint to use all free capacity) using the method provided via getNext
189-
int append(std::function<int(uint8_t*, int)> getNext)
189+
size_t append(std::function<size_t(uint8_t*, size_t)> getNext)
190190
{
191191
moveUnusedToHead();
192192
auto nRead = getNext(mEnd, getFreeCapacity());
Collapse file

‎Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/PayLoadSG.h‎

Copy file name to clipboardExpand all lines: Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/PayLoadSG.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class PayLoadSG
3333
~PayLoadSG() = default;
3434

3535
///< add n bytes to the buffer
36-
void add(const uint8_t* ptr, int n)
36+
void add(const uint8_t* ptr, size_t n)
3737
{
3838
if (n) {
3939
mBuffer.emplace_back(ptr, n);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.