63 return std::make_pair(32, 32);
67 return std::make_pair(0, 0);
104 return "TestFutureType";
110std::unique_ptr<ROOT::Internal::RColumnElementBase>
114 switch (onDiskType) {
147 return std::make_unique<RColumnElement<Internal::RTestFutureColumn, kTestFutureColumnType>>();
155std::unique_ptr<ROOT::Internal::RColumnElementBase>
158 if (inMemoryType == std::type_index(
typeid(
char))) {
159 return GenerateColumnElementInternal<char>(onDiskType);
160 }
else if (inMemoryType == std::type_index(
typeid(
bool))) {
161 return GenerateColumnElementInternal<bool>(onDiskType);
162 }
else if (inMemoryType == std::type_index(
typeid(std::byte))) {
163 return GenerateColumnElementInternal<std::byte>(onDiskType);
164 }
else if (inMemoryType == std::type_index(
typeid(std::uint8_t))) {
165 return GenerateColumnElementInternal<std::uint8_t>(onDiskType);
166 }
else if (inMemoryType == std::type_index(
typeid(std::uint16_t))) {
167 return GenerateColumnElementInternal<std::uint16_t>(onDiskType);
168 }
else if (inMemoryType == std::type_index(
typeid(std::uint32_t))) {
169 return GenerateColumnElementInternal<std::uint32_t>(onDiskType);
170 }
else if (inMemoryType == std::type_index(
typeid(std::uint64_t))) {
171 return GenerateColumnElementInternal<std::uint64_t>(onDiskType);
172 }
else if (inMemoryType == std::type_index(
typeid(std::int8_t))) {
173 return GenerateColumnElementInternal<std::int8_t>(onDiskType);
174 }
else if (inMemoryType == std::type_index(
typeid(std::int16_t))) {
175 return GenerateColumnElementInternal<std::int16_t>(onDiskType);
176 }
else if (inMemoryType == std::type_index(
typeid(std::int32_t))) {
177 return GenerateColumnElementInternal<std::int32_t>(onDiskType);
178 }
else if (inMemoryType == std::type_index(
typeid(std::int64_t))) {
179 return GenerateColumnElementInternal<std::int64_t>(onDiskType);
180 }
else if (inMemoryType == std::type_index(
typeid(
float))) {
181 return GenerateColumnElementInternal<float>(onDiskType);
182 }
else if (inMemoryType == std::type_index(
typeid(
double))) {
183 return GenerateColumnElementInternal<double>(onDiskType);
184 }
else if (inMemoryType == std::type_index(
typeid(
RColumnIndex))) {
185 return GenerateColumnElementInternal<RColumnIndex>(onDiskType);
186 }
else if (inMemoryType == std::type_index(
typeid(
RColumnSwitch))) {
187 return GenerateColumnElementInternal<RColumnSwitch>(onDiskType);
189 return GenerateColumnElementInternal<RTestFutureColumn>(onDiskType);
191 R__ASSERT(!
"Invalid memory type in GenerateColumnElement");
197std::unique_ptr<ROOT::Internal::RColumnElementBase>
204 std::size_t nDstBits)
206 assert(sizeofSrc <=
sizeof(
Word_t));
207 assert(0 < nDstBits && nDstBits <= sizeofSrc * 8);
209 const unsigned char *srcArray =
reinterpret_cast<const unsigned char *
>(
src);
212 std::size_t bitsUsed = 0;
213 std::size_t dstIdx = 0;
214 for (std::size_t i = 0; i < count; ++i) {
216 memcpy(&packedWord, srcArray + i * sizeofSrc, sizeofSrc);
218 packedWord >>= sizeofSrc * 8 - nDstBits;
221 if (bitsRem >= nDstBits) {
223 accum |= (packedWord << bitsUsed);
224 bitsUsed += nDstBits;
229 Word_t packedWordLsb = packedWord;
232 accum |= (packedWordLsb << bitsUsed);
235 memcpy(&dstArray[dstIdx++], &accum,
sizeof(accum));
240 Word_t packedWordMsb = packedWord;
241 packedWordMsb >>= bitsRem;
242 accum |= packedWordMsb;
243 bitsUsed += nDstBits - bitsRem;
247 bitsUsed += nDstBits;
253 memcpy(&dstArray[dstIdx++], &accum, (bitsUsed + 7) / 8);
256 assert(dstIdx == expDstCount);
260 std::size_t nSrcBits)
262 assert(sizeofDst <=
sizeof(
Word_t));
263 assert(0 < nSrcBits && nSrcBits <= sizeofDst * 8);
265 unsigned char *dstArray =
reinterpret_cast<unsigned char *
>(dst);
271 std::size_t dstIdx = 0;
273 std::size_t remBytesToLoad = (count * nSrcBits + 7) / 8;
274 for (std::size_t i = 0; i < nWordsToLoad; ++i) {
275 assert(dstIdx < count);
279 std::size_t bytesLoaded = std::min(remBytesToLoad,
sizeof(
Word_t));
280 memcpy(&packedBytes, &srcArray[i], bytesLoaded);
282 assert(remBytesToLoad >= bytesLoaded);
283 remBytesToLoad -= bytesLoaded;
288 std::size_t nMsb = nSrcBits + offInWord;
289 std::uint32_t msb = packedBytes << (8 * sizeofDst - nMsb);
290 Word_t packedWord = msb | prevWordLsb;
292 memcpy(dstArray + dstIdx * sizeofDst, &packedWord, sizeofDst);
298 while (dstIdx < count) {
300 if (offInWord >
static_cast<int>(
kBitsPerWord - nSrcBits)) {
305 prevWordLsb = (packedBytes >> offInWord) << (8 * sizeofDst - nSrcBits);
310 Word_t packedWord = packedBytes;
312 packedWord >>= offInWord;
313 packedWord <<= 8 * sizeofDst - nSrcBits;
314 memcpy(dstArray + dstIdx * sizeofDst, &packedWord, sizeofDst);
316 offInWord += nSrcBits;
320 assert(prevWordLsb == 0);
321 assert(dstIdx == count);
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
The available trivial, native content types of a column.
static const char * GetColumnTypeName(ROOT::ENTupleColumnType type)
static std::unique_ptr< RColumnElementBase > Generate(ROOT::ENTupleColumnType type)
If CppT == void, use the default C++ type for the given column type.
static std::pair< std::uint16_t, std::uint16_t > GetValidBitRange(ROOT::ENTupleColumnType type)
Most types have a fixed on-disk bit width.
The in-memory representation of a 32bit or 64bit on-disk index column.
Holds the index and the tag of a kSwitch column.
void PackBits(void *dst, const void *src, std::size_t count, std::size_t sizeofSrc, std::size_t nDstBits)
Tightly packs count items of size sizeofSrc contained in src into dst using nDstBits per item.
void UnpackBits(void *dst, const void *src, std::size_t count, std::size_t sizeofDst, std::size_t nSrcBits)
Undoes the effect of PackBits.
constexpr std::size_t kBitsPerWord
constexpr ENTupleColumnType kTestFutureColumnType
std::unique_ptr< RColumnElementBase > GenerateColumnElement(std::type_index inMemoryType, ROOT::ENTupleColumnType onDiskType)
Every concrete RColumnElement type is identified by its on-disk type (column type) and the in-memory ...
std::type_index fInMemoryType
ROOT::ENTupleColumnType fOnDiskType