2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
5 #ifndef ASGTOOLS_ASGTOOL_ICC
6 #define ASGTOOLS_ASGTOOL_ICC
11 #include "AsgTools/PropertyMgr.h"
12 #include "AsgTools/TProperty.h"
17 const T* AsgTool::getProperty( const std::string& name ) const {
19 // Get the property object (if it exists):
20 const Property* prop = m_properties->getProperty( name );
22 ATH_MSG_WARNING( "Property with name \"" << name << "\" not found" );
26 // Try to cast it to the required type:
27 const TProperty< T >* tprop =
28 dynamic_cast< const TProperty< T >* >( prop );
30 ATH_MSG_WARNING( "Property \"" << name << "\" is of type: "
31 << prop->typeName() );
35 // Okay, we succeeded:
36 return tprop->pointer();
41 #endif // XAOD_STANDALONE
43 #ifndef XAOD_STANDALONE
45 // Gaudi/Athena include(s):
46 #include "Gaudi/Property.h"
47 #include "GaudiKernel/System.h"
53 const T* AsgTool::getProperty( const std::string& name ) const {
55 // Check if the property exists.
56 if( ! hasProperty( name ) ) {
57 ATH_MSG_WARNING( "Property with name \"" << name << "\" not found" );
61 // Get the property object.
62 const auto* prop = property( name );
63 if( prop == nullptr ) {
64 ATH_MSG_FATAL( "Internal coding error detected!" );
68 // Cast it to the underlying type.
69 const Gaudi::Property<T&>* tprop =
70 dynamic_cast< const Gaudi::Property<T&>* >( prop );
72 ATH_MSG_WARNING( "Property \"" << name << "\" is of type: "
73 << System::typeinfoName( *( prop->type_info() ) ) );
78 // Okay, we succeeded:
79 return &( tprop->value() );
84 #endif // not XAOD_STANDALONE
86 #endif // not ASGTOOLS_ASGTOOL_ICC