ATLAS Offline Software
PropertyMgr.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/PropertyMgr.h"
7 
8 PropertyMgr::PropertyMgr()
9  : m_props(), m_msg( "PropertyMgr" ) {
10 
11 }
12 
13 PropertyMgr::~PropertyMgr() {
14 
15  PropMap_t::iterator itr = m_props.begin();
16  PropMap_t::iterator end = m_props.end();
17  for( ; itr != end; ++itr ) {
18  delete itr->second;
19  }
20 }
21 
42 StatusCode PropertyMgr::setProperty( const std::string& name,
43  const char* value ) {
44 
45  // Look for the property:
46  PropMap_t::const_iterator iprop = m_props.find( name );
47  if( iprop == m_props.end() ) {
48  ATH_MSG_ERROR( "Property not found: " << name );
49  return StatusCode::FAILURE;
50  }
51 
52  // Access the property object:
53  Property* pprop = iprop->second;
54  // Create a helper property object:
55  std::string dummy( value );
57  // Try setting the managed property using the helper property object:
58  if( pprop->setFrom( pinprop ) ) {
59  ATH_MSG_ERROR( "Value assignment failed for " << name );
60  return StatusCode::FAILURE;
61  }
62 
63  // We succeeded:
64  return StatusCode::SUCCESS;
65 }
66 
75 const Property* PropertyMgr::getProperty( const std::string& name ) const {
76 
77  // Look for the property:
78  PropMap_t::const_iterator iprop = m_props.find( name );
79  if( iprop == m_props.end() ) {
80  ATH_MSG_WARNING( "Property not found: " << name );
81  return 0;
82  }
83 
84  // Return the property:
85  return iprop->second;
86 }
87 
88 const PropertyMgr::PropMap_t& PropertyMgr::getProperties() const {
89 
90  return m_props;
91 }
92 
93 MsgStream& PropertyMgr::msg() const {
94 
95  return m_msg;
96 }
97 
98 MsgStream& PropertyMgr::msg( MSG::Level level ) const {
99 
100  m_msg << level;
101  return m_msg;
102 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Property::STRING
@ STRING
Definition: Property.h:33
PropertyMgr.h
athena.value
value
Definition: athena.py:122
Property::setFrom
virtual int setFrom(const Property &rhs)
Definition: Property.cxx:68
Property
Support class for PropertyMgr.
Definition: Property.h:23
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TProperty
Templated wrapper around user properties.
Definition: TProperty.h:28
TestMuonSF::getProperty
T getProperty(const asg::IAsgTool *interface_tool, const std::string &prop_name)
Definition: MuonSFTestHelper.cxx:17
python.xAODType.dummy
dummy
Definition: xAODType.py:4
python.test_hypoConfigBuilder.iprop
iprop
Definition: test_hypoConfigBuilder.py:97
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7