Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RNTupleTypes.cxx
Go to the documentation of this file.
1/// \file RNTupleTypes.cxx
2/// \ingroup NTuple
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \date 2026-02-00
5
6/*************************************************************************
7 * Copyright (C) 1995-2026, Rene Brun and Fons Rademakers. *
8 * All rights reserved. *
9 * *
10 * For the licensing terms see $ROOTSYS/LICENSE. *
11 * For the list of contributors see $ROOTSYS/README/CREDITS. *
12 *************************************************************************/
13
14#include <ROOT/RError.hxx>
15#include <ROOT/RNTupleTypes.hxx>
16
17#include <TError.h>
18
19#include <string>
20
21/// See GetReserved(): we ignore the reserved flag since we don't use it anywhere currently.
23{
24 if (reserved > 1) {
25 throw RException(R__FAIL("Overflow of the locator reserved field"));
26 }
27
28 fFlagsAndNBytes = (fFlagsAndNBytes & ~kMaskReservedBit) | (std::uint64_t(reserved) << 60);
29}
30
32{
33 if (nBytesOnStorage & kMaskFlags) {
34 throw RException(R__FAIL("overflow in on-disk size of locator: " + std::to_string(nBytesOnStorage)));
35 }
36
37 fFlagsAndNBytes = (fFlagsAndNBytes & kMaskFlags) | nBytesOnStorage;
38}
39
41{
42 std::uint64_t compactType = fFlagsAndNBytes >> 61;
43 switch (compactType) {
44 case 0: return kTypeFile;
45 case 1: return kTypeDAOS;
46 case 2: return kTypePageZero;
47 case 3: return kTypeUnknown;
48 case 4: return Internal::kTestLocatorType;
49 default: break;
50 }
51 R__ASSERT(false);
52 return kTypeUnknown;
53}
54
56{
57 std::uint64_t compactType;
58 switch (type) {
59 case kTypeFile: compactType = 0; break;
60 case kTypeDAOS: compactType = 1; break;
61 case kTypePageZero: compactType = 2; break;
62 case kTypeUnknown: compactType = 3; break;
63 default:
65 compactType = 4;
66 else
67 throw RException(R__FAIL("invalid locator type: " + std::to_string(type)));
68 }
69
70 fFlagsAndNBytes = (fFlagsAndNBytes & ~kMaskType) | (compactType << 61);
71}
72
73void ROOT::RNTupleLocator::SetPosition(std::uint64_t position)
74{
75 if (GetType() != kTypeFile)
76 throw RException(R__FAIL("cannot set position as 64bit offset for type " + std::to_string(GetType())));
77 fPosition = position;
78}
79
81{
82 if (GetType() != kTypeDAOS)
83 throw RException(R__FAIL("cannot set position as 64bit object for type " + std::to_string(GetType())));
84 fPosition = position.GetLocation();
85}
86
88{
89 if (loc.GetType() != ROOT::RNTupleLocator::kTypeFile)
90 throw RException(R__FAIL("cannot retrieve position as 64bit offset for type " + std::to_string(loc.GetType())));
91 return loc.fPosition;
92}
93
96{
97 if (loc.GetType() != ROOT::RNTupleLocator::kTypeDAOS)
98 throw RException(R__FAIL("cannot retrieve position as 64bit object for type " + std::to_string(loc.GetType())));
99 return RNTupleLocatorObject64{loc.fPosition};
100}
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
Definition RError.hxx:300
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Definition TError.h:125
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
Base class for all ROOT issued exceptions.
Definition RError.hxx:79
RNTupleLocator payload that is common for object stores using 64bit location information.
std::uint64_t GetLocation() const
Generic information about the physical location of data.
ELocatorType
Values for the Type field in non-disk locators.
std::uint64_t fFlagsAndNBytes
To save memory, we use the most significant bits to store the locator type (file, DAOS,...
ELocatorType GetType() const
For non-disk locators, the value for the Type field.
void SetType(ELocatorType type)
void SetPosition(std::uint64_t position)
void SetReserved(std::uint8_t reserved)
See GetReserved(): we ignore the reserved flag since we don't use it anywhere currently.
void SetNBytesOnStorage(std::uint64_t nBytesOnStorage)
constexpr RNTupleLocator::ELocatorType kTestLocatorType