Skip to content

Commit

Permalink
[ntuple] move RValue::BindRaw impl to compilation unit
Browse files Browse the repository at this point in the history
  • Loading branch information
jblomer committed Feb 17, 2024
1 parent 50c338d commit 8545c24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 1 addition & 5 deletions tree/ntuple/v7/inc/ROOT/RField.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,6 @@ public:
friend class RFieldBase;

private:
/// Empty shared pointer, used as the basis for an aliasing shared pointer constructor in BindRawPtr.
/// Note that as a result of BindRawPtr, fObjPtr will be non-empty but have use count zero.
static std::shared_ptr<void> fgRawPtrCtrlBlock;

RFieldBase *fField = nullptr; ///< The field that created the RValue
std::shared_ptr<void> fObjPtr; ///< Set by Bind() or by RFieldBase::CreateValue(), SplitValue() or BindValue()

Expand All @@ -203,7 +199,7 @@ public:
void Read(NTupleSize_t globalIndex) { fField->Read(globalIndex, fObjPtr.get()); }
void Read(RClusterIndex clusterIndex) { fField->Read(clusterIndex, fObjPtr.get()); }
void Bind(std::shared_ptr<void> objPtr) { fObjPtr = objPtr; }
void BindRawPtr(void *rawPtr) { fObjPtr = std::shared_ptr<void>(fgRawPtrCtrlBlock, rawPtr); }
void BindRawPtr(void *rawPtr);
/// Replace the current object pointer by a pointer to a new object constructed by the field
void EmplaceNew() { fObjPtr = fField->CreateValue().GetPtr<void>(); }

Expand Down
8 changes: 7 additions & 1 deletion tree/ntuple/v7/src/RField.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,13 @@ ROOT::Experimental::RFieldBase::RColumnRepresentations::RColumnRepresentations(

//------------------------------------------------------------------------------

std::shared_ptr<void> ROOT::Experimental::RFieldBase::RValue::fgRawPtrCtrlBlock;
void ROOT::Experimental::RFieldBase::RValue::BindRawPtr(void *rawPtr)
{
/// Empty shared pointer, used as the basis for the aliasing shared pointer constructor around rawPtr.
/// Note that as a result of BindRawPtr, fObjPtr will be non-empty but have use count zero.
static std::shared_ptr<void> fgRawPtrCtrlBlock;
fObjPtr = std::shared_ptr<void>(fgRawPtrCtrlBlock, rawPtr);
}

//------------------------------------------------------------------------------

Expand Down

0 comments on commit 8545c24

Please sign in to comment.