PropertyMgr Class Reference

Property manager helper class. More...

#include <GaudiKernel/PropertyMgr.h>

Inheritance diagram for PropertyMgr:
Collaboration diagram for PropertyMgr:

Public Member Functions

 PropertyMgr (IInterface *iface=nullptr)
 constructor from the interface More...
 
 PropertyMgr (const PropertyMgr &)=delete
 
PropertyMgroperator= (const PropertyMgr &)=delete
 
 ~PropertyMgr () override=default
 virtual destructor More...
 
template<class TYPE >
PropertydeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Declare a property (templated) More...
 
template<class TYPE >
PropertydeclareProperty (const std::string &name, SimpleProperty< TYPE > &prop, const std::string &doc="none")
 Declare a property (specialization) More...
 
template<class TYPE >
PropertydeclareProperty (const std::string &name, SimplePropertyRef< TYPE > &prop, const std::string &doc="none")
 Declare a property (specialization) More...
 
template<class TYPE >
PropertydeclareProperty (const std::string &name, ToolHandle< TYPE > &ref, const std::string &doc="none")
 Declare a property (specialization) More...
 
template<class TYPE >
PropertydeclareProperty (const std::string &name, ServiceHandle< TYPE > &ref, const std::string &doc="none")
 Declare a property (specialization) More...
 
template<class TYPE >
PropertydeclareProperty (const std::string &name, ToolHandleArray< TYPE > &ref, const std::string &doc="none")
 Declare a property (specialization) More...
 
template<class TYPE >
PropertydeclareProperty (const std::string &name, ServiceHandleArray< TYPE > &ref, const std::string &doc="none")
 Declare a property (specialization) More...
 
PropertydeclareProperty (const std::string &name, DataObjectDescriptor &ref, const std::string &doc="none")
 Declare a property (specialization) More...
 
PropertydeclareProperty (const std::string &name, DataObjectDescriptorCollection &ref, const std::string &doc="none")
 Declare a property (specialization) More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const Property &p) override
 set the property form another property More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the property formatted string More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 set the property from name and the value More...
 
StatusCode getProperty (Property *p) const override
 get the property More...
 
const PropertygetProperty (const std::string &name) const override
 get the property by name More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Property * > & getProperties () const override
 get all properties More...
 
bool hasProperty (const std::string &name) const override
 Return true if we have a property with the given name. More...
 
StatusCode queryInterface (const InterfaceID &iid, void **pinterface) override
 
 PropertyMgr (IInterface *iface=nullptr)
 constructor from the interface More...
 
 PropertyMgr (const PropertyMgr &)=delete
 
PropertyMgroperator= (const PropertyMgr &)=delete
 
 ~PropertyMgr () override=default
 virtual destructor More...
 
template<class TYPE >
PropertydeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Declare a property (templated) More...
 
template<class TYPE >
PropertydeclareProperty (const std::string &name, SimpleProperty< TYPE > &prop, const std::string &doc="none")
 Declare a property (specialization) More...
 
template<class TYPE >
PropertydeclareProperty (const std::string &name, SimplePropertyRef< TYPE > &prop, const std::string &doc="none")
 Declare a property (specialization) More...
 
template<class TYPE >
PropertydeclareProperty (const std::string &name, ToolHandle< TYPE > &ref, const std::string &doc="none")
 Declare a property (specialization) More...
 
template<class TYPE >
PropertydeclareProperty (const std::string &name, ServiceHandle< TYPE > &ref, const std::string &doc="none")
 Declare a property (specialization) More...
 
template<class TYPE >
PropertydeclareProperty (const std::string &name, ToolHandleArray< TYPE > &ref, const std::string &doc="none")
 Declare a property (specialization) More...
 
template<class TYPE >
PropertydeclareProperty (const std::string &name, ServiceHandleArray< TYPE > &ref, const std::string &doc="none")
 Declare a property (specialization) More...
 
PropertydeclareProperty (const std::string &name, DataObjectDescriptor &ref, const std::string &doc="none")
 Declare a property (specialization) More...
 
PropertydeclareProperty (const std::string &name, DataObjectDescriptorCollection &ref, const std::string &doc="none")
 Declare a property (specialization) More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const Property &p) override
 set the property form another property More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the property formatted string More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 set the property from name and the value More...
 
StatusCode getProperty (Property *p) const override
 get the property More...
 
const PropertygetProperty (const std::string &name) const override
 get the property by name More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Property * > & getProperties () const override
 get all properties More...
 
bool hasProperty (const std::string &name) const override
 Return true if we have a property with the given name. More...
 
StatusCode queryInterface (const InterfaceID &iid, void **pinterface) override
 
- Public Member Functions inherited from implements< Interfaces >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 implements ()=default
 Default constructor. More...
 
 implements (const implements &)
 Copy constructor (zero the reference count) More...
 
implementsoperator= (const implements &)
 Assignment operator (do not touch the reference count). More...
 
 ~implements () override=default
 Virtual destructor. More...
 
unsigned long addRef () override
 Reference Interface instance. More...
 
unsigned long release () override
 Release Interface instance. More...
 
unsigned long refCount () const override
 Current reference count. More...
 
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 implements ()=default
 Default constructor. More...
 
 implements (const implements &)
 Copy constructor (zero the reference count) More...
 
implementsoperator= (const implements &)
 Assignment operator (do not touch the reference count). More...
 
 ~implements () override=default
 Virtual destructor. More...
 
unsigned long addRef () override
 Reference Interface instance. More...
 
unsigned long release () override
 Release Interface instance. More...
 
unsigned long refCount () const override
 Current reference count. More...
 
- Public Member Functions inherited from extend_interfaces< Interfaces...>
 ~extend_interfaces () override=default
 Virtual destructor. More...
 
 ~extend_interfaces () override=default
 Virtual destructor. More...
 

Protected Member Functions

Propertyproperty (const std::string &name) const
 
Propertyproperty (const std::string &name) const
 

Private Types

typedef std::vector< Property * > Properties
 
typedef std::pair< std::string, std::pair< IProperty *, std::string > > RemProperty
 
typedef std::vector< RemPropertyRemoteProperties
 
typedef std::vector< Property * > Properties
 
typedef std::pair< std::string, std::pair< IProperty *, std::string > > RemProperty
 
typedef std::vector< RemPropertyRemoteProperties
 

Private Member Functions

Propertyproperty (const std::string &name, const std::vector< Property * > &props) const
 get the property by name form the proposed list More...
 
void assertUniqueName (const std::string &name) const
 Throw an exception if the name is already present in the list of properties (see GAUDI-1023). More...
 
Propertyproperty (const std::string &name, const std::vector< Property * > &props) const
 get the property by name form the proposed list More...
 
void assertUniqueName (const std::string &name) const
 Throw an exception if the name is already present in the list of properties (see GAUDI-1023). More...
 

Private Attributes

Properties m_properties
 Collection of all declared properties. More...
 
RemoteProperties m_remoteProperties
 Collection of all declared remote properties. More...
 
std::vector< std::unique_ptr< Property > > m_todelete
 Properties to be deleted. More...
 
IInterfacem_pOuter
 Interface hub reference (ApplicationMgr) More...
 

Additional Inherited Members

- Public Types inherited from implements< Interfaces >
using base_class = implements< Interfaces...>
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
using iids = typename extend_interfaces_base::ext_iids
 
using base_class = implements< Interfaces...>
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
using iids = typename extend_interfaces_base::ext_iids
 
- Public Types inherited from extend_interfaces< Interfaces...>
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 
- Protected Attributes inherited from implements< Interfaces >
std::atomic_ulong m_refCount = {0}
 Reference counter. More...
 

Detailed Description

Property manager helper class.

This class is used by algorithms and services for helping to manage its own set of properties. It implements the IProperty interface.

Author
Paul Maley
David Quarrie

Definition at line 35 of file PropertyMgr.h.

Member Typedef Documentation

typedef std::vector<Property*> PropertyMgr::Properties
private

Definition at line 168 of file PropertyMgr.h.

typedef std::vector<Property*> PropertyMgr::Properties
private

Definition at line 168 of file PropertyMgr.h.

typedef std::vector<RemProperty> PropertyMgr::RemoteProperties
private

Definition at line 171 of file PropertyMgr.h.

typedef std::vector<RemProperty> PropertyMgr::RemoteProperties
private

Definition at line 171 of file PropertyMgr.h.

typedef std::pair<std::string, std::pair<IProperty*, std::string> > PropertyMgr::RemProperty
private

Definition at line 170 of file PropertyMgr.h.

typedef std::pair<std::string, std::pair<IProperty*, std::string> > PropertyMgr::RemProperty
private

Definition at line 170 of file PropertyMgr.h.

Constructor & Destructor Documentation

PropertyMgr::PropertyMgr ( IInterface iface = nullptr)

constructor from the interface

Definition at line 52 of file PropertyMgr.cpp.

53  : m_pOuter ( iface )
54 {
55  addRef(); // initial reference count set to 1
56 }
IInterface * m_pOuter
Interface hub reference (ApplicationMgr)
Definition: PropertyMgr.h:180
unsigned long addRef() override
Reference Interface instance.
Definition: implements.h:44
PropertyMgr::PropertyMgr ( const PropertyMgr )
delete
PropertyMgr::~PropertyMgr ( )
overridedefault

virtual destructor

PropertyMgr::PropertyMgr ( IInterface iface = nullptr)

constructor from the interface

PropertyMgr::PropertyMgr ( const PropertyMgr )
delete
PropertyMgr::~PropertyMgr ( )
overridedefault

virtual destructor

Member Function Documentation

void PropertyMgr::assertUniqueName ( const std::string &  name) const
private

Throw an exception if the name is already present in the list of properties (see GAUDI-1023).

Definition at line 207 of file PropertyMgr.cpp.

207  {
208  if (UNLIKELY(hasProperty(name))) {
209  auto owner = SmartIF<INamedInterface>( m_pOuter );
210  auto msgSvc = Gaudi::svcLocator()->service<IMessageSvc>("MessageSvc");
211  MsgStream log(msgSvc, owner ? owner->name() : "PropertyMgr" );
212  log << MSG::WARNING
213  << "duplicated property name '" << name
214  << "', see https://its.cern.ch/jira/browse/GAUDI-1023"<< endmsg;
215  }
216 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
IInterface * m_pOuter
Interface hub reference (ApplicationMgr)
Definition: PropertyMgr.h:180
virtual const std::string & name() const =0
Retrieve the name of the instance.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
GAUDI_API ISvcLocator * svcLocator()
The IMessage is the interface implemented by the message service.
Definition: IMessageSvc.h:57
bool hasProperty(const std::string &name) const override
Return true if we have a property with the given name.
#define UNLIKELY(x)
Definition: Kernel.h:126
void PropertyMgr::assertUniqueName ( const std::string &  name) const
private

Throw an exception if the name is already present in the list of properties (see GAUDI-1023).

template<class TYPE >
Property * PropertyMgr::declareProperty ( const std::string &  name,
TYPE &  value,
const std::string &  doc = "none" 
)
inline

Declare a property (templated)

Definition at line 188 of file PropertyMgr.h.

191 {
193  m_todelete.emplace_back( new SimplePropertyRef<TYPE> ( name , value ) );
194  Property* p = m_todelete.back().get();
195  //
196  p->setDocumentation( doc );
197  m_properties .push_back( p ) ;
198  //
199  return p ;
200 }
SimplePropertyRef templated class.
Definition: HistoProperty.h:14
void setDocumentation(std::string documentation)
set the documentation string
Definition: Property.h:94
Properties m_properties
Collection of all declared properties.
Definition: PropertyMgr.h:174
std::vector< std::unique_ptr< Property > > m_todelete
Properties to be deleted.
Definition: PropertyMgr.h:178
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
void assertUniqueName(const std::string &name) const
Throw an exception if the name is already present in the list of properties (see GAUDI-1023).
template<class TYPE >
Property* PropertyMgr::declareProperty ( const std::string &  name,
TYPE &  value,
const std::string &  doc = "none" 
)

Declare a property (templated)

template<class TYPE >
Property * PropertyMgr::declareProperty ( const std::string &  name,
SimpleProperty< TYPE > &  prop,
const std::string &  doc = "none" 
)
inline

Declare a property (specialization)

Declare a property (templated)

Definition at line 207 of file PropertyMgr.h.

210 {
212  Property* p = &prop ;
213  //
214  p -> setName ( name ) ;
215  p -> setDocumentation ( doc ) ;
216  m_properties.push_back ( p ) ;
217  //
218  return p ;
219 }
Properties m_properties
Collection of all declared properties.
Definition: PropertyMgr.h:174
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
void assertUniqueName(const std::string &name) const
Throw an exception if the name is already present in the list of properties (see GAUDI-1023).
template<class TYPE >
Property* PropertyMgr::declareProperty ( const std::string &  name,
SimpleProperty< TYPE > &  prop,
const std::string &  doc = "none" 
)

Declare a property (specialization)

template<class TYPE >
Property * PropertyMgr::declareProperty ( const std::string &  name,
SimplePropertyRef< TYPE > &  prop,
const std::string &  doc = "none" 
)
inline

Declare a property (specialization)

Declare a property (templated)

Definition at line 226 of file PropertyMgr.h.

229 {
231  Property* p = &prop ;
232  //
233  p -> setName ( name ) ;
234  p -> setDocumentation ( doc ) ;
235  m_properties.push_back ( p ) ;
236  //
237  return p ;
238 }
Properties m_properties
Collection of all declared properties.
Definition: PropertyMgr.h:174
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
void assertUniqueName(const std::string &name) const
Throw an exception if the name is already present in the list of properties (see GAUDI-1023).
template<class TYPE >
Property* PropertyMgr::declareProperty ( const std::string &  name,
SimplePropertyRef< TYPE > &  prop,
const std::string &  doc = "none" 
)

Declare a property (specialization)

template<class TYPE >
Property * PropertyMgr::declareProperty ( const std::string &  name,
ToolHandle< TYPE > &  ref,
const std::string &  doc = "none" 
)
inline

Declare a property (specialization)

Definition at line 245 of file PropertyMgr.h.

248 {
250  m_todelete . emplace_back ( new GaudiHandleProperty( name, ref ) );
251  Property* p = m_todelete.back().get();
252  //
253  p -> setDocumentation ( doc ) ;
254  m_properties . push_back ( p ) ;
255  //
256  return p ;
257 }
Properties m_properties
Collection of all declared properties.
Definition: PropertyMgr.h:174
std::vector< std::unique_ptr< Property > > m_todelete
Properties to be deleted.
Definition: PropertyMgr.h:178
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
void assertUniqueName(const std::string &name) const
Throw an exception if the name is already present in the list of properties (see GAUDI-1023).
template<class TYPE >
Property* PropertyMgr::declareProperty ( const std::string &  name,
ToolHandle< TYPE > &  ref,
const std::string &  doc = "none" 
)

Declare a property (specialization)

template<class TYPE >
Property * PropertyMgr::declareProperty ( const std::string &  name,
ServiceHandle< TYPE > &  ref,
const std::string &  doc = "none" 
)
inline

Declare a property (specialization)

Definition at line 262 of file PropertyMgr.h.

265 {
267  m_todelete . emplace_back (new GaudiHandleProperty( name, ref ));
268  Property* p = m_todelete.back().get();
269  //
270  p -> setDocumentation ( doc ) ;
271  m_properties . push_back ( p ) ;
272  //
273  return p ;
274 }
Properties m_properties
Collection of all declared properties.
Definition: PropertyMgr.h:174
std::vector< std::unique_ptr< Property > > m_todelete
Properties to be deleted.
Definition: PropertyMgr.h:178
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
void assertUniqueName(const std::string &name) const
Throw an exception if the name is already present in the list of properties (see GAUDI-1023).
template<class TYPE >
Property* PropertyMgr::declareProperty ( const std::string &  name,
ServiceHandle< TYPE > &  ref,
const std::string &  doc = "none" 
)

Declare a property (specialization)

template<class TYPE >
Property * PropertyMgr::declareProperty ( const std::string &  name,
ToolHandleArray< TYPE > &  ref,
const std::string &  doc = "none" 
)
inline

Declare a property (specialization)

Definition at line 279 of file PropertyMgr.h.

282 {
284  m_todelete . emplace_back ( new GaudiHandleArrayProperty( name, ref ) );
285  Property* p = m_todelete.back().get();
286  //
287  p -> setDocumentation ( doc ) ;
288  m_properties . push_back ( p ) ;
289  //
290  return p ;
291 }
Properties m_properties
Collection of all declared properties.
Definition: PropertyMgr.h:174
std::vector< std::unique_ptr< Property > > m_todelete
Properties to be deleted.
Definition: PropertyMgr.h:178
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
void assertUniqueName(const std::string &name) const
Throw an exception if the name is already present in the list of properties (see GAUDI-1023).
template<class TYPE >
Property* PropertyMgr::declareProperty ( const std::string &  name,
ToolHandleArray< TYPE > &  ref,
const std::string &  doc = "none" 
)

Declare a property (specialization)

template<class TYPE >
Property * PropertyMgr::declareProperty ( const std::string &  name,
ServiceHandleArray< TYPE > &  ref,
const std::string &  doc = "none" 
)
inline

Declare a property (specialization)

Definition at line 296 of file PropertyMgr.h.

299 {
301  m_todelete . emplace_back ( new GaudiHandleArrayProperty( name, ref ) );
302  Property* p = m_todelete.back().get();
303  //
304  p -> setDocumentation ( doc ) ;
305  m_properties . push_back ( p ) ;
306  //
307  return p ;
308 }
Properties m_properties
Collection of all declared properties.
Definition: PropertyMgr.h:174
std::vector< std::unique_ptr< Property > > m_todelete
Properties to be deleted.
Definition: PropertyMgr.h:178
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
void assertUniqueName(const std::string &name) const
Throw an exception if the name is already present in the list of properties (see GAUDI-1023).
template<class TYPE >
Property* PropertyMgr::declareProperty ( const std::string &  name,
ServiceHandleArray< TYPE > &  ref,
const std::string &  doc = "none" 
)

Declare a property (specialization)

Property* PropertyMgr::declareProperty ( const std::string &  name,
DataObjectDescriptor ref,
const std::string &  doc = "none" 
)

Declare a property (specialization)

Property * PropertyMgr::declareProperty ( const std::string &  name,
DataObjectDescriptor ref,
const std::string &  doc = "none" 
)
inline

Declare a property (specialization)

Definition at line 313 of file PropertyMgr.h.

316 {
318  m_todelete.emplace_back( new DataObjectDescriptorProperty( name, ref ) );
319  Property* p = m_todelete.back().get();
320  //
321  p -> setDocumentation ( doc ) ;
322  m_properties . push_back ( p ) ;
323  //
324  return p ;
325 }
Properties m_properties
Collection of all declared properties.
Definition: PropertyMgr.h:174
std::vector< std::unique_ptr< Property > > m_todelete
Properties to be deleted.
Definition: PropertyMgr.h:178
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
void assertUniqueName(const std::string &name) const
Throw an exception if the name is already present in the list of properties (see GAUDI-1023).
Property* PropertyMgr::declareProperty ( const std::string &  name,
DataObjectDescriptorCollection ref,
const std::string &  doc = "none" 
)

Declare a property (specialization)

Property * PropertyMgr::declareProperty ( const std::string &  name,
DataObjectDescriptorCollection ref,
const std::string &  doc = "none" 
)
inline

Declare a property (specialization)

Definition at line 329 of file PropertyMgr.h.

332 {
334  m_todelete.emplace_back( new DataObjectDescriptorCollectionProperty( name, ref ) );
335  Property* p = m_todelete.back().get();
336  //
337  p -> setDocumentation ( doc ) ;
338  m_properties . push_back ( p ) ;
339  //
340  return p ;
341 }
Properties m_properties
Collection of all declared properties.
Definition: PropertyMgr.h:174
std::vector< std::unique_ptr< Property > > m_todelete
Properties to be deleted.
Definition: PropertyMgr.h:178
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
void assertUniqueName(const std::string &name) const
Throw an exception if the name is already present in the list of properties (see GAUDI-1023).
Property* PropertyMgr::declareRemoteProperty ( const std::string &  name,
IProperty rsvc,
const std::string &  rname = "" 
)

Declare a remote property.

Property * PropertyMgr::declareRemoteProperty ( const std::string &  name,
IProperty rsvc,
const std::string &  rname = "" 
)

Declare a remote property.

Definition at line 61 of file PropertyMgr.cpp.

64 {
65  if ( !rsvc ) { return nullptr ; }
66  const std::string& nam = rname.empty() ? name : rname ;
67  Property* p = property ( nam , rsvc->getProperties() ) ;
68  m_remoteProperties.emplace_back ( name , std::make_pair( rsvc , nam ) ) ;
69  return p ;
70 }
virtual const std::vector< Property * > & getProperties() const =0
Get list of properties.
RemoteProperties m_remoteProperties
Collection of all declared remote properties.
Definition: PropertyMgr.h:176
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
Property * property(const std::string &name) const
Definition: PropertyMgr.cpp:85
const std::vector< Property * > & PropertyMgr::getProperties ( ) const
override

get all properties

See also
IProperty

Definition at line 186 of file PropertyMgr.cpp.

186 { return m_properties; }
Properties m_properties
Collection of all declared properties.
Definition: PropertyMgr.h:174
const std::vector<Property*>& PropertyMgr::getProperties ( ) const
override

get all properties

See also
IProperty
StatusCode PropertyMgr::getProperty ( Property p) const
override

get the property

See also
IProperty
StatusCode PropertyMgr::getProperty ( Property p) const
override

get the property

See also
IProperty

Definition at line 144 of file PropertyMgr.cpp.

145 {
146  try
147  {
148  const Property* pp = property( p->name() ) ;
149  if ( pp && pp->load(*p) ) return StatusCode::SUCCESS; // RETURN
150  }
151  catch ( ... ) { }
152  return StatusCode::FAILURE ; // RETURN
153 }
const std::string & name() const
property name
Definition: Property.h:45
virtual bool load(Property &dest) const =0
export the property value to the destination
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
Property * property(const std::string &name) const
Definition: PropertyMgr.cpp:85
const Property& PropertyMgr::getProperty ( const std::string &  name) const
override

get the property by name

See also
IProperty
const Property & PropertyMgr::getProperty ( const std::string &  name) const
override

get the property by name

See also
IProperty

Definition at line 159 of file PropertyMgr.cpp.

160 {
161  const Property* p = property( name ) ;
162  if ( !p ) throw std::out_of_range( "Property "+name+" not found." ); // Not found
163  return *p ; // RETURN
164 }
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
Property * property(const std::string &name) const
Definition: PropertyMgr.cpp:85
StatusCode PropertyMgr::getProperty ( const std::string &  n,
std::string &  v 
) const
override

convert the property to the string

See also
IProperty
StatusCode PropertyMgr::getProperty ( const std::string &  n,
std::string &  v 
) const
override

convert the property to the string

See also
IProperty

Definition at line 171 of file PropertyMgr.cpp.

173 {
174  // get the property
175  const Property* p = property( n ) ;
176  if ( !p ) { return StatusCode::FAILURE ; }
177  // convert the value into the string
178  v = p->toString() ;
179  //
180  return StatusCode::SUCCESS ;
181 }
virtual std::string toString() const =0
value -> string
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
Property * property(const std::string &name) const
Definition: PropertyMgr.cpp:85
bool PropertyMgr::hasProperty ( const std::string &  name) const
override

Return true if we have a property with the given name.

See also
IProperty
bool PropertyMgr::hasProperty ( const std::string &  name) const
override

Return true if we have a property with the given name.

See also
IProperty

Definition at line 201 of file PropertyMgr.cpp.

201  {
202  return any_of(begin(m_properties), end(m_properties),
203  [&name](const Property* prop) {
204  return noCaseCmp(prop->name(), name);
205  });
206 }
const std::string & name() const
property name
Definition: Property.h:45
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:45
Properties m_properties
Collection of all declared properties.
Definition: PropertyMgr.h:174
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:47
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
PropertyMgr& PropertyMgr::operator= ( const PropertyMgr )
delete
PropertyMgr& PropertyMgr::operator= ( const PropertyMgr )
delete
Property * PropertyMgr::property ( const std::string &  name) const
protected

Definition at line 85 of file PropertyMgr.cpp.

86 {
87  // local property ?
88  Property* lp = property ( name , m_properties ) ;
89  if ( lp ) { return lp ; } // RETURN
90  // look for remote property
91  for ( const auto& it : m_remoteProperties )
92  {
93  if ( !noCaseCmp(it.first,name) ) { continue ; } // CONTINUE
94  const IProperty* p = it.second.first ;
95  if ( !p ) { continue ; } // CONTINUE
96  return property ( it.second.second , p->getProperties() ) ; // RETURN
97  }
98  return nullptr ; // RETURN
99 }
virtual const std::vector< Property * > & getProperties() const =0
Get list of properties.
Properties m_properties
Collection of all declared properties.
Definition: PropertyMgr.h:174
RemoteProperties m_remoteProperties
Collection of all declared remote properties.
Definition: PropertyMgr.h:176
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:21
Property * property(const std::string &name) const
Definition: PropertyMgr.cpp:85
Property* PropertyMgr::property ( const std::string &  name) const
protected
Property* PropertyMgr::property ( const std::string &  name,
const std::vector< Property * > &  props 
) const
private

get the property by name form the proposed list

Property * PropertyMgr::property ( const std::string &  name,
const std::vector< Property * > &  props 
) const
private

get the property by name form the proposed list

Definition at line 75 of file PropertyMgr.cpp.

77 {
78  auto it = std::find_if( props.begin(), props.end(), PropByName{ name } ) ;
79  return ( it != props.end() ) ? *it : nullptr; // RETURN
80 }
StatusCode PropertyMgr::queryInterface ( const InterfaceID iid,
void **  pinterface 
)
override
StatusCode PropertyMgr::queryInterface ( const InterfaceID iid,
void **  pinterface 
)
override

Definition at line 190 of file PropertyMgr.cpp.

190  {
191  // try local interfaces
192  StatusCode sc= base_class::queryInterface(iid, pinterface);
193  if (sc.isSuccess()) return sc;
194  // fall back on the owner
195  return m_pOuter ? m_pOuter->queryInterface(iid, pinterface)
196  : sc; // FAILURE
197 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
IInterface * m_pOuter
Interface hub reference (ApplicationMgr)
Definition: PropertyMgr.h:180
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode queryInterface(const InterfaceID &ti, void **pp) override
Implementation of IInterface::queryInterface.
Definition: implements.h:22
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)=0
Set the void** to the pointer to the requested interface of the instance.
StatusCode PropertyMgr::setProperty ( const Property p)
override

set the property form another property

See also
IProperty

Definition at line 105 of file PropertyMgr.cpp.

106 {
107  Property* pp = property( p.name() ) ;
108  try
109  { if ( pp && pp->assign(p) ) { return StatusCode::SUCCESS ; } } // RETURN
110  catch(...) { }
111  //
112  return StatusCode::FAILURE;
113 }
virtual bool assign(const Property &source)=0
import the property value form the source
const std::string & name() const
property name
Definition: Property.h:45
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
Property * property(const std::string &name) const
Definition: PropertyMgr.cpp:85
StatusCode PropertyMgr::setProperty ( const Property p)
override

set the property form another property

See also
IProperty
StatusCode PropertyMgr::setProperty ( const std::string &  s)
override

set the property from the property formatted string

See also
IProperty
StatusCode PropertyMgr::setProperty ( const std::string &  s)
override

set the property from the property formatted string

See also
IProperty

Definition at line 120 of file PropertyMgr.cpp.

121 {
122  std::string name ;
123  std::string value ;
124  StatusCode sc = Gaudi::Parsers::parse( name , value , i ) ;
125  if ( sc.isFailure() ) { return sc ; }
126  return setProperty ( name , value ) ;
127 }
StatusCode setProperty(const Property &p) override
set the property form another property
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
list i
Definition: ana.py:128
StatusCode PropertyMgr::setProperty ( const std::string &  n,
const std::string &  v 
)
override

set the property from name and the value

See also
IProperty
StatusCode PropertyMgr::setProperty ( const std::string &  n,
const std::string &  v 
)
override

set the property from name and the value

See also
IProperty

Definition at line 134 of file PropertyMgr.cpp.

135 {
136  Property* p = property( n ) ;
137  return ( p && p->fromString(v) ) ? StatusCode::SUCCESS : StatusCode::FAILURE ;
138 }
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
Property * property(const std::string &name) const
Definition: PropertyMgr.cpp:85
virtual StatusCode fromString(const std::string &value)=0
string -> value

Member Data Documentation

IInterface * PropertyMgr::m_pOuter
private

Interface hub reference (ApplicationMgr)

Definition at line 180 of file PropertyMgr.h.

Properties PropertyMgr::m_properties
private

Collection of all declared properties.

Definition at line 174 of file PropertyMgr.h.

RemoteProperties PropertyMgr::m_remoteProperties
private

Collection of all declared remote properties.

Definition at line 176 of file PropertyMgr.h.

std::vector< std::unique_ptr< Property > > PropertyMgr::m_todelete
private

Properties to be deleted.

Definition at line 178 of file PropertyMgr.h.


The documentation for this class was generated from the following files: