ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
AthProperties< PARENT > Class Template Reference

pimpl-style holder for component properties. More...

#include <AthProperties.h>

Collaboration diagram for AthProperties< PARENT >:

Public Types

typedef AthProperties base_class
 

Public Member Functions

 AthProperties (PARENT *parent)
 
PARENT * parent ()
 

Private Attributes

PARENT * m_parent
 

Detailed Description

template<class PARENT>
class AthProperties< PARENT >

pimpl-style holder for component properties.

A wart on Gaudi properties has been that that you needed to declare the property member in a different place than the declareProperty. This has been addressed by the new-style Property constructors that can implicitly declare the properties. The good news is that all the declarations are now in one place. The bad news is that it often seems to be the wrong place: when one is reading the implementation for a class, it is frequently jarring to have to go back to the header file in order to see if some member is a property or not.

However, using a variant of the pimpl idiom, we can move all the property declarations into the implementation file. Then we can see them easily, while still having everying in one place.

This class is intended to be used like this:

class MySvcProps;
class MySvc: extends<...> { ...
private:
std::unique_ptr<MySvcProps> m_props;
class MySvcProps
: public AthProperties<MySvc>
{
public:
Gaudi::Property<int> m_intProp (parent(), "IntProp", 14, "Some property");
};
MySvc::MySvc (const std::string& name, ISvcLocator* svc)
m_props (new MySvcProps (this))
{ ...

Definition at line 59 of file AthProperties.h.

Member Typedef Documentation

◆ base_class

template<class PARENT >
typedef AthProperties AthProperties< PARENT >::base_class

Definition at line 62 of file AthProperties.h.

Constructor & Destructor Documentation

◆ AthProperties()

template<class PARENT >
AthProperties< PARENT >::AthProperties ( PARENT *  parent)
inline

Definition at line 63 of file AthProperties.h.

63 : m_parent (parent) {}

Member Function Documentation

◆ parent()

template<class PARENT >
PARENT* AthProperties< PARENT >::parent ( )
inline

Definition at line 64 of file AthProperties.h.

64 { return m_parent; }

Member Data Documentation

◆ m_parent

template<class PARENT >
PARENT* AthProperties< PARENT >::m_parent
private

Definition at line 68 of file AthProperties.h.


The documentation for this class was generated from the following file:
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
AthProperties::base_class
AthProperties base_class
Definition: AthProperties.h:62
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
AthProperties
pimpl-style holder for component properties.
Definition: AthProperties.h:60
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
AthProperties::m_parent
PARENT * m_parent
Definition: AthProperties.h:68
AthProperties::parent
PARENT * parent()
Definition: AthProperties.h:64