ATLAS Offline Software
Loading...
Searching...
No Matches
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):
7
8PropertyMgr::PropertyMgr()
9 : m_props(), m_msg( "PropertyMgr" ) {
10
11}
12
13PropertyMgr::~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
42StatusCode 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
75const 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
88const PropertyMgr::PropMap_t& PropertyMgr::getProperties() const {
89
90 return m_props;
91}
92
93MsgStream& PropertyMgr::msg() const {
94
95 return m_msg;
96}
97
98MsgStream& PropertyMgr::msg( MSG::Level level ) const {
99
100 m_msg << level;
101 return m_msg;
102}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
Support class for PropertyMgr.
Definition Property.h:23
virtual int setFrom(const Property &rhs)
Definition Property.cxx:68
Templated wrapper around user properties.
Definition TProperty.h:28