Skip to content

Commit

Permalink
reset the parent of tools when invoke AlgBase::setParent()
Browse files Browse the repository at this point in the history
  • Loading branch information
zoujh committed Oct 29, 2021
1 parent 74728d5 commit 58d21f0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions SniperKernel/SniperKernel/AlgBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class AlgBase : public DLElement
template <typename Type>
Type *tool(const std::string &toolName);

// set the parent (ExecUnit implementation) pointer
virtual void setParent(ExecUnit *parent) override;

//Declared in base class DLElement
//virtual bool initialize() = 0;
//virtual bool finalize() = 0;
Expand Down
2 changes: 1 addition & 1 deletion SniperKernel/SniperKernel/DLElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class DLElement : public NamedElement
void setDescription(const std::string &desc) { m_description = desc; }

// set the parent (ExecUnit implementation) pointer
void setParent(ExecUnit *parent);
virtual void setParent(ExecUnit *parent);

// get a property via its key-name
Property *property(const std::string &key);
Expand Down
9 changes: 9 additions & 0 deletions SniperKernel/src/AlgBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ ToolBase *AlgBase::findTool(const std::string &toolName)
return nullptr;
}

void AlgBase::setParent(ExecUnit *parent)
{
DLElement::setParent(parent);
for (auto &it : m_tools)
{
it.second->setParentAlg(this);
}
}

SniperJSON AlgBase::json()
{
SniperJSON j = DLElement::json();
Expand Down

0 comments on commit 58d21f0

Please sign in to comment.