16#ifndef ROOT7_RField_Fundamental
17#define ROOT7_RField_Fundamental
20#error "Please include RField.hxx!"
34namespace Experimental {
47 static std::string
TypeName() {
return "void"; }
67 return std::make_unique<RField>(
newName);
70 const RColumnRepresentations &GetColumnRepresentations() const
final;
73 static std::
string TypeName() {
return "bool"; }
79 void AcceptVisitor(Detail::RFieldVisitor &
visitor) const
final;
89 return std::make_unique<RField>(
newName);
92 const RColumnRepresentations &GetColumnRepresentations() const
final;
95 static std::
string TypeName() {
return "char"; }
101 void AcceptVisitor(Detail::RFieldVisitor &
visitor) const
final;
119 const RColumnRepresentations &GetColumnRepresentations()
const final;
122 static std::string TypeName() {
return "std::int8_t"; }
128 void AcceptVisitor(Detail::RFieldVisitor &
visitor)
const final;
136 const RColumnRepresentations &GetColumnRepresentations() const
final;
139 static std::
string TypeName() {
return "std::uint8_t"; }
145 void AcceptVisitor(Detail::RFieldVisitor &
visitor)
const final;
153 const RColumnRepresentations &GetColumnRepresentations() const
final;
156 static std::
string TypeName() {
return "std::int16_t"; }
162 void AcceptVisitor(Detail::RFieldVisitor &
visitor)
const final;
170 const RColumnRepresentations &GetColumnRepresentations() const
final;
173 static std::
string TypeName() {
return "std::uint16_t"; }
179 void AcceptVisitor(Detail::RFieldVisitor &
visitor)
const final;
187 const RColumnRepresentations &GetColumnRepresentations() const
final;
190 static std::
string TypeName() {
return "std::int32_t"; }
196 void AcceptVisitor(Detail::RFieldVisitor &
visitor)
const final;
204 const RColumnRepresentations &GetColumnRepresentations() const
final;
207 static std::
string TypeName() {
return "std::uint32_t"; }
213 void AcceptVisitor(Detail::RFieldVisitor &
visitor)
const final;
221 const RColumnRepresentations &GetColumnRepresentations() const
final;
224 static std::
string TypeName() {
return "std::int64_t"; }
230 void AcceptVisitor(Detail::RFieldVisitor &
visitor)
const final;
238 const RColumnRepresentations &GetColumnRepresentations() const
final;
241 static std::
string TypeName() {
return "std::uint64_t"; }
247 void AcceptVisitor(Detail::RFieldVisitor &
visitor)
const final;
263 static_assert(
sizeof(
signed char) ==
sizeof(std::int8_t));
268 static_assert(
sizeof(
unsigned char) ==
sizeof(std::uint8_t));
273 static_assert(
sizeof(short) ==
sizeof(std::int16_t));
278 static_assert(
sizeof(
unsigned short) ==
sizeof(std::uint16_t));
283 static_assert(
sizeof(
int) ==
sizeof(std::int32_t));
288 static_assert(
sizeof(
unsigned int) ==
sizeof(std::uint32_t));
293 static_assert(
sizeof(long) ==
sizeof(std::int32_t) ||
sizeof(long) ==
sizeof(std::int64_t));
294 using type = std::conditional_t<
sizeof(long) ==
sizeof(std::int32_t), std::int32_t, std::int64_t>;
298 static_assert(
sizeof(
unsigned long) ==
sizeof(std::uint32_t) ||
sizeof(
unsigned long) ==
sizeof(std::uint64_t));
299 using type = std::conditional_t<
sizeof(
unsigned long) ==
sizeof(std::uint32_t), std::uint32_t, std::uint64_t>;
303 static_assert(
sizeof(
long long) ==
sizeof(std::int64_t));
308 static_assert(
sizeof(
unsigned long long) ==
sizeof(std::uint64_t));
315 :
public RIntegralField<typename Internal::RIntegralTypeMap<T>::type> {
317 static_assert(
sizeof(T) ==
sizeof(MappedType),
"invalid size of mapped type");
318 static_assert(std::is_signed_v<T> == std::is_signed_v<MappedType>,
"invalid signedness of mapped type");
324 return std::make_unique<RField>(
newName);
356 using Base::fAvailableColumns;
357 using Base::fColumnRepresentatives;
358 using Base::fPrincipalColumn;
360 std::size_t fBitWidth =
sizeof(T) * 8;
361 double fValueMin = std::numeric_limits<T>::min();
362 double fValueMax = std::numeric_limits<T>::max();
368 fBitWidth(
source.fBitWidth),
369 fValueMin(
source.fValueMin),
370 fValueMax(
source.fValueMax)
376 const auto r = Base::GetColumnRepresentatives();
377 const auto n =
r.size();
378 fAvailableColumns.reserve(
n);
379 for (std::uint16_t i = 0; i <
n; ++i) {
380 auto &column = fAvailableColumns.emplace_back(Internal::RColumn::Create<T>(
r[i][0], 0, i));
382 column->SetBitsOnStorage(fBitWidth);
384 column->SetBitsOnStorage(fBitWidth);
385 column->SetValueRange(fValueMin, fValueMax);
388 fPrincipalColumn = fAvailableColumns[0].get();
402 const auto &
fdesc = desc.GetFieldDescriptor(Base::GetOnDiskId());
403 const auto &
coldesc = desc.GetColumnDescriptor(
fdesc.GetLogicalColumnIds()[0]);
404 column->SetBitsOnStorage(
coldesc.GetBitsOnStorage());
406 const auto &
fdesc = desc.GetFieldDescriptor(Base::GetOnDiskId());
407 const auto &
coldesc = desc.GetColumnDescriptor(
fdesc.GetLogicalColumnIds()[0]);
410 column->SetBitsOnStorage(
coldesc.GetBitsOnStorage());
420 fPrincipalColumn = fAvailableColumns[0].get();
426 using Base::SetColumnRepresentatives;
448 " is out of valid range [" + std::to_string(
minBits) +
", " +
449 std::to_string(
maxBits) +
"])"));
465 " is out of valid range [" + std::to_string(
minBits) +
", " +
466 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::Experimental::RIntegralField< T > RIntegralField
ROOT::Experimental::RField< T > RField
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
Binding & operator=(OUT(*fun)(void))
Abstract base class for classes implementing the visitor design pattern.
static std::pair< std::uint16_t, std::uint16_t > GetValidBitRange(EColumnType 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.
Some fields have multiple possible column representations, e.g.
A field translates read and write calls from/to underlying columns to/from tree values.
RField(std::string_view name)
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)
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)
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.
RField(const RField &)=delete
static std::string TypeName()
RField & operator=(const RField &)=delete
Classes with dictionaries that can be inspected by TClass.
RField & operator=(RField &&other)=default
The on-storage meta-data of an ntuple.
RRealField(RRealField &&other)=default
void GenerateColumns(const RNTupleDescriptor &desc) final
Implementations in derived classes should create the backing columns corresponsing 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
~RRealField() override=default
void SetQuantized(double minValue, double maxValue, std::size_t nBits)
Sets this field to use a quantized integer representation using nBits per value.
RRealField(std::string_view name, std::string_view typeName)
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
void SetHalfPrecision()
Sets this field to use a half precision representation, occupying half as much storage space (16 bits...
RRealField(std::string_view name, const RRealField &source)
Called by derived fields' CloneImpl()
auto Map(Args &&... args)
Create new collection applying a callable to the elements of the input collection.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
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