The Gaudi Framework  v33r0 (d5ea422b)
Gaudi::Details::PropertyBase Class Referenceabstract

PropertyBase base class allowing PropertyBase* collections to be "homogeneous". More...

#include <GaudiKernel/Property.h>

Inheritance diagram for Gaudi::Details::PropertyBase:
Collaboration diagram for Gaudi::Details::PropertyBase:

Public Member Functions

const std::string name () const
 property name More...
 
std::string documentation () const
 property documentation More...
 
std::string semantics () const
 property semantics More...
 
const std::type_infotype_info () const
 property type-info More...
 
std::string type () const
 property type More...
 
virtual bool load (PropertyBase &dest) const =0
 export the property value to the destination More...
 
virtual bool assign (const PropertyBase &source)=0
 import the property value form the source More...
 
virtual std::string toString () const =0
 value -> string More...
 
virtual void toStream (std::ostream &out) const =0
 value -> stream More...
 
virtual StatusCode fromString (const std::string &value)=0
 string -> value More...
 
virtual PropertyBasedeclareReadHandler (std::function< void(PropertyBase &)> fun)=0
 set new callback for reading More...
 
virtual PropertyBasedeclareUpdateHandler (std::function< void(PropertyBase &)> fun)=0
 set new callback for update More...
 
virtual const std::function< void(PropertyBase &)> readCallBack () const =0
 get a reference to the readCallBack More...
 
virtual const std::function< void(PropertyBase &)> updateCallBack () const =0
 get a reference to the updateCallBack More...
 
virtual bool useUpdateHandler ()=0
 manual trigger for callback for update More...
 
template<class HT >
PropertyBasedeclareReadHandler (void(HT::*MF)(PropertyBase &), HT *instance)
 
template<class HT >
PropertyBasedeclareUpdateHandler (void(HT::*MF)(PropertyBase &), HT *instance)
 
virtual ~PropertyBase ()=default
 virtual destructor More...
 
void setName (std::string value)
 set the new value for the property name More...
 
void setDocumentation (std::string value)
 set the documentation string More...
 
void setSemantics (std::string value)
 set the semantics string More...
 
virtual std::ostreamfillStream (std::ostream &) const
 the printout of the property value More...
 
virtual PropertyBaseclone () const =0
 clones the current property More...
 
void setOwnerType (const std::type_info &ownerType)
 set the type of the owner class (used for documentation) More...
 
template<class OWNER >
void setOwnerType ()
 set the type of the owner class (used for documentation) More...
 
const std::type_infoownerType () const
 get the type of the owner class (used for documentation) More...
 
std::string ownerTypeName () const
 get the string for the type of the owner class (used for documentation) More...
 

Protected Member Functions

 PropertyBase (const std::type_info &type, std::string name="", std::string doc="", std::string semantics="")
 constructor from the property name and the type More...
 
 PropertyBase (std::string name, const std::type_info &type)
 constructor from the property name and the type More...
 
 PropertyBase (const PropertyBase &)=default
 copy constructor More...
 
PropertyBaseoperator= (const PropertyBase &)=default
 assignment operator More...
 

Static Private Member Functions

static std::string_view to_view (std::string str)
 helper to map a string to a reliable std::string_view More...
 

Private Attributes

std::string_view m_name
 property name More...
 
std::string_view m_documentation
 property doc string More...
 
std::string_view m_semantics
 property semantics More...
 
const std::type_infom_typeinfo
 property type More...
 
const std::type_infom_ownerType = nullptr
 type of owner of the property (if defined) More...
 

Detailed Description

PropertyBase base class allowing PropertyBase* collections to be "homogeneous".

Author
Paul Maley
CTDay
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u
Marco Clemencic

Definition at line 42 of file Property.h.

Constructor & Destructor Documentation

◆ ~PropertyBase()

virtual Gaudi::Details::PropertyBase::~PropertyBase ( )
virtualdefault

virtual destructor

◆ PropertyBase() [1/3]

Gaudi::Details::PropertyBase::PropertyBase ( const std::type_info type,
std::string  name = "",
std::string  doc = "",
std::string  semantics = "" 
)
inlineprotected

constructor from the property name and the type

Definition at line 125 of file Property.h.

127  : m_name( to_view( std::move( name ) ) )
128  , m_documentation( to_view( std::move( doc ) ) )
130  , m_typeinfo( &type ) {}
std::string_view m_semantics
property semantics
Definition: Property.h:147
std::string_view m_name
property name
Definition: Property.h:143
const std::string name() const
property name
Definition: Property.h:46
std::string semantics() const
property semantics
Definition: Property.h:50
static std::string_view to_view(std::string str)
helper to map a string to a reliable std::string_view
Definition: Property.cpp:52
const std::type_info * m_typeinfo
property type
Definition: Property.h:149
std::string_view m_documentation
property doc string
Definition: Property.h:145
T move(T... args)
std::string type() const
property type
Definition: Property.h:54

◆ PropertyBase() [2/3]

Gaudi::Details::PropertyBase::PropertyBase ( std::string  name,
const std::type_info type 
)
inlineprotected

constructor from the property name and the type

Definition at line 132 of file Property.h.

std::string_view m_name
property name
Definition: Property.h:143
const std::string name() const
property name
Definition: Property.h:46
static std::string_view to_view(std::string str)
helper to map a string to a reliable std::string_view
Definition: Property.cpp:52
const std::type_info * m_typeinfo
property type
Definition: Property.h:149
std::string_view m_documentation
property doc string
Definition: Property.h:145
T move(T... args)
std::string type() const
property type
Definition: Property.h:54

◆ PropertyBase() [3/3]

Gaudi::Details::PropertyBase::PropertyBase ( const PropertyBase )
protecteddefault

copy constructor

Member Function Documentation

◆ assign()

◆ clone()

◆ declareReadHandler() [1/2]

◆ declareReadHandler() [2/2]

template<class HT >
PropertyBase& Gaudi::Details::PropertyBase::declareReadHandler ( void(HT::*)(PropertyBase &)  MF,
HT *  instance 
)
inline

Definition at line 83 of file Property.h.

83  {
84  return declareReadHandler( [=]( PropertyBase& p ) { ( instance->*MF )( p ); } );
85  }
PropertyBase(const std::type_info &type, std::string name="", std::string doc="", std::string semantics="")
constructor from the property name and the type
Definition: Property.h:125
virtual PropertyBase & declareReadHandler(std::function< void(PropertyBase &)> fun)=0
set new callback for reading

◆ declareUpdateHandler() [1/2]

◆ declareUpdateHandler() [2/2]

template<class HT >
PropertyBase& Gaudi::Details::PropertyBase::declareUpdateHandler ( void(HT::*)(PropertyBase &)  MF,
HT *  instance 
)
inline

Definition at line 88 of file Property.h.

88  {
89  return declareUpdateHandler( [=]( PropertyBase& p ) { ( instance->*MF )( p ); } );
90  }
virtual PropertyBase & declareUpdateHandler(std::function< void(PropertyBase &)> fun)=0
set new callback for update
PropertyBase(const std::type_info &type, std::string name="", std::string doc="", std::string semantics="")
constructor from the property name and the type
Definition: Property.h:125

◆ documentation()

std::string Gaudi::Details::PropertyBase::documentation ( ) const
inline

property documentation

Definition at line 48 of file Property.h.

48 { return std::string{m_documentation}; }
STL class.
std::string_view m_documentation
property doc string
Definition: Property.h:145

◆ fillStream()

std::ostream & PropertyBase::fillStream ( std::ostream stream) const
virtual

the printout of the property value

Definition at line 59 of file Property.cpp.

59  {
60  return stream << " '" << name() << "':" << toString();
61 }
const std::string name() const
property name
Definition: Property.h:46
virtual std::string toString() const =0
value -> string

◆ fromString()

◆ load()

◆ name()

const std::string Gaudi::Details::PropertyBase::name ( ) const
inline

property name

Definition at line 46 of file Property.h.

46 { return std::string{m_name}; }
std::string_view m_name
property name
Definition: Property.h:143
STL class.

◆ operator=()

PropertyBase& Gaudi::Details::PropertyBase::operator= ( const PropertyBase )
protecteddefault

assignment operator

◆ ownerType()

const std::type_info* Gaudi::Details::PropertyBase::ownerType ( ) const
inline

get the type of the owner class (used for documentation)

Definition at line 116 of file Property.h.

116 { return m_ownerType; }
const std::type_info * m_ownerType
type of owner of the property (if defined)
Definition: Property.h:151

◆ ownerTypeName()

std::string Gaudi::Details::PropertyBase::ownerTypeName ( ) const
inline

get the string for the type of the owner class (used for documentation)

Definition at line 119 of file Property.h.

119  {
120  return m_ownerType ? System::typeinfoName( *m_ownerType ) : std::string( "unknown owner type" );
121  }
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:308
STL namespace.
const std::type_info * m_ownerType
type of owner of the property (if defined)
Definition: Property.h:151

◆ readCallBack()

◆ semantics()

std::string Gaudi::Details::PropertyBase::semantics ( ) const
inline

property semantics

Definition at line 50 of file Property.h.

50 { return std::string{m_semantics}; }
std::string_view m_semantics
property semantics
Definition: Property.h:147
STL class.

◆ setDocumentation()

void Gaudi::Details::PropertyBase::setDocumentation ( std::string  value)
inline

set the documentation string

Definition at line 98 of file Property.h.

98 { m_documentation = to_view( std::move( value ) ); }
static std::string_view to_view(std::string str)
helper to map a string to a reliable std::string_view
Definition: Property.cpp:52
std::string_view m_documentation
property doc string
Definition: Property.h:145
T move(T... args)

◆ setName()

void Gaudi::Details::PropertyBase::setName ( std::string  value)
inline

set the new value for the property name

Definition at line 96 of file Property.h.

96 { m_name = to_view( std::move( value ) ); }
std::string_view m_name
property name
Definition: Property.h:143
static std::string_view to_view(std::string str)
helper to map a string to a reliable std::string_view
Definition: Property.cpp:52
T move(T... args)

◆ setOwnerType() [1/2]

void Gaudi::Details::PropertyBase::setOwnerType ( const std::type_info ownerType)
inline

set the type of the owner class (used for documentation)

Definition at line 107 of file Property.h.

107 { m_ownerType = &ownerType; }
const std::type_info * m_ownerType
type of owner of the property (if defined)
Definition: Property.h:151
const std::type_info * ownerType() const
get the type of the owner class (used for documentation)
Definition: Property.h:116

◆ setOwnerType() [2/2]

template<class OWNER >
void Gaudi::Details::PropertyBase::setOwnerType ( )
inline

set the type of the owner class (used for documentation)

Definition at line 111 of file Property.h.

111  {
112  setOwnerType( typeid( OWNER ) );
113  }
void setOwnerType()
set the type of the owner class (used for documentation)
Definition: Property.h:111

◆ setSemantics()

void Gaudi::Details::PropertyBase::setSemantics ( std::string  value)
inline

set the semantics string

Definition at line 100 of file Property.h.

100 { m_semantics = to_view( std::move( value ) ); }
std::string_view m_semantics
property semantics
Definition: Property.h:147
static std::string_view to_view(std::string str)
helper to map a string to a reliable std::string_view
Definition: Property.cpp:52
T move(T... args)

◆ to_view()

std::string_view PropertyBase::to_view ( std::string  str)
staticprivate

helper to map a string to a reliable std::string_view

Definition at line 52 of file Property.cpp.

52  {
53  return **( all_strings.insert( std::make_unique<std::string>( std::move( str ) ) ).first );
54 }
T move(T... args)

◆ toStream()

◆ toString()

◆ type()

std::string Gaudi::Details::PropertyBase::type ( ) const
inline

property type

Definition at line 54 of file Property.h.

54 { return m_typeinfo->name(); }
const std::type_info * m_typeinfo
property type
Definition: Property.h:149
T name(T... args)

◆ type_info()

const std::type_info* Gaudi::Details::PropertyBase::type_info ( ) const
inline

property type-info

Definition at line 52 of file Property.h.

52 { return m_typeinfo; }
const std::type_info * m_typeinfo
property type
Definition: Property.h:149

◆ updateCallBack()

◆ useUpdateHandler()

Member Data Documentation

◆ m_documentation

std::string_view Gaudi::Details::PropertyBase::m_documentation
private

property doc string

Definition at line 145 of file Property.h.

◆ m_name

std::string_view Gaudi::Details::PropertyBase::m_name
private

property name

Definition at line 143 of file Property.h.

◆ m_ownerType

const std::type_info* Gaudi::Details::PropertyBase::m_ownerType = nullptr
private

type of owner of the property (if defined)

Definition at line 151 of file Property.h.

◆ m_semantics

std::string_view Gaudi::Details::PropertyBase::m_semantics
private

property semantics

Definition at line 147 of file Property.h.

◆ m_typeinfo

const std::type_info* Gaudi::Details::PropertyBase::m_typeinfo
private

property type

Definition at line 149 of file Property.h.


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