ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthToolSupport
AsgTools
AsgTools
SetProperty.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// SetProperty.h
7
// Methods that are useful for working with AsgTools
8
// Author: W.Buttinger<will@cern.ch>
10
11
#ifndef ASGTOOLS_SETPROPERTY_H
12
#define ASGTOOLS_SETPROPERTY_H
13
14
namespace
asg
{
15
19
template
<
typename
W>
static
StatusCode
setProperty
(
IAsgTool
* tool,
const
std::string& property, W&& value) {
20
AsgTool
* asgtool =
dynamic_cast<
AsgTool
*
>
(tool);
21
if
(!asgtool)
return
StatusCode::FAILURE;
22
return
asgtool->setProperty(property, value);
23
}
24
template
<
typename
W>
static
StatusCode
setProperty
(
IAsgTool
& tool,
const
std::string& property, W&& value) {
25
return
asg::setProperty
( &tool , property, value );
26
}
27
28
template
<
typename
T,
typename
W>
static
StatusCode
setProperty
(std::unique_ptr<T>& tool,
const
std::string& property, W&& value) {
29
return
asg::setProperty
( tool.get() , property, value );
30
}
31
34
template
<
typename
W>
static
StatusCode
setProperty
(
IAsgTool
* tool,
const
std::string& property, ToolHandle<W>&& value) {
35
if
(!tool)
return
StatusCode::FAILURE;
36
std::string subToolName(value.name());
37
size_t
start_pos = subToolName.find(tool->name()+
"."
);
38
if
(start_pos!=std::string::npos) { subToolName.replace( start_pos, tool->name().length()+1,
""
); }
39
return
asg::setProperty
(tool, property, value.type()+
"/"
+subToolName);
40
}
41
42
43
}
//asg namespace
44
45
#endif
46
47
48
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition
AsgTool.h:47
asg::IAsgTool
Base class for the dual-use tool interface classes.
Definition
IAsgTool.h:41
asg
Definition
DataHandleTestTool.h:28
asg::setProperty
static StatusCode setProperty(IAsgTool *tool, const std::string &property, W &&value)
Helper method for calling setProperty on an interface class Usage: asg::setProperty( myTool ,...
Definition
SetProperty.h:19
Generated on
for ATLAS Offline Software by
1.17.0