File indexing completed on 2026-08-16 09:21:11
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef ROOT_RField_SoA
0015 #define ROOT_RField_SoA
0016
0017 #ifndef ROOT_RField
0018 #error "Please include RField.hxx!"
0019 #endif
0020
0021 #include <ROOT/RFieldBase.hxx>
0022 #include <ROOT/RNTupleTypes.hxx>
0023
0024 #include <cstddef>
0025 #include <memory>
0026 #include <string_view>
0027 #include <typeinfo>
0028 #include <vector>
0029
0030 class TClass;
0031
0032 namespace ROOT {
0033
0034 namespace Experimental {
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055 class RSoAField : public RFieldBase {
0056 class RSoADeleter : public RDeleter {
0057 private:
0058 TClass *fSoAClass;
0059
0060 public:
0061 explicit RSoADeleter(TClass *cl) : fSoAClass(cl) {}
0062 void operator()(void *objPtr, bool dtorOnly) final;
0063 };
0064
0065 TClass *fSoAClass = nullptr;
0066 std::vector<RFieldBase *> fRecordMemberFields;
0067
0068
0069 std::vector<std::size_t> fSoAMemberOffsets;
0070 std::size_t fMaxAlignment = 1;
0071 ROOT::Internal::RColumnIndex fNWritten;
0072
0073 RSoAField(std::string_view fieldName, const RSoAField &source);
0074 RSoAField(std::string_view fieldName, TClass *clSoA);
0075
0076 protected:
0077 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
0078
0079 const RColumnRepresentations &GetColumnRepresentations() const final;
0080 void GenerateColumns() final;
0081 void GenerateColumns(const ROOT::RNTupleDescriptor &desc) final;
0082
0083 void ConstructValue(void *where) const final;
0084 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RSoADeleter>(fSoAClass); }
0085
0086 std::size_t AppendImpl(const void *from) final;
0087 void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final;
0088
0089 void ReconcileOnDiskField(const RNTupleDescriptor &) final {}
0090
0091 void CommitClusterImpl() final { fNWritten = 0; }
0092
0093 public:
0094 RSoAField(std::string_view fieldName, std::string_view className);
0095 RSoAField(RSoAField &&other) = default;
0096 RSoAField &operator=(RSoAField &&other) = default;
0097 ~RSoAField() override = default;
0098
0099 std::vector<RValue> SplitValue(const RValue &value) const final;
0100 size_t GetValueSize() const final;
0101 size_t GetAlignment() const final { return fMaxAlignment; }
0102 std::uint32_t GetTypeVersion() const final;
0103 std::uint32_t GetTypeChecksum() const final;
0104
0105
0106
0107 const std::type_info *GetPolymorphicTypeInfo() const;
0108
0109
0110
0111 TClass *GetSoAClass() const { return fSoAClass; }
0112 };
0113
0114 }
0115 }
0116
0117 #endif