61 if (
type == kTestFutureColumnType)
62 return std::make_pair(32, 32);
66 return std::make_pair(0, 0);
102 if (
type == kTestFutureColumnType)
103 return "TestFutureType";
108std::unique_ptr<ROOT::Internal::RColumnElementBase>
111 const auto onDiskType = onDisk.
GetType();
112 std::unique_ptr<ROOT::Internal::RColumnElementBase> elem;
115 switch (onDiskType) {
119 case ENTupleColumnType::kByte: elem = std::make_unique<RColumnElement<std::byte, ENTupleColumnType::kByte>>();
break;
126 case ENTupleColumnType::kInt64: elem = std::make_unique<RColumnElement<std::int64_t, ENTupleColumnType::kInt64>>();
break;
128 case ENTupleColumnType::kInt32: elem = std::make_unique<RColumnElement<std::int32_t, ENTupleColumnType::kInt32>>();
break;
130 case ENTupleColumnType::kInt16: elem = std::make_unique<RColumnElement<std::int16_t, ENTupleColumnType::kInt16>>();
break;
132 case ENTupleColumnType::kInt8: elem = std::make_unique<RColumnElement<std::int8_t, ENTupleColumnType::kInt8>>();
break;
133 case ENTupleColumnType::kUInt8: elem = std::make_unique<RColumnElement<std::uint8_t, ENTupleColumnType::kUInt8>>();
break;
147 if (onDiskType == kTestFutureColumnType)
148 return std::make_unique<RColumnElement<Internal::RTestFutureColumn, kTestFutureColumnType>>();
155 elem->SetValueRange(range->fMin, range->fMax);
160std::unique_ptr<ROOT::Internal::RColumnElementBase>
163 if (inMemoryType == std::type_index(
typeid(
char))) {
164 return GenerateColumnElementInternal<char>(onDiskType);
165 }
else if (inMemoryType == std::type_index(
typeid(
bool))) {
166 return GenerateColumnElementInternal<bool>(onDiskType);
167 }
else if (inMemoryType == std::type_index(
typeid(std::byte))) {
168 return GenerateColumnElementInternal<std::byte>(onDiskType);
169 }
else if (inMemoryType == std::type_index(
typeid(std::uint8_t))) {
170 return GenerateColumnElementInternal<std::uint8_t>(onDiskType);
171 }
else if (inMemoryType == std::type_index(
typeid(std::uint16_t))) {
172 return GenerateColumnElementInternal<std::uint16_t>(onDiskType);
173 }
else if (inMemoryType == std::type_index(
typeid(std::uint32_t))) {
174 return GenerateColumnElementInternal<std::uint32_t>(onDiskType);
175 }
else if (inMemoryType == std::type_index(
typeid(std::uint64_t))) {
176 return GenerateColumnElementInternal<std::uint64_t>(onDiskType);
177 }
else if (inMemoryType == std::type_index(
typeid(std::int8_t))) {
178 return GenerateColumnElementInternal<std::int8_t>(onDiskType);
179 }
else if (inMemoryType == std::type_index(
typeid(std::int16_t))) {
180 return GenerateColumnElementInternal<std::int16_t>(onDiskType);
181 }
else if (inMemoryType == std::type_index(
typeid(std::int32_t))) {
182 return GenerateColumnElementInternal<std::int32_t>(onDiskType);
183 }
else if (inMemoryType == std::type_index(
typeid(std::int64_t))) {
184 return GenerateColumnElementInternal<std::int64_t>(onDiskType);
185 }
else if (inMemoryType == std::type_index(
typeid(
float))) {
186 return GenerateColumnElementInternal<float>(onDiskType);
187 }
else if (inMemoryType == std::type_index(
typeid(
double))) {
188 return GenerateColumnElementInternal<double>(onDiskType);
189 }
else if (inMemoryType == std::type_index(
typeid(
RColumnIndex))) {
190 return GenerateColumnElementInternal<RColumnIndex>(onDiskType);
191 }
else if (inMemoryType == std::type_index(
typeid(
RColumnSwitch))) {
192 return GenerateColumnElementInternal<RColumnSwitch>(onDiskType);
193 }
else if (inMemoryType == std::type_index(
typeid(RTestFutureColumn))) {
194 return GenerateColumnElementInternal<RTestFutureColumn>(onDiskType);
196 R__ASSERT(!
"Invalid memory type in GenerateColumnElement");
202std::unique_ptr<ROOT::Internal::RColumnElementBase>
208 elem->SetValueRange(range->fMin, range->fMax);
212std::unique_ptr<ROOT::Internal::RColumnElementBase>
219 std::size_t nDstBits)
221 assert(sizeofSrc <=
sizeof(
Word_t));
222 assert(0 < nDstBits && nDstBits <= sizeofSrc * 8);
224 const unsigned char *srcArray =
reinterpret_cast<const unsigned char *
>(
src);
227 std::size_t bitsUsed = 0;
228 std::size_t dstIdx = 0;
229 for (std::size_t i = 0; i < count; ++i) {
231#if R__LITTLE_ENDIAN == 0
232 memcpy(
reinterpret_cast<unsigned char *
>(&packedWord) + (
sizeof(
Word_t) - sizeofSrc), srcArray + i * sizeofSrc,
235 memcpy(&packedWord, srcArray + i * sizeofSrc, sizeofSrc);
238 packedWord >>= sizeofSrc * 8 - nDstBits;
241 if (bitsRem >= nDstBits) {
243 accum |= (packedWord << bitsUsed);
244 bitsUsed += nDstBits;
249 Word_t packedWordLsb = packedWord;
252 accum |= (packedWordLsb << bitsUsed);
255 ByteSwapIfNecessary(accum);
256 memcpy(&dstArray[dstIdx++], &accum,
sizeof(accum));
261 Word_t packedWordMsb = packedWord;
262 packedWordMsb >>= bitsRem;
263 accum |= packedWordMsb;
264 bitsUsed += nDstBits - bitsRem;
268 bitsUsed += nDstBits;
274 ByteSwapIfNecessary(accum);
275 memcpy(&dstArray[dstIdx++], &accum, (bitsUsed + 7) / 8);
279 assert(dstIdx == expDstCount);
283 std::size_t nSrcBits)
285 assert(sizeofDst <=
sizeof(
Word_t));
286 assert(0 < nSrcBits && nSrcBits <= sizeofDst * 8);
288 unsigned char *dstArray =
reinterpret_cast<unsigned char *
>(
dst);
294 std::size_t dstIdx = 0;
296 std::size_t remBytesToLoad = (count * nSrcBits + 7) / 8;
297 for (std::size_t i = 0; i < nWordsToLoad; ++i) {
298 assert(dstIdx < count);
302 std::size_t bytesLoaded = std::min(remBytesToLoad,
sizeof(
Word_t));
303 memcpy(&packedBytes, &srcArray[i], bytesLoaded);
304 ByteSwapIfNecessary(packedBytes);
306 assert(remBytesToLoad >= bytesLoaded);
307 remBytesToLoad -= bytesLoaded;
312 std::size_t nMsb = nSrcBits + offInWord;
313 std::uint32_t msb = packedBytes << (8 * sizeofDst - nMsb);
314 Word_t packedWord = msb | prevWordLsb;
316#if R__LITTLE_ENDIAN == 0
317 memcpy(dstArray + dstIdx * sizeofDst,
318 reinterpret_cast<unsigned char *
>(&packedWord) +
sizeof(
Word_t) - sizeofDst, sizeofDst);
320 memcpy(dstArray + dstIdx * sizeofDst, &packedWord, sizeofDst);
327 while (dstIdx < count) {
329 if (offInWord >
static_cast<int>(
kBitsPerWord - nSrcBits)) {
334 prevWordLsb = (packedBytes >> offInWord) << (8 * sizeofDst - nSrcBits);
339 Word_t packedWord = packedBytes;
341 packedWord >>= offInWord;
342 packedWord <<= 8 * sizeofDst - nSrcBits;
343#if R__LITTLE_ENDIAN == 0
344 memcpy(dstArray + dstIdx * sizeofDst,
345 reinterpret_cast<unsigned char *
>(&packedWord) +
sizeof(
Word_t) - sizeofDst, sizeofDst);
347 memcpy(dstArray + dstIdx * sizeofDst, &packedWord, sizeofDst);
350 offInWord += nSrcBits;
354 assert(prevWordLsb == 0);
355 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
static const char * GetColumnTypeName(ROOT::ENTupleColumnType type)
static std::pair< std::uint16_t, std::uint16_t > GetValidBitRange(ROOT::ENTupleColumnType type)
Most types have a fixed on-disk bit width.
static std::unique_ptr< RColumnElementBase > Generate(ENTupleColumnType onDiskType)
The in-memory representation of a 32bit or 64bit on-disk index column.
Holds the index and the tag of a kSwitch column.
Metadata stored for every column of an RNTuple.
std::optional< RValueRange > GetValueRange() const
ROOT::ENTupleColumnType GetType() const
std::uint16_t GetBitsOnStorage() const
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
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