9#ifndef ASG_TOOLS_ASG_TOOL_CONFIG_H
10#define ASG_TOOLS_ASG_TOOL_CONFIG_H
81 template<
typename T> ::StatusCode
83 std::shared_ptr<void>& cleanup,
84 bool allowNestedName =
false)
const;
105 template<
typename T> ::StatusCode
121#ifdef XAOD_STANDALONE
123 template<
typename T> ::StatusCode AsgToolConfig ::
124 makeTool (ToolHandle<T>& toolHandle,
125 std::shared_ptr<void>& cleanup,
126 bool allowNestedName)
const
128 using namespace msgComponentConfig;
130 std::string prefix = toolHandle.parentName() +
".";
132 std::unique_ptr<T> tool;
133 ANA_CHECK (makeComponentExpert (tool,
"new %1% (\"%2%\")", allowNestedName, prefix));
136 std::shared_ptr<T> mycleanup (tool.release());
137 toolHandle = mycleanup.get();
141 return StatusCode::SUCCESS;
144 template<
typename T> ::StatusCode AsgToolConfig ::
145 makePrivateTool (ToolHandle<T>& toolHandle)
const
147 using namespace msgComponentConfig;
149 INamedInterface *parentNamed = toolHandle.parent();
150 if (parentNamed ==
nullptr)
152 ANA_MSG_ERROR (
"need to pass private ToolHandle into makePrivateTool");
153 return StatusCode::FAILURE;
155 AsgComponent *parentComponent =
dynamic_cast<AsgComponent*
>(parentNamed);
156 if (parentComponent ==
nullptr)
158 ANA_MSG_ERROR (
"parent \"" << parentNamed->name() <<
"\" for makePrivateTool() does not inherit from AsgComponent");
159 return StatusCode::FAILURE;
162 std::shared_ptr<void> cleanup;
163 if (makeTool (toolHandle, cleanup).isFailure())
164 return StatusCode::FAILURE;
165 parentComponent->addCleanup (cleanup);
166 return StatusCode::SUCCESS;
171 template<
typename T> ::StatusCode AsgToolConfig ::
172 makeTool (ToolHandle<T>& toolHandle,
173 std::shared_ptr<void>& ,
174 bool allowNestedName)
const
176 using namespace msgComponentConfig;
178 std::string prefix = toolHandle.parentName() +
".";
181 toolHandle.setTypeAndName (
type() +
"/" +
name());
185 return StatusCode::SUCCESS;
188 template<
typename T> ::StatusCode AsgToolConfig ::
189 makePrivateTool (ToolHandle<T>& toolHandle)
const
191 using namespace msgComponentConfig;
195 std::shared_ptr<void> cleanup;
196 return makeTool (toolHandle, cleanup);
an object that stores the configuration for an AsgComponent and is able to create one from it
const std::string & name() const noexcept
the name of the component
const std::string & type() const noexcept
the type of the component
StatusCode configureComponentExpert(const std::string &prefix, bool nestedNames) const
add component configuration to configuration service (expert only)
AsgComponentConfig()=default
standard constructor