28std::pair<std::uint16_t, std::uint16_t>
63 return std::make_pair(32, 32);
67 return std::make_pair(0, 0);
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<RColumnIndex, EColumnType::kIndex64>>();
115 case EColumnType::kIndex32:
return std::make_unique<RColumnElement<RColumnIndex, 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>>();
146 return std::make_unique<RColumnElement<Internal::RTestFutureColumn, kTestFutureType>>();
153std::unique_ptr<ROOT::Experimental::Internal::RColumnElementBase>
156 if (inMemoryType == std::type_index(
typeid(
char))) {
157 return GenerateColumnElementInternal<char>(onDiskType);
158 }
else if (inMemoryType == std::type_index(
typeid(
bool))) {
159 return GenerateColumnElementInternal<bool>(onDiskType);
160 }
else if (inMemoryType == std::type_index(
typeid(std::byte))) {
161 return GenerateColumnElementInternal<std::byte>(onDiskType);
162 }
else if (inMemoryType == std::type_index(
typeid(std::uint8_t))) {
163 return GenerateColumnElementInternal<std::uint8_t>(onDiskType);
164 }
else if (inMemoryType == std::type_index(
typeid(std::uint16_t))) {
165 return GenerateColumnElementInternal<std::uint16_t>(onDiskType);
166 }
else if (inMemoryType == std::type_index(
typeid(std::uint32_t))) {
167 return GenerateColumnElementInternal<std::uint32_t>(onDiskType);
168 }
else if (inMemoryType == std::type_index(
typeid(std::uint64_t))) {
169 return GenerateColumnElementInternal<std::uint64_t>(onDiskType);
170 }
else if (inMemoryType == std::type_index(
typeid(std::int8_t))) {
171 return GenerateColumnElementInternal<std::int8_t>(onDiskType);
172 }
else if (inMemoryType == std::type_index(
typeid(std::int16_t))) {
173 return GenerateColumnElementInternal<std::int16_t>(onDiskType);
174 }
else if (inMemoryType == std::type_index(
typeid(std::int32_t))) {
175 return GenerateColumnElementInternal<std::int32_t>(onDiskType);
176 }
else if (inMemoryType == std::type_index(
typeid(std::int64_t))) {
177 return GenerateColumnElementInternal<std::int64_t>(onDiskType);
178 }
else if (inMemoryType == std::type_index(
typeid(
float))) {
179 return GenerateColumnElementInternal<float>(onDiskType);
180 }
else if (inMemoryType == std::type_index(
typeid(
double))) {
181 return GenerateColumnElementInternal<double>(onDiskType);
182 }
else if (inMemoryType == std::type_index(
typeid(
RColumnIndex))) {
183 return GenerateColumnElementInternal<RColumnIndex>(onDiskType);
184 }
else if (inMemoryType == std::type_index(
typeid(
RColumnSwitch))) {
185 return GenerateColumnElementInternal<RColumnSwitch>(onDiskType);
187 return GenerateColumnElementInternal<RTestFutureColumn>(onDiskType);
189 R__ASSERT(!
"Invalid memory type in GenerateColumnElement");
195std::unique_ptr<ROOT::Experimental::Internal::RColumnElementBase>
202 std::size_t sizeofSrc, std::size_t nDstBits)
204 assert(sizeofSrc <=
sizeof(
Word_t));
205 assert(0 < nDstBits && nDstBits <= sizeofSrc * 8);
207 const unsigned char *srcArray =
reinterpret_cast<const unsigned char *
>(
src);
210 std::size_t bitsUsed = 0;
211 std::size_t dstIdx = 0;
212 for (std::size_t i = 0; i < count; ++i) {
214 memcpy(&packedWord, srcArray + i * sizeofSrc, sizeofSrc);
216 packedWord >>= sizeofSrc * 8 - nDstBits;
219 if (bitsRem >= nDstBits) {
221 accum |= (packedWord << bitsUsed);
222 bitsUsed += nDstBits;
227 Word_t packedWordLsb = packedWord;
230 accum |= (packedWordLsb << bitsUsed);
233 memcpy(&dstArray[dstIdx++], &
accum,
sizeof(
accum));
238 Word_t packedWordMsb = packedWord;
239 packedWordMsb >>= bitsRem;
240 accum |= packedWordMsb;
241 bitsUsed += nDstBits - bitsRem;
245 bitsUsed += nDstBits;
251 memcpy(&dstArray[dstIdx++], &
accum, (bitsUsed + 7) / 8);
254 assert(dstIdx == expDstCount);
258 std::size_t sizeofDst, std::size_t nSrcBits)
260 assert(sizeofDst <=
sizeof(
Word_t));
261 assert(0 < nSrcBits && nSrcBits <= sizeofDst * 8);
263 unsigned char *dstArray =
reinterpret_cast<unsigned char *
>(dst);
269 std::size_t dstIdx = 0;
271 std::size_t remBytesToLoad = (count * nSrcBits + 7) / 8;
272 for (std::size_t i = 0; i < nWordsToLoad; ++i) {
273 assert(dstIdx < count);
277 std::size_t bytesLoaded = std::min(remBytesToLoad,
sizeof(
Word_t));
278 memcpy(&packedBytes, &srcArray[i], bytesLoaded);
280 assert(remBytesToLoad >= bytesLoaded);
281 remBytesToLoad -= bytesLoaded;
286 std::size_t nMsb = nSrcBits + offInWord;
287 std::uint32_t msb = packedBytes << (8 * sizeofDst - nMsb);
288 Word_t packedWord = msb | prevWordLsb;
290 memcpy(dstArray + dstIdx * sizeofDst, &packedWord, sizeofDst);
296 while (dstIdx < count) {
298 if (offInWord >
static_cast<int>(
kBitsPerWord - nSrcBits)) {
303 prevWordLsb = (packedBytes >> offInWord) << (8 * sizeofDst - nSrcBits);
308 Word_t packedWord = packedBytes;
310 packedWord >>= offInWord;
311 packedWord <<= 8 * sizeofDst - nSrcBits;
312 memcpy(dstArray + dstIdx * sizeofDst, &packedWord, sizeofDst);
314 offInWord += nSrcBits;
318 assert(prevWordLsb == 0);
319 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.
The in-memory representation of a 32bit or 64bit on-disk index column.
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)
constexpr EColumnType kTestFutureType
Every concrete RColumnElement type is identified by its on-disk type (column type) and the in-memory ...
std::type_index fInMemoryType