28std::pair<std::uint16_t, std::uint16_t>
61 default: assert(
false);
64 return std::make_pair(0, 0);
99 default:
return "UNKNOWN";
104std::unique_ptr<ROOT::Experimental::Internal::RColumnElementBase>
105ROOT::Experimental::Internal::RColumnElementBase::Generate<void>(
EColumnType type)
108 case EColumnType::kIndex64:
return std::make_unique<RColumnElement<ClusterSize_t, EColumnType::kIndex64>>();
109 case EColumnType::kIndex32:
return std::make_unique<RColumnElement<ClusterSize_t, EColumnType::kIndex32>>();
110 case EColumnType::kSwitch:
return std::make_unique<RColumnElement<RColumnSwitch, EColumnType::kSwitch>>();
111 case EColumnType::kByte:
return std::make_unique<RColumnElement<std::byte, EColumnType::kByte>>();
112 case EColumnType::kChar:
return std::make_unique<RColumnElement<char, EColumnType::kChar>>();
113 case EColumnType::kBit:
return std::make_unique<RColumnElement<bool, EColumnType::kBit>>();
114 case EColumnType::kReal64:
return std::make_unique<RColumnElement<double, EColumnType::kReal64>>();
115 case EColumnType::kReal32:
return std::make_unique<RColumnElement<float, EColumnType::kReal32>>();
117 case EColumnType::kReal16:
return std::make_unique<RColumnElement<float, EColumnType::kReal16>>();
118 case EColumnType::kInt64:
return std::make_unique<RColumnElement<std::int64_t, EColumnType::kInt64>>();
119 case EColumnType::kUInt64:
return std::make_unique<RColumnElement<std::uint64_t, EColumnType::kUInt64>>();
120 case EColumnType::kInt32:
return std::make_unique<RColumnElement<std::int32_t, EColumnType::kInt32>>();
121 case EColumnType::kUInt32:
return std::make_unique<RColumnElement<std::uint32_t, EColumnType::kUInt32>>();
122 case EColumnType::kInt16:
return std::make_unique<RColumnElement<std::int16_t, EColumnType::kInt16>>();
123 case EColumnType::kUInt16:
return std::make_unique<RColumnElement<std::uint16_t, EColumnType::kUInt16>>();
124 case EColumnType::kInt8:
return std::make_unique<RColumnElement<std::int8_t, EColumnType::kInt8>>();
125 case EColumnType::kUInt8:
return std::make_unique<RColumnElement<std::uint8_t, EColumnType::kUInt8>>();
127 return std::make_unique<RColumnElement<ClusterSize_t, EColumnType::kSplitIndex64>>();
129 return std::make_unique<RColumnElement<ClusterSize_t, EColumnType::kSplitIndex32>>();
140 default: assert(
false);
146std::unique_ptr<ROOT::Experimental::Internal::RColumnElementBase>
165 default:
R__ASSERT(!
"Invalid column cpp type");
172 std::size_t sizeofSrc, std::size_t nDstBits)
174 assert(sizeofSrc <=
sizeof(
Word_t));
175 assert(0 < nDstBits && nDstBits <= sizeofSrc * 8);
177 const unsigned char *srcArray =
reinterpret_cast<const unsigned char *
>(
src);
180 std::size_t bitsUsed = 0;
181 std::size_t dstIdx = 0;
182 for (std::size_t i = 0; i < count; ++i) {
184 memcpy(&packedWord, srcArray + i * sizeofSrc, sizeofSrc);
186 packedWord >>= sizeofSrc * 8 - nDstBits;
189 if (bitsRem >= nDstBits) {
191 accum |= (packedWord << bitsUsed);
192 bitsUsed += nDstBits;
197 Word_t packedWordLsb = packedWord;
200 accum |= (packedWordLsb << bitsUsed);
203 memcpy(&dstArray[dstIdx++], &
accum,
sizeof(
accum));
208 Word_t packedWordMsb = packedWord;
209 packedWordMsb >>= bitsRem;
210 accum |= packedWordMsb;
211 bitsUsed += nDstBits - bitsRem;
215 bitsUsed += nDstBits;
221 memcpy(&dstArray[dstIdx++], &
accum, (bitsUsed + 7) / 8);
224 assert(dstIdx == expDstCount);
228 std::size_t sizeofDst, std::size_t nSrcBits)
230 assert(sizeofDst <=
sizeof(
Word_t));
231 assert(0 < nSrcBits && nSrcBits <= sizeofDst * 8);
233 unsigned char *dstArray =
reinterpret_cast<unsigned char *
>(dst);
239 std::size_t dstIdx = 0;
241 std::size_t remBytesToLoad = (count * nSrcBits + 7) / 8;
242 for (std::size_t i = 0; i < nWordsToLoad; ++i) {
243 assert(dstIdx < count);
247 std::size_t bytesLoaded = std::min(remBytesToLoad,
sizeof(
Word_t));
248 memcpy(&packedBytes, &srcArray[i], bytesLoaded);
250 assert(remBytesToLoad >= bytesLoaded);
251 remBytesToLoad -= bytesLoaded;
256 std::size_t nMsb = nSrcBits + offInWord;
257 std::uint32_t msb = packedBytes << (8 * sizeofDst - nMsb);
258 Word_t packedWord = msb | prevWordLsb;
260 memcpy(dstArray + dstIdx * sizeofDst, &packedWord, sizeofDst);
266 while (dstIdx < count) {
268 if (offInWord >
static_cast<int>(
kBitsPerWord - nSrcBits)) {
273 prevWordLsb = (packedBytes >> offInWord) << (8 * sizeofDst - nSrcBits);
278 Word_t packedWord = packedBytes;
280 packedWord >>= offInWord;
281 packedWord <<= 8 * sizeofDst - nSrcBits;
282 memcpy(dstArray + dstIdx * sizeofDst, &packedWord, sizeofDst);
284 offInWord += nSrcBits;
288 assert(prevWordLsb == 0);
289 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 std::string GetTypeName(EColumnType type)
static std::pair< std::uint16_t, std::uint16_t > GetValidBitRange(EColumnType type)
Most types have a fixed on-disk bit width.
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(EColumnCppType cppType, EColumnType colType)