Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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  }
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 
JetTiledMap::W
@ W
Definition: TiledEtaPhiMap.h:44
asg
Definition: DataHandleTestTool.h:28
athena.value
value
Definition: athena.py:124
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453