28std::pair<std::uint16_t, std::uint16_t>
62 if (
type == kTestFutureType)
63 return std::make_pair(32, 32);
67 return std::make_pair(0, 0);
103 if (
type == kTestFutureType)
104 return "TestFutureType";
110std::unique_ptr<ROOT::Experimental::Internal::RColumnElementBase>
111ROOT::Experimental::Internal::RColumnElementBase::Generate<void>(
EColumnType onDiskType)
113 switch (onDiskType) {
114 case EColumnType::kIndex64:
return std::make_unique<RColumnElement<ClusterSize_t, EColumnType::kIndex64>>();
115 case EColumnType::kIndex32:
return std::make_unique<RColumnElement<ClusterSize_t, EColumnType::kIndex32>>();
116 case EColumnType::kSwitch:
return std::make_unique<RColumnElement<RColumnSwitch, EColumnType::kSwitch>>();
117 case EColumnType::kByte:
return std::make_unique<RColumnElement<std::byte, EColumnType::kByte>>();
118 case EColumnType::kChar:
return std::make_unique<RColumnElement<char, EColumnType::kChar>>();
119 case EColumnType::kBit:
return std::make_unique<RColumnElement<bool, EColumnType::kBit>>();
120 case EColumnType::kReal64:
return std::make_unique<RColumnElement<double, EColumnType::kReal64>>();
121 case EColumnType::kReal32:
return std::make_unique<RColumnElement<float, EColumnType::kReal32>>();
123 case EColumnType::kReal16:
return std::make_unique<RColumnElement<float, EColumnType::kReal16>>();
124 case EColumnType::kInt64:
return std::make_unique<RColumnElement<std::int64_t, EColumnType::kInt64>>();
125 case EColumnType::kUInt64:
return std::make_unique<RColumnElement<std::uint64_t, EColumnType::kUInt64>>();
126 case EColumnType::kInt32:
return std::make_unique<RColumnElement<std::int32_t, EColumnType::kInt32>>();
127 case EColumnType::kUInt32:
return std::make_unique<RColumnElement<std::uint32_t, EColumnType::kUInt32>>();
128 case EColumnType::kInt16:
return std::make_unique<RColumnElement<std::int16_t, EColumnType::kInt16>>();
129 case EColumnType::kUInt16:
return std::make_unique<RColumnElement<std::uint16_t, EColumnType::kUInt16>>();
130 case EColumnType::kInt8:
return std::make_unique<RColumnElement<std::int8_t, EColumnType::kInt8>>();
131 case EColumnType::kUInt8:
return std::make_unique<RColumnElement<std::uint8_t, EColumnType::kUInt8>>();
133 return std::make_unique<RColumnElement<ClusterSize_t, EColumnType::kSplitIndex64>>();
135 return std::make_unique<RColumnElement<ClusterSize_t, EColumnType::kSplitIndex32>>();
147 if (onDiskType == kTestFutureType)
148 return std::make_unique<RColumnElement<Internal::RTestFutureColumn, kTestFutureType>>();
155std::unique_ptr<ROOT::Experimental::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(
ClusterSize_t))) {
185 return GenerateColumnElementInternal<ClusterSize_t>(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::Experimental::Internal::RColumnElementBase>
204 std::size_t sizeofSrc, 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 sizeofDst, 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
static const char * GetColumnTypeName(EColumnType type)
static std::pair< std::uint16_t, std::uint16_t > GetValidBitRange(EColumnType type)
Most types have a fixed on-disk bit width.
Holds the index and the tag of a kSwitch column.
constexpr std::size_t kBitsPerWord
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.
std::unique_ptr< RColumnElementBase > GenerateColumnElement(std::type_index inMemoryType, EColumnType onDiskType)
Every concrete RColumnElement type is identified by its on-disk type (column type) and the in-memory ...
std::type_index fInMemoryType
Wrap the integer in a struct in order to avoid template specialization clash with std::uint64_t.