ATLAS Offline Software
ToolHandle.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Local include(s):
6 #include "AsgTools/ToolHandle.h"
7 #include "AsgTools/IAsgTool.h"
8 
9 ToolHandleBase::ToolHandleBase( const std::string& typeAndName, INamedInterface* parent )
10 : m_typeAndName( typeAndName ), m_type(), m_name(), m_parent(parent) {
11 
12  setTypeAndName(typeAndName);
13 }
14 
15 void ToolHandleBase::setTypeAndName(const std::string& typeAndName) {
16  m_typeAndName = typeAndName;
17  // Decode the received string:
18  size_t pos = 0;
19  if( ( pos = m_typeAndName.find( '/' ) ) == std::string::npos ) {
20  // The user specified a single string, which is used as both the type
21  // and instance name.
22  m_type = m_typeAndName;
23  m_name = m_typeAndName;
24  } else {
25  // The user specified both a type and an instance name.
26  m_type = m_typeAndName.substr( 0, pos );
27  m_name = m_typeAndName.substr( pos + 1 );
28  }
29 }
30 
31 void ToolHandleBase::setName(const std::string& name) {
32  m_name = name;
33 }
34 
35 const std::string& ToolHandleBase::typeAndName() const {
36 
37  return m_typeAndName;
38 }
39 
40 const std::string& ToolHandleBase::type() const {
41 
42  return m_type;
43 }
44 
45 const std::string& ToolHandleBase::name() const {
46 
47  return m_name;
48 }
49 
50 const std::string& ToolHandleBase::parentName() const {
51 
52  if (m_parent)
53  return m_parent->name();
54  static const std::string toolSvcName = "ToolSvc";
55  return toolSvcName;
56 }
57 
58 INamedInterface *ToolHandleBase ::parent() const noexcept {
59  return m_parent;
60 }
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
m_type
TokenType m_type
the type
Definition: TProperty.cxx:44
test_pyathena.parent
parent
Definition: test_pyathena.py:15
IAsgTool.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ToolHandle.h
python.TrigTLAMonitorAlgorithm.parentName
parentName
Definition: TrigTLAMonitorAlgorithm.py:192