| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
PropertyHolder< BASE > Class Template Reference

Helper class to implement the IProperty interface. More...

`#include <GaudiKernel/PropertyHolder.h>`

Inheritance diagram for PropertyHolder< BASE >:
[legend]
Collaboration diagram for PropertyHolder< BASE >:
[legend]

## Public Types
using | PropertyHolderImpl = PropertyHolder< BASE >
| Typedef used to refer to this class from derived classes, as in. More...

## Public Member Functions
| PropertyHolder ()=default
| ~PropertyHolder () override=default
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Details::PropertyBase &prop)
| Declare a property. More...
template<class TYPE , typename = typename std::enable_if< !std::is_base_of<GaudiHandleBase,TYPE>::value && !std::is_base_of<GaudiHandleArrayBase,TYPE>::value && !std::is_base_of<DataObjectHandleBase,TYPE>::value >::type>
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
| Helper to wrap a regular data member and use it as a regular property. More...
template<class TYPE , typename = typename std::enable_if< !std::is_base_of<GaudiHandleBase,TYPE>::value && !std::is_base_of<GaudiHandleArrayBase,TYPE>::value && !std::is_base_of<DataObjectHandleBase,TYPE>::value >::type>
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none") const
template<class TYPE , class VERIFIER , class HANDLERS >
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
| Declare a PropertyBase instance setting name and documentation. More...
Gaudi::Details::PropertyBase * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
| Declare a remote property. More...
StatusCode | setProperty (const Gaudi::Details::PropertyBase &p) override
| set the property form another property More...
StatusCode | setProperty (const std::string &s) override
| set the property from the formatted string More...
StatusCode | setProperty (const std::string &n, const std::string &v) override
| set the property from name and the value More...
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
StatusCode | getProperty (Gaudi::Details::PropertyBase *p) const override
| get the property More...
const Gaudi::Details::PropertyBase & | getProperty (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< Gaudi::Details::PropertyBase * > & | 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...
| PropertyHolder (const PropertyHolder &)=delete
PropertyHolder & | operator= (const PropertyHolder &)=delete
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
| Specializations for various GaudiHandles. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, DataObjectHandleBase &ref, const std::string &doc="none")

## Protected Member Functions
Gaudi::Details::PropertyBase * | property (const std::string &name) const

## Private Types
typedef std::vector< Gaudi::Details::PropertyBase * > | Properties
typedef std::pair< std::string, std::pair< IProperty *, std::string > > | RemProperty
typedef std::vector< RemProperty > | RemoteProperties

## Private Member Functions
Gaudi::Details::PropertyBase * | property (const std::string &name, const std::vector< Gaudi::Details::PropertyBase * > &props) const
| get the property by name form the proposed list More...
void | assertUniqueName (const std::string &name) const
| Issue a runtime warning 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< Gaudi::Details::PropertyBase > > | m_todelete
| Properties owned by PropertyHolder, to be deleted. More...

## Detailed Description

### template<class BASE>
class PropertyHolder< BASE >

Helper class to implement the IProperty interface.

PropertyHolder is used by components base classes (Algorithm, Service, etc.) to provide a default implementation the IProperty interface.

When needing to implement the IProperty interface in a class, it is enough to wrap the base of the class with PropertyHolder, as in

class MyClass : public PropertyHolder<BaseClass> {
// ...
};

where `BaseClass` should inherit from IProperty and INamedInterface.

Author
  Paul Maley
  David Quarrie
  Marco Clemencic

Definition at line 73 of file PropertyHolder.h.

## Member Typedef Documentation

template<class BASE>

typedef std::vector<Gaudi::Details::PropertyBase*> PropertyHolder< BASE >::Properties
| private

Definition at line 392 of file PropertyHolder.h.

template<class BASE>

using PropertyHolder< BASE >::PropertyHolderImpl = PropertyHolder<BASE>

Typedef used to refer to this class from derived classes, as in.

class MyClass : public PropertyHolder<BaseClass> {
using PropertyHolderImpl::declareProperty;
};

Definition at line 85 of file PropertyHolder.h.

template<class BASE>

typedef std::vector<RemProperty> PropertyHolder< BASE >::RemoteProperties
| private

Definition at line 394 of file PropertyHolder.h.

template<class BASE>

typedef std::pair<std::string, std::pair<IProperty*, std::string> > PropertyHolder< BASE >::RemProperty
| private

Definition at line 393 of file PropertyHolder.h.

## Constructor & Destructor Documentation

template<class BASE>

PropertyHolder< BASE >::PropertyHolder | ( |  | ) |
| default

template<class BASE>

PropertyHolder< BASE >::~PropertyHolder | ( |  | ) |
| override default

template<class BASE>

PropertyHolder< BASE >::PropertyHolder | ( | const PropertyHolder< BASE > & |  | ) |
| delete

prevent copies

## Member Function Documentation

template<class BASE>

void PropertyHolder< BASE >::assertUniqueName | ( | const std::string & | name | ) | const
| inline private

Issue a runtime warning if the name is already present in the list of properties (see GAUDI-1023).

Definition at line 379 of file PropertyHolder.h.

380 {
381 if ( UNLIKELY( hasProperty( name ) ) ) {
382 auto msgSvc = Gaudi::svcLocator()->service<IMessageSvc>( "MessageSvc" );
383 if ( !msgSvc ) {
384 std::cerr << "error: cannot get MessageSvc!" << std::endl;
385 }
386 MsgStream log( msgSvc, this->name() );
387 log << MSG::WARNING << "duplicated property name '" << name << "', see https://its.cern.ch/jira/browse/GAUDI-1023"
388 << endmsg;
389 }
390 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
PropertyHolder::hasProperty
bool hasProperty(const std::string &name) const override
Return true if we have a property with the given name.
Definition: PropertyHolder.h:336
std::endl
T endl(T...args)
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:126
ISvcLocator::service
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::svcLocator
GAUDI_API ISvcLocator * svcLocator()
ForwardSchedulerSimpleTest.msgSvc
msgSvc
Definition: ForwardSchedulerSimpleTest.py:112
IMessageSvc
The IMessage is the interface implemented by the message service.
Definition: IMessageSvc.h:57
MSG::WARNING
Definition: IMessageSvc.h:20
std::cerr
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Gaudi.Configuration.log
log
Definition: Configuration.py:13
template<class BASE>

Gaudi::Details::PropertyBase& PropertyHolder< BASE >::declareProperty | ( | Gaudi::Details::PropertyBase & | prop | ) |
| inline

Declare a property.

Record a PropertyBase instance to be managed by PropertyHolder.

Definition at line 99 of file PropertyHolder.h.

100 {
101 assertUniqueName( prop.name() );
102 m_properties.push_back( &prop );
103 return prop;
104 }
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition: Property.h:40
PropertyHolder::m_properties
Properties m_properties
Collection of all declared properties.
Definition: PropertyHolder.h:397
PropertyHolder::assertUniqueName
void assertUniqueName(const std::string &name) const
Issue a runtime warning if the name is already present in the list of properties (see GAUDI-1023)...
Definition: PropertyHolder.h:379
std::vector::push_back
T push_back(T...args)
template<class BASE>
template<class TYPE , typename = typename std::enable_if< !std::is_base_of<GaudiHandleBase,TYPE>::value && !std::is_base_of<GaudiHandleArrayBase,TYPE>::value && !std::is_base_of<DataObjectHandleBase,TYPE>::value >::type>

Gaudi::Details::PropertyBase* PropertyHolder< BASE >::declareProperty | ( | const std::string & | name,
|  | TYPE & | value,
|  | const std::string & | doc = `"none"`
| ) |  |
| inline

Helper to wrap a regular data member and use it as a regular property.

Deprecated:
  Prefer the signatures using a a fully initialized PropertyBase instance.

Definition at line 113 of file PropertyHolder.h.

114 {
115 assertUniqueName( name );
116 m_todelete.emplace_back( new Gaudi::Property<TYPE&>( name, value ) );
117 Gaudi::Details::PropertyBase* p = m_todelete.back().get();
118 p->setDocumentation( doc );
119 m_properties.push_back( p );
120 return p;
121 }
Gaudi::Details::PropertyBase::setDocumentation
void setDocumentation(std::string value)
set the documentation string
Definition: Property.h:92
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:314
PropertyHolder::m_properties
Properties m_properties
Collection of all declared properties.
Definition: PropertyHolder.h:397
PropertyHolder::assertUniqueName
void assertUniqueName(const std::string &name) const
Issue a runtime warning if the name is already present in the list of properties (see GAUDI-1023)...
Definition: PropertyHolder.h:379
std::vector::push_back
T push_back(T...args)
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
std::unique_ptr::get
T get(T...args)
std::vector::back
T back(T...args)
PropertyHolder::m_todelete
std::vector< std::unique_ptr< Gaudi::Details::PropertyBase > > m_todelete
Properties owned by PropertyHolder, to be deleted.
Definition: PropertyHolder.h:401
std::vector::emplace_back
T emplace_back(T...args)
template<class BASE>
template<class TYPE , typename = typename std::enable_if< !std::is_base_of<GaudiHandleBase,TYPE>::value && !std::is_base_of<GaudiHandleArrayBase,TYPE>::value && !std::is_base_of<DataObjectHandleBase,TYPE>::value >::type>

Gaudi::Details::PropertyBase* PropertyHolder< BASE >::declareProperty | ( | const std::string & | name,
|  | TYPE & | value,
|  | const std::string & | doc = `"none"`
| ) |  | const
| inline

Deprecated:
  Kept for backward compatibility, use the non-const version instead, will be removed in v29r0.

Definition at line 130 of file PropertyHolder.h.

131 {
132 return const_cast<PropertyHolder*>( this )->declareProperty<TYPE>( name, value, doc );
133 }
PropertyHolder
Helper class to implement the IProperty interface.
Definition: PropertyHolder.h:73
template<class BASE>
template<class TYPE , class VERIFIER , class HANDLERS >

Gaudi::Details::PropertyBase* PropertyHolder< BASE >::declareProperty | ( | const std::string & | name,
|  | Gaudi::Property< TYPE, VERIFIER, HANDLERS > & | prop,
|  | const std::string & | doc = `"none"`
| ) |  |
| inline

Declare a PropertyBase instance setting name and documentation.

Deprecated:
  Prefer the signatures using a fully initialized PropertyBase instance.

Definition at line 138 of file PropertyHolder.h.

141 {
142 assertUniqueName( name );
143 Gaudi::Details::PropertyBase* p = &prop;
144 p->setName( name );
145 p->setDocumentation( doc );
146 m_properties.push_back( p );
147 return p;
148 }
Gaudi::Details::PropertyBase::setDocumentation
void setDocumentation(std::string value)
set the documentation string
Definition: Property.h:92
PropertyHolder::m_properties
Properties m_properties
Collection of all declared properties.
Definition: PropertyHolder.h:397
PropertyHolder::assertUniqueName
void assertUniqueName(const std::string &name) const
Issue a runtime warning if the name is already present in the list of properties (see GAUDI-1023)...
Definition: PropertyHolder.h:379
std::vector::push_back
T push_back(T...args)
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
Gaudi::Details::PropertyBase::setName
void setName(std::string value)
set the new value for the property name
Definition: Property.h:90
template<class BASE>

Gaudi::Details::PropertyBase* PropertyHolder< BASE >::declareProperty | ( | const std::string & | name,
|  | GaudiHandleBase & | ref,
|  | const std::string & | doc = `"none"`
| ) |  |
| inline

Specializations for various GaudiHandles.

Definition at line 166 of file PropertyHolder.h.

168 {
169 assertUniqueName( name );
170 m_todelete.emplace_back( new GaudiHandleProperty( name, ref ) );
171 Gaudi::Details::PropertyBase* p = m_todelete.back().get();
172
173 p->setDocumentation( doc );
174 m_properties.push_back( p );
175
176 return p;
177 }
Gaudi::Details::PropertyBase::setDocumentation
void setDocumentation(std::string value)
set the documentation string
Definition: Property.h:92
PropertyHolder::m_properties
Properties m_properties
Collection of all declared properties.
Definition: PropertyHolder.h:397
PropertyHolder::assertUniqueName
void assertUniqueName(const std::string &name) const
Issue a runtime warning if the name is already present in the list of properties (see GAUDI-1023)...
Definition: PropertyHolder.h:379
std::vector::push_back
T push_back(T...args)
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
std::unique_ptr::get
T get(T...args)
std::vector::back
T back(T...args)
GaudiPython.Bindings.GaudiHandleProperty
GaudiHandleProperty
Definition: Bindings.py:49
PropertyHolder::m_todelete
std::vector< std::unique_ptr< Gaudi::Details::PropertyBase > > m_todelete
Properties owned by PropertyHolder, to be deleted.
Definition: PropertyHolder.h:401
std::vector::emplace_back
T emplace_back(T...args)
template<class BASE>

Gaudi::Details::PropertyBase* PropertyHolder< BASE >::declareProperty | ( | const std::string & | name,
|  | GaudiHandleArrayBase & | ref,
|  | const std::string & | doc = `"none"`
| ) |  |
| inline

Definition at line 178 of file PropertyHolder.h.

180 {
181 assertUniqueName( name );
182 m_todelete.emplace_back( new GaudiHandleArrayProperty( name, ref ) );
183 Gaudi::Details::PropertyBase* p = m_todelete.back().get();
184
185 p->setDocumentation( doc );
186 m_properties.push_back( p );
187
188 return p;
189 }
Gaudi::Details::PropertyBase::setDocumentation
void setDocumentation(std::string value)
set the documentation string
Definition: Property.h:92
PropertyHolder::m_properties
Properties m_properties
Collection of all declared properties.
Definition: PropertyHolder.h:397
PropertyHolder::assertUniqueName
void assertUniqueName(const std::string &name) const
Issue a runtime warning if the name is already present in the list of properties (see GAUDI-1023)...
Definition: PropertyHolder.h:379
std::vector::push_back
T push_back(T...args)
GaudiPython.Bindings.GaudiHandleArrayProperty
GaudiHandleArrayProperty
Definition: Bindings.py:50
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
std::unique_ptr::get
T get(T...args)
std::vector::back
T back(T...args)
PropertyHolder::m_todelete
std::vector< std::unique_ptr< Gaudi::Details::PropertyBase > > m_todelete
Properties owned by PropertyHolder, to be deleted.
Definition: PropertyHolder.h:401
std::vector::emplace_back
T emplace_back(T...args)
template<class BASE>

Gaudi::Details::PropertyBase* PropertyHolder< BASE >::declareProperty | ( | const std::string & | name,
|  | DataObjectHandleBase & | ref,
|  | const std::string & | doc = `"none"`
| ) |  |
| inline

Definition at line 190 of file PropertyHolder.h.

192 {
193 assertUniqueName( name );
194 m_todelete.emplace_back( new DataObjectHandleProperty( name, ref ) );
195 Gaudi::Details::PropertyBase* p = m_todelete.back().get();
196
197 p->setDocumentation( doc );
198 m_properties.push_back( p );
199
200 return p;
201 }
Gaudi::Details::PropertyBase::setDocumentation
void setDocumentation(std::string value)
set the documentation string
Definition: Property.h:92
PropertyHolder::m_properties
Properties m_properties
Collection of all declared properties.
Definition: PropertyHolder.h:397
PropertyHolder::assertUniqueName
void assertUniqueName(const std::string &name) const
Issue a runtime warning if the name is already present in the list of properties (see GAUDI-1023)...
Definition: PropertyHolder.h:379
DataObjectHandleProperty
DataObjectHandleProperty.h GaudiKernel/DataObjectHandleProperty.h.
Definition: DataObjectHandleProperty.h:23
std::vector::push_back
T push_back(T...args)
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
std::unique_ptr::get
T get(T...args)
std::vector::back
T back(T...args)
PropertyHolder::m_todelete
std::vector< std::unique_ptr< Gaudi::Details::PropertyBase > > m_todelete
Properties owned by PropertyHolder, to be deleted.
Definition: PropertyHolder.h:401
std::vector::emplace_back
T emplace_back(T...args)
template<class BASE>

Gaudi::Details::PropertyBase* PropertyHolder< BASE >::declareRemoteProperty | ( | const std::string & | name,
|  | IProperty * | rsvc,
|  | const std::string & | rname = `""`
| ) |  |
| inline

Declare a remote property.

Bind `name` to the property `rname` of `rsvc`.

Definition at line 152 of file PropertyHolder.h.

154 {
155 if ( !rsvc ) {
156 return nullptr;
157 }
158 const std::string& nam = rname.empty() ? name : rname;
159 Gaudi::Details::PropertyBase* p = property( nam, rsvc->getProperties() );
160 m_remoteProperties.emplace_back( name, std::make_pair( rsvc, nam ) );
161 return p;
162 }
std::string::empty
T empty(T...args)
PropertyHolder::property
Gaudi::Details::PropertyBase * property(const std::string &name) const
Definition: PropertyHolder.h:345
std::string
STL class.
PropertyHolder::m_remoteProperties
RemoteProperties m_remoteProperties
Collection of all declared remote properties.
Definition: PropertyHolder.h:399
std::make_pair
T make_pair(T...args)
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
IProperty::getProperties
virtual const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const =0
Get list of properties.
std::vector::emplace_back
T emplace_back(T...args)
template<class BASE>

const std::vector<Gaudi::Details::PropertyBase*>& PropertyHolder< BASE >::getProperties | ( |  | ) | const
| inline override

get all properties

See also
  IProperty

Definition at line 331 of file PropertyHolder.h.

331 { return m_properties; }
PropertyHolder::m_properties
Properties m_properties
Collection of all declared properties.
Definition: PropertyHolder.h:397
template<class BASE>

StatusCode PropertyHolder< BASE >::getProperty | ( | Gaudi::Details::PropertyBase * | p | ) | const
| inline override

get the property

See also
  IProperty

Definition at line 293 of file PropertyHolder.h.

294 {
295 try {
296 const Gaudi::Details::PropertyBase* pp = property( p->name() );
297 if ( pp && pp->load( *p ) ) return StatusCode::SUCCESS;
298 } catch ( ... ) {
299 }
300 return StatusCode::FAILURE;
301 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
PropertyHolder::property
Gaudi::Details::PropertyBase * property(const std::string &name) const
Definition: PropertyHolder.h:345
Gaudi::Details::PropertyBase::load
virtual bool load(PropertyBase &dest) const =0
export the property value to the destination
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition: Property.h:40
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
compareOutputFiles.pp
pp
Definition: compareOutputFiles.py:417
template<class BASE>

const Gaudi::Details::PropertyBase& PropertyHolder< BASE >::getProperty | ( | const std::string & | name | ) | const
| inline override

get the property by name

See also
  IProperty

Definition at line 306 of file PropertyHolder.h.

307 {
308 const Gaudi::Details::PropertyBase* p = property( name );
309 if ( !p ) throw std::out_of_range( "Property " + name + " not found." );
310 return *p;
311 }
std::out_of_range
STL class.
PropertyHolder::property
Gaudi::Details::PropertyBase * property(const std::string &name) const
Definition: PropertyHolder.h:345
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
template<class BASE>

StatusCode PropertyHolder< BASE >::getProperty | ( | const std::string & | n,
|  | std::string & | v
| ) |  | const
| inline override

convert the property to the string

See also
  IProperty

Definition at line 316 of file PropertyHolder.h.

317 {
318 // get the property
319 const Gaudi::Details::PropertyBase* p = property( n );
320 if ( !p ) {
321 return StatusCode::FAILURE;
322 }
323 // convert the value into the string
324 v = p->toString();
325 return StatusCode::SUCCESS;
326 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
PropertyHolder::property
Gaudi::Details::PropertyBase * property(const std::string &name) const
Definition: PropertyHolder.h:345
Gaudi::Details::PropertyBase::toString
virtual std::string toString() const =0
value -> string
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
template<class BASE>

bool PropertyHolder< BASE >::hasProperty | ( | const std::string & | name | ) | const
| inline override

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

See also
  IProperty

Definition at line 336 of file PropertyHolder.h.

337 {
338 return any_of( begin( m_properties ), end( m_properties ), [&name]( const Gaudi::Details::PropertyBase* prop ) {
339 return Gaudi::Utils::iequal( prop->name(), name );
340 } );
341 }
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition: Property.h:40
PropertyHolder::m_properties
Properties m_properties
Collection of all declared properties.
Definition: PropertyHolder.h:397
begin
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:48
Gaudi::Utils::iequal
bool iequal(const std::string &v1, const std::string &v2)
Helper for case insensitive string comparison.
Definition: PropertyHolder.h:45
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:50
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
std::any_of
T any_of(T...args)
template<class BASE>

PropertyHolder& PropertyHolder< BASE >::operator= | ( | const PropertyHolder< BASE > & |  | ) |
| delete

template<class BASE>

Gaudi::Details::PropertyBase* PropertyHolder< BASE >::property | ( | const std::string & | name | ) | const
| inline protected

Definition at line 345 of file PropertyHolder.h.

346 {
347 // local property ?
348 Gaudi::Details::PropertyBase* lp = property( name, m_properties );
349 if ( lp ) {
350 return lp;
351 }
352 // look for remote property
353 for ( const auto& it : m_remoteProperties ) {
354 if ( !Gaudi::Utils::iequal( it.first, name ) ) {
355 continue;
356 }
357 const IProperty* p = it.second.first;
358 if ( !p ) {
359 continue;
360 }
361 return property( it.second.second, p->getProperties() );
362 }
363 return nullptr; // RETURN
364 }
PropertyHolder::property
Gaudi::Details::PropertyBase * property(const std::string &name) const
Definition: PropertyHolder.h:345
PropertyHolder::m_properties
Properties m_properties
Collection of all declared properties.
Definition: PropertyHolder.h:397
PropertyHolder::m_remoteProperties
RemoteProperties m_remoteProperties
Collection of all declared remote properties.
Definition: PropertyHolder.h:399
Gaudi::Utils::iequal
bool iequal(const std::string &v1, const std::string &v2)
Helper for case insensitive string comparison.
Definition: PropertyHolder.h:45
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
IProperty::getProperties
virtual const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const =0
Get list of properties.
IProperty
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:20
template<class BASE>

Gaudi::Details::PropertyBase* PropertyHolder< BASE >::property | ( | const std::string & | name,
|  | const std::vector< Gaudi::Details::PropertyBase * > & | props
| ) |  | const
| inline private

get the property by name form the proposed list

Definition at line 368 of file PropertyHolder.h.

370 {
371 auto it = std::find_if( props.begin(), props.end(), [&name]( Gaudi::Details::PropertyBase* p ) {
372 return p && Gaudi::Utils::iequal( p->name(), name );
373 } );
374 return ( it != props.end() ) ? *it : nullptr; // RETURN
375 }
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
std::vector::end
T end(T...args)
Gaudi::Utils::iequal
bool iequal(const std::string &v1, const std::string &v2)
Helper for case insensitive string comparison.
Definition: PropertyHolder.h:45
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
std::find_if
T find_if(T...args)
std::vector::begin
T begin(T...args)
template<class BASE>

StatusCode PropertyHolder< BASE >::setProperty | ( | const Gaudi::Details::PropertyBase & | p | ) |
| inline override

set the property form another property

See also
  IProperty

Definition at line 210 of file PropertyHolder.h.

211 {
212 Gaudi::Details::PropertyBase* pp = property( p.name() );
213 try {
214 if ( pp && pp->assign( p ) ) {
215 return StatusCode::SUCCESS;
216 }
217 } catch ( ... ) {
218 }
219 return StatusCode::FAILURE;
220 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
PropertyHolder::property
Gaudi::Details::PropertyBase * property(const std::string &name) const
Definition: PropertyHolder.h:345
Gaudi::Details::PropertyBase::assign
virtual bool assign(const PropertyBase &source)=0
import the property value form the source
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition: Property.h:40
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
compareOutputFiles.pp
pp
Definition: compareOutputFiles.py:417
template<class BASE>

StatusCode PropertyHolder< BASE >::setProperty | ( | const std::string & | s | ) |
| inline override

set the property from the formatted string

See also
  IProperty

Definition at line 225 of file PropertyHolder.h.

226 {
227 std::string name;
228 std::string value;
229 StatusCode sc = Gaudi::Parsers::parse( name, value, s );
230 if ( sc.isFailure() ) {
231 return sc;
232 }
233 return setProperty( name, value );
234 }
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
PropertyHolder::setProperty
StatusCode setProperty(const Gaudi::Details::PropertyBase &p) override
set the property form another property
Definition: PropertyHolder.h:210
Gaudi::Parsers::parse
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
Definition: DODBasicMapper.cpp:11
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
std::string
STL class.
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
template<class BASE>

StatusCode PropertyHolder< BASE >::setProperty | ( | const std::string & | n,
|  | const std::string & | v
| ) |  |
| inline override

set the property from name and the value

See also
  IProperty

Definition at line 239 of file PropertyHolder.h.

240 {
241 Gaudi::Details::PropertyBase* p = property( n );
242 return ( p && p->fromString( v ) ) ? StatusCode::SUCCESS : StatusCode::FAILURE;
243 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
PropertyHolder::property
Gaudi::Details::PropertyBase * property(const std::string &name) const
Definition: PropertyHolder.h:345
Gaudi::Details::PropertyBase::fromString
virtual StatusCode fromString(const std::string &value)=0
string -> value
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
template<class BASE>
template<class TYPE >

StatusCode PropertyHolder< BASE >::setProperty | ( | const std::string & | name,
|  | const TYPE & | value
| ) |  |
| inline

set the property form the value

std::vector<double> data = ... ;
setProperty( "Data" , data ) ;
std::map<std::string,double> cuts = ... ;
setProperty( "Cuts" , cuts ) ;
std::map<std::string,std::string> dict = ... ;
setProperty( "Dictionary" , dict ) ;

Note: the interface IProperty allows setting of the properties either directly from other properties or from strings only

This is very convenient in resetting of the default properties in the derived classes. E.g. without this method one needs to convert everything into strings to use IProperty::setProperty

setProperty ( "OutputLevel" , "1" ) ;
setProperty ( "Enable" , "True" ) ;
setProperty ( "ErrorMax" , "10" ) ;

For simple cases it is more or less ok, but for complicated properties it is just ugly..

Parameters

  name | name of the property
  value | value of the property

See also
  Gaudi::Utils::setProperty

Author
  Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Date
  2007-05-13

Definition at line 285 of file PropertyHolder.h.

286 {
287 return Gaudi::Utils::setProperty( this, name, value );
288 }
Gaudi::Utils::setProperty
StatusCode setProperty(IProperty *component, const std::string &name, const TYPE &value, const std::string &doc)
simple function to set the property of the given object from the value
Definition: Property.h:1138

## Member Data Documentation

template<class BASE>

Properties PropertyHolder< BASE >::m_properties
| private

Collection of all declared properties.

Definition at line 397 of file PropertyHolder.h.

template<class BASE>

RemoteProperties PropertyHolder< BASE >::m_remoteProperties
| private

Collection of all declared remote properties.

Definition at line 399 of file PropertyHolder.h.

template<class BASE>

std::vector<std::unique_ptr<Gaudi::Details::PropertyBase> > PropertyHolder< BASE >::m_todelete
| private

Properties owned by PropertyHolder, to be deleted.

Definition at line 401 of file PropertyHolder.h.

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

- GaudiKernel/GaudiKernel/PropertyHolder.h