Skip to content

Commit 58d21f0

Browse files
committed
reset the parent of tools when invoke AlgBase::setParent()
1 parent 74728d5 commit 58d21f0

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

SniperKernel/SniperKernel/AlgBase.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ class AlgBase : public DLElement
4242
template <typename Type>
4343
Type *tool(const std::string &toolName);
4444

45+
// set the parent (ExecUnit implementation) pointer
46+
virtual void setParent(ExecUnit *parent) override;
47+
4548
//Declared in base class DLElement
4649
//virtual bool initialize() = 0;
4750
//virtual bool finalize() = 0;

SniperKernel/SniperKernel/DLElement.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class DLElement : public NamedElement
5151
void setDescription(const std::string &desc) { m_description = desc; }
5252

5353
// set the parent (ExecUnit implementation) pointer
54-
void setParent(ExecUnit *parent);
54+
virtual void setParent(ExecUnit *parent);
5555

5656
// get a property via its key-name
5757
Property *property(const std::string &key);

SniperKernel/src/AlgBase.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ ToolBase *AlgBase::findTool(const std::string &toolName)
7474
return nullptr;
7575
}
7676

77+
void AlgBase::setParent(ExecUnit *parent)
78+
{
79+
DLElement::setParent(parent);
80+
for (auto &it : m_tools)
81+
{
82+
it.second->setParentAlg(this);
83+
}
84+
}
85+
7786
SniperJSON AlgBase::json()
7887
{
7988
SniperJSON j = DLElement::json();

0 commit comments

Comments
 (0)