Project
Loading...
Searching...
No Matches
PayLoadCont.cxx
Go to the documentation of this file.
1
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3
// All rights not expressly granted are reserved.
4
//
5
// This software is distributed under the terms of the GNU General Public
6
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7
//
8
// In applying this license CERN does not waive the privileges and immunities
9
// granted to it by virtue of its status as an Intergovernmental Organization
10
// or submit itself to any jurisdiction.
11
14
15
#include "
ITSMFTReconstruction/PayLoadCont.h
"
16
17
using namespace
o2::itsmft
;
18
19
constexpr
size_t
PayLoadCont::MinCapacity
;
20
21
PayLoadCont::PayLoadCont
(
const
PayLoadCont
&
src
)
22
{
23
mBuffer =
src
.mBuffer;
24
if
(
src
.mPtr) {
25
mPtr = mBuffer.data() + (
src
.mPtr -
src
.mBuffer.data());
26
}
27
if
(
src
.mEnd) {
28
mEnd = mBuffer.data() + (
src
.mEnd -
src
.mBuffer.data());
29
}
30
}
31
32
PayLoadCont
&
PayLoadCont::operator=
(
const
PayLoadCont
&
src
)
33
{
34
if
(&
src
!=
this
) {
35
mBuffer =
src
.mBuffer;
36
if
(
src
.mPtr) {
37
mPtr = mBuffer.data() + (
src
.mPtr -
src
.mBuffer.data());
38
}
39
if
(
src
.mEnd) {
40
mEnd = mBuffer.data() + (
src
.mEnd -
src
.mBuffer.data());
41
}
42
}
43
return
*
this
;
44
}
45
46
void
PayLoadCont::expand
(
size_t
sz)
47
{
49
auto
* oldHead = mBuffer.data();
50
if
(sz <
MinCapacity
) {
51
sz =
MinCapacity
;
52
}
53
if
(sz < mBuffer.size()) {
// never decrease the size
54
return
;
55
}
56
mBuffer.resize(sz);
57
if
(oldHead) {
// fix the pointers to account for the reallocation
58
int64_t diff = mBuffer.data() - oldHead;
59
mPtr += diff;
60
mEnd += diff;
61
}
else
{
// new buffer
62
clear
();
63
}
64
}
PayLoadCont.h
Declaration of class for continuos buffer of ALPIDE data.
o2::itsmft::PayLoadCont
Definition
PayLoadCont.h:30
o2::itsmft::PayLoadCont::MinCapacity
static constexpr size_t MinCapacity
allocate buffer
Definition
PayLoadCont.h:35
o2::itsmft::PayLoadCont::PayLoadCont
PayLoadCont()=default
o2::itsmft::PayLoadCont::operator=
PayLoadCont & operator=(const PayLoadCont &src)
Definition
PayLoadCont.cxx:32
o2::itsmft::PayLoadCont::clear
void clear()
get unused size
Definition
PayLoadCont.h:54
o2::itsmft::PayLoadCont::expand
void expand(size_t sz)
Definition
PayLoadCont.cxx:46
src
GLenum src
Definition
glcorearb.h:1767
o2::itsmft
Definition
SimTraits.h:123
Detectors
ITSMFT
common
reconstruction
src
PayLoadCont.cxx
Generated on Tue Feb 25 2025 23:16:19 for Project by
1.9.8