13#ifndef ROOT_RField_Fundamental
14#define ROOT_RField_Fundamental
17#error "Please include RField.hxx!"
39 static std::string
TypeName() {
return "void"; }
59 return std::make_unique<RField>(
newName);
62 const RColumnRepresentations &GetColumnRepresentations()
const final;
65 static std::
string TypeName() {
return "bool"; }
81 return std::make_unique<RField>(
newName);
84 const RColumnRepresentations &GetColumnRepresentations()
const final;
87 static std::
string TypeName() {
return "char"; }
111 const RColumnRepresentations &GetColumnRepresentations()
const final;
114 static std::string TypeName() {
return "std::int8_t"; }
115 explicit RIntegralField(std::string_view
name) : RSimpleField(
name, TypeName()) {}
116 RIntegralField(RIntegralField &&
other) =
default;
117 RIntegralField &operator=(RIntegralField &&
other) =
default;
118 ~RIntegralField()
override =
default;
128 const RColumnRepresentations &GetColumnRepresentations()
const final;
131 static std::
string TypeName() {
return "std::uint8_t"; }
132 explicit RIntegralField(std::string_view
name) : RSimpleField(
name, TypeName()) {}
133 RIntegralField(RIntegralField &&
other) =
default;
134 RIntegralField &operator=(RIntegralField &&
other) =
default;
135 ~RIntegralField()
override =
default;
145 const RColumnRepresentations &GetColumnRepresentations()
const final;
148 static std::
string TypeName() {
return "std::int16_t"; }
149 explicit RIntegralField(std::string_view
name) : RSimpleField(
name, TypeName()) {}
150 RIntegralField(RIntegralField &&
other) =
default;
151 RIntegralField &operator=(RIntegralField &&
other) =
default;
152 ~RIntegralField()
override =
default;
162 const RColumnRepresentations &GetColumnRepresentations()
const final;
165 static std::
string TypeName() {
return "std::uint16_t"; }
166 explicit RIntegralField(std::string_view
name) : RSimpleField(
name, TypeName()) {}
167 RIntegralField(RIntegralField &&
other) =
default;
168 RIntegralField &operator=(RIntegralField &&
other) =
default;
169 ~RIntegralField()
override =
default;
179 const RColumnRepresentations &GetColumnRepresentations()
const final;
182 static std::
string TypeName() {
return "std::int32_t"; }
183 explicit RIntegralField(std::string_view
name) : RSimpleField(
name, TypeName()) {}
184 RIntegralField(RIntegralField &&
other) =
default;
185 RIntegralField &operator=(RIntegralField &&
other) =
default;
186 ~RIntegralField()
override =
default;
196 const RColumnRepresentations &GetColumnRepresentations()
const final;
199 static std::
string TypeName() {
return "std::uint32_t"; }
200 explicit RIntegralField(std::string_view
name) : RSimpleField(
name, TypeName()) {}
201 RIntegralField(RIntegralField &&
other) =
default;
202 RIntegralField &operator=(RIntegralField &&
other) =
default;
203 ~RIntegralField()
override =
default;
213 const RColumnRepresentations &GetColumnRepresentations()
const final;
216 static std::
string TypeName() {
return "std::int64_t"; }
217 explicit RIntegralField(std::string_view
name) : RSimpleField(
name, TypeName()) {}
218 RIntegralField(RIntegralField &&
other) =
default;
219 RIntegralField &operator=(RIntegralField &&
other) =
default;
220 ~RIntegralField()
override =
default;
230 const RColumnRepresentations &GetColumnRepresentations()
const final;
233 static std::
string TypeName() {
return "std::uint64_t"; }
234 explicit RIntegralField(std::string_view
name) : RSimpleField(
name, TypeName()) {}
235 RIntegralField(RIntegralField &&
other) =
default;
236 RIntegralField &operator=(RIntegralField &&
other) =
default;
237 ~RIntegralField()
override =
default;
255 static_assert(
sizeof(
signed char) ==
sizeof(std::int8_t));
260 static_assert(
sizeof(
unsigned char) ==
sizeof(std::uint8_t));
265 static_assert(
sizeof(short) ==
sizeof(std::int16_t));
270 static_assert(
sizeof(
unsigned short) ==
sizeof(std::uint16_t));
275 static_assert(
sizeof(
int) ==
sizeof(std::int32_t));
280 static_assert(
sizeof(
unsigned int) ==
sizeof(std::uint32_t));
285 static_assert(
sizeof(long) ==
sizeof(std::int32_t) ||
sizeof(long) ==
sizeof(std::int64_t));
286 using type = std::conditional_t<
sizeof(long) ==
sizeof(std::int32_t), std::int32_t, std::int64_t>;
290 static_assert(
sizeof(
unsigned long) ==
sizeof(std::uint32_t) ||
sizeof(
unsigned long) ==
sizeof(std::uint64_t));
291 using type = std::conditional_t<
sizeof(
unsigned long) ==
sizeof(std::uint32_t), std::uint32_t, std::uint64_t>;
295 static_assert(
sizeof(
long long) ==
sizeof(std::int64_t));
300 static_assert(
sizeof(
unsigned long long) ==
sizeof(std::uint64_t));
307 :
public RIntegralField<typename Internal::RIntegralTypeMap<T>::type> {
309 static_assert(
sizeof(T) ==
sizeof(MappedType),
"invalid size of mapped type");
310 static_assert(std::is_signed_v<T> == std::is_signed_v<MappedType>,
"invalid signedness of mapped type");
316 return std::make_unique<RField>(
newName);
320 RField(std::string_view
name) : RIntegralField<MappedType>(
name) {}
348 using Base::fAvailableColumns;
349 using Base::fColumnRepresentatives;
350 using Base::fPrincipalColumn;
352 std::size_t fBitWidth =
sizeof(T) * 8;
353 double fValueMin = std::numeric_limits<T>::min();
354 double fValueMax = std::numeric_limits<T>::max();
360 fBitWidth(
source.fBitWidth),
361 fValueMin(
source.fValueMin),
362 fValueMax(
source.fValueMax)
368 const auto r = Base::GetColumnRepresentatives();
369 const auto n =
r.size();
370 fAvailableColumns.reserve(
n);
371 for (std::uint16_t i = 0; i <
n; ++i) {
372 auto &column = fAvailableColumns.emplace_back(ROOT::Internal::RColumn::Create<T>(
r[i][0], 0, i));
374 column->SetBitsOnStorage(fBitWidth);
376 column->SetBitsOnStorage(fBitWidth);
377 column->SetValueRange(fValueMin, fValueMax);
380 fPrincipalColumn = fAvailableColumns[0].get();
394 const auto &
fdesc = desc.GetFieldDescriptor(Base::GetOnDiskId());
396 column->SetBitsOnStorage(
coldesc.GetBitsOnStorage());
398 const auto &
fdesc = desc.GetFieldDescriptor(Base::GetOnDiskId());
402 column->SetBitsOnStorage(
coldesc.GetBitsOnStorage());
412 fPrincipalColumn = fAvailableColumns[0].get();
416 using Base::SetColumnRepresentatives;
440 " is out of valid range [" + std::to_string(
minBits) +
", " +
441 std::to_string(
maxBits) +
"])"));
461 throw RException(
R__FAIL(
"value range given to SetQuantized() has max < min! (" +
466 " is out of valid range [" + std::to_string(
minBits) +
", " +
467 std::to_string(
maxBits) +
"])"));
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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 r
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
Abstract base class for classes implementing the visitor design pattern.
static std::pair< std::uint16_t, std::uint16_t > GetValidBitRange(ROOT::ENTupleColumnType type)
Most types have a fixed on-disk bit width.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Base class for all ROOT issued exceptions.
The list of column representations a field can have.
A field translates read and write calls from/to underlying columns to/from tree values.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
RField(std::string_view name)
RField & operator=(RField &&other)=default
RField(RField &&other)=default
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
RField(RField &&other)=default
RField & operator=(RField &&other)=default
RField(std::string_view name)
RField(std::string_view name, const RField &source)
RField(std::string_view name)
static std::string TypeName()
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
static std::string TypeName()
RField(std::string_view name)
RField(std::string_view name, const RField &source)
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
static std::string TypeName()
RField & operator=(const RField &)=delete
RField(const RField &)=delete
Classes with dictionaries that can be inspected by TClass.
RField & operator=(RField &&other)=default
RField(std::string_view name)
The on-storage metadata of an RNTuple.
~RRealField() override=default
RRealField(std::string_view name, const RRealField &source)
Called by derived fields' CloneImpl()
RRealField(std::string_view name, std::string_view typeName)
void SetHalfPrecision()
Sets this field to use a half precision representation, occupying half as much storage space (16 bits...
void SetQuantized(std::size_t nBits, std::pair< T, T > valueRange)
Sets this field to use a quantized integer representation using nBits per value.
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
void SetTruncated(std::size_t nBits)
Set the on-disk representation of this field to a single-precision float truncated to nBits.
RRealField & operator=(RRealField &&other)=default
void GenerateColumns(const ROOT::RNTupleDescriptor &desc) final
Implementations in derived classes should create the backing columns corresponding to the field type ...
RRealField(RRealField &&other)=default
auto Map(Args &&... args)
Create new collection applying a callable to the elements of the input collection.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
std::conditional_t< sizeof(long)==sizeof(std::int32_t), std::int32_t, std::int64_t > type
std::conditional_t< sizeof(unsigned long)==sizeof(std::uint32_t), std::uint32_t, std::uint64_t > type