15 #include "GaudiKernel/PropertyMgr.h"
16 #include "GaudiKernel/INamedInterface.h"
17 #include "GaudiKernel/GaudiException.h"
18 #include "GaudiKernel/Bootstrap.h"
19 #include "GaudiKernel/ISvcLocator.h"
20 #include "GaudiKernel/IMessageSvc.h"
26 constexpr
struct NoCaseCmp_t
28 inline bool operator() (
const std::string& v1 ,
29 const std::string& v2 )
const
31 return v1.size() == v2.size() &&
33 [](
char c1,
char c2) {
44 inline bool operator() (
const Property* p )
const
45 {
return p && noCaseCmp( p->
name() , m_name ) ; }
61 (
const std::string&
name ,
63 const std::string& rname )
65 if ( !rsvc ) {
return nullptr ; }
66 const std::string& nam = rname.empty() ? name : rname ;
68 m_remoteProperties.emplace_back ( name , std::make_pair( rsvc , nam ) ) ;
75 (
const std::string& name ,
76 const std::vector<Property*>& props )
const
78 auto it = std::find_if( props.begin(), props.end(), PropByName{ name } ) ;
79 return ( it != props.end() ) ? *it :
nullptr;
85 (
const std::string& name )
const
88 Property* lp = property ( name , m_properties ) ;
89 if ( lp ) {
return lp ; }
91 for (
const auto& it : m_remoteProperties )
93 if ( !noCaseCmp(it.first,name) ) { continue ; }
95 if ( !p ) { continue ; }
162 if ( !p )
throw std::out_of_range(
"Property "+name+
" not found." );
171 (
const std::string&
n ,
172 std::string& v )
const
185 const std::vector<Property*>&
204 return noCaseCmp(prop->
name(),
name);
213 <<
"duplicated property name '" << name
214 <<
"', see https://its.cern.ch/jira/browse/GAUDI-1023"<<
endmsg;
Definition of the MsgStream class used to transmit messages.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
virtual bool assign(const Property &source)=0
import the property value form the source
virtual const std::vector< Property * > & getProperties() const =0
Get list of properties.
virtual std::string toString() const =0
value -> string
const std::string & name() const
property name
StatusCode setProperty(const Property &p) override
set the property form another property
StatusCode queryInterface(const InterfaceID &iid, void **pinterface) override
bool isSuccess() const
Test for a status code of SUCCESS.
auto begin(reverse_wrapper< T > &w)
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
virtual bool load(Property &dest) const =0
export the property value to the destination
bool isFailure() const
Test for a status code of FAILURE.
IInterface * m_pOuter
Interface hub reference (ApplicationMgr)
virtual const std::string & name() const =0
Retrieve the name of the instance.
StatusCode getProperty(Property *p) const override
get the property
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Properties m_properties
Collection of all declared properties.
GAUDI_API ISvcLocator * svcLocator()
unsigned long addRef() override
Reference Interface instance.
auto end(reverse_wrapper< T > &w)
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.
const std::vector< Property * > & getProperties() const override
get all properties
The IMessage is the interface implemented by the message service.
Property base class allowing Property* collections to be "homogeneous".
bool hasProperty(const std::string &name) const override
Return true if we have a property with the given name.
Property * declareRemoteProperty(const std::string &name, IProperty *rsvc, const std::string &rname="")
Declare a remote property.
StatusCode queryInterface(const InterfaceID &ti, void **pp) override
Implementation of IInterface::queryInterface.
The IProperty is the basic interface for all components which have properties that can be set or get...
void assertUniqueName(const std::string &name) const
Throw an exception if the name is already present in the list of properties (see GAUDI-1023).
void toupper(std::string &s)
PropertyMgr(IInterface *iface=nullptr)
constructor from the interface
Property * property(const std::string &name) const
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)=0
Set the void** to the pointer to the requested interface of the instance.
virtual StatusCode fromString(const std::string &value)=0
string -> value