The Gaudi Framework  v30r3 (a5ef0a68)
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...
 
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...
 
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="")
 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...
 

Private Member Functions

 PropertyBase ()=delete
 

Static Private Member Functions

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

Private Attributes

boost::string_ref m_name
 property name More...
 
boost::string_ref m_documentation
 property doc string 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 32 of file Property.h.

Constructor & Destructor Documentation

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

virtual destructor

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

constructor from the property name and the type

Definition at line 119 of file Property.h.

120  : m_name( to_view( std::move( name ) ) ), m_documentation( to_view( std::move( doc ) ) ), m_typeinfo( &type )
121  {
122  }
boost::string_ref m_name
property name
Definition: Property.h:137
const std::type_info * m_typeinfo
property type
Definition: Property.h:141
T move(T...args)
static boost::string_ref to_view(std::string str)
helper to map a string to a reliable boost::string_ref
Definition: Property.cpp:44
boost::string_ref m_documentation
property doc string
Definition: Property.h:139
Gaudi::Details::PropertyBase::PropertyBase ( std::string  name,
const std::type_info type 
)
inlineprotected

constructor from the property name and the type

Definition at line 124 of file Property.h.

125  : m_name( to_view( std::move( name ) ) ), m_documentation( m_name ), m_typeinfo( &type )
126  {
127  }
boost::string_ref m_name
property name
Definition: Property.h:137
const std::type_info * m_typeinfo
property type
Definition: Property.h:141
T move(T...args)
static boost::string_ref to_view(std::string str)
helper to map a string to a reliable boost::string_ref
Definition: Property.cpp:44
boost::string_ref m_documentation
property doc string
Definition: Property.h:139
Gaudi::Details::PropertyBase::PropertyBase ( const PropertyBase )
protecteddefault

copy constructor

Member Function Documentation

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

Definition at line 75 of file Property.h.

76  {
77  return declareReadHandler( [=]( PropertyBase& p ) { ( instance->*MF )( p ); } );
78  }
virtual PropertyBase & declareReadHandler(std::function< void(PropertyBase &)> fun)=0
set new callback for reading
template<class HT >
PropertyBase& Gaudi::Details::PropertyBase::declareUpdateHandler ( void(HT::*)(PropertyBase &)  MF,
HT *  instance 
)
inline

Definition at line 81 of file Property.h.

82  {
83  return declareUpdateHandler( [=]( PropertyBase& p ) { ( instance->*MF )( p ); } );
84  }
virtual PropertyBase & declareUpdateHandler(std::function< void(PropertyBase &)> fun)=0
set new callback for update
std::string Gaudi::Details::PropertyBase::documentation ( ) const
inline

property documentation

Definition at line 42 of file Property.h.

42 { return m_documentation.to_string(); }
boost::string_ref m_documentation
property doc string
Definition: Property.h:139
std::ostream & PropertyBase::fillStream ( std::ostream stream) const
virtual

the printout of the property value

Definition at line 52 of file Property.cpp.

53 {
54  return stream << " '" << name() << "':" << toString();
55 }
const std::string name() const
property name
Definition: Property.h:40
virtual std::string toString() const =0
value -> string
const std::string Gaudi::Details::PropertyBase::name ( ) const
inline

property name

Definition at line 40 of file Property.h.

40 { return m_name.to_string(); }
boost::string_ref m_name
property name
Definition: Property.h:137
PropertyBase& Gaudi::Details::PropertyBase::operator= ( const PropertyBase )
protecteddefault

assignment operator

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

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

Definition at line 109 of file Property.h.

109 { return m_ownerType; }
const std::type_info * m_ownerType
type of owner of the property (if defined)
Definition: Property.h:143
std::string Gaudi::Details::PropertyBase::ownerTypeName ( ) const
inline

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

Definition at line 112 of file Property.h.

113  {
114  return m_ownerType ? System::typeinfoName( *m_ownerType ) : std::string( "unknown owner type" );
115  }
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:332
STL namespace.
const std::type_info * m_ownerType
type of owner of the property (if defined)
Definition: Property.h:143
void Gaudi::Details::PropertyBase::setDocumentation ( std::string  value)
inline

set the documentation string

Definition at line 92 of file Property.h.

92 { m_documentation = to_view( std::move( value ) ); }
T move(T...args)
static boost::string_ref to_view(std::string str)
helper to map a string to a reliable boost::string_ref
Definition: Property.cpp:44
boost::string_ref m_documentation
property doc string
Definition: Property.h:139
void Gaudi::Details::PropertyBase::setName ( std::string  value)
inline

set the new value for the property name

Definition at line 90 of file Property.h.

90 { m_name = to_view( std::move( value ) ); }
boost::string_ref m_name
property name
Definition: Property.h:137
T move(T...args)
static boost::string_ref to_view(std::string str)
helper to map a string to a reliable boost::string_ref
Definition: Property.cpp:44
void Gaudi::Details::PropertyBase::setOwnerType ( const std::type_info ownerType)
inline

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

Definition at line 99 of file Property.h.

99 { m_ownerType = &ownerType; }
const std::type_info * m_ownerType
type of owner of the property (if defined)
Definition: Property.h:143
const std::type_info * ownerType() const
get the type of the owner class (used for documentation)
Definition: Property.h:109
template<class OWNER >
void Gaudi::Details::PropertyBase::setOwnerType ( )
inline

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

Definition at line 103 of file Property.h.

104  {
105  setOwnerType( typeid( OWNER ) );
106  }
void setOwnerType()
set the type of the owner class (used for documentation)
Definition: Property.h:103
boost::string_ref PropertyBase::to_view ( std::string  str)
staticprivate

helper to map a string to a reliable boost::string_ref

Definition at line 44 of file Property.cpp.

45 {
46  return **( all_strings.insert( std::make_unique<std::string>( std::move( str ) ) ).first );
47 }
T move(T...args)
std::string Gaudi::Details::PropertyBase::type ( ) const
inline

property type

Definition at line 46 of file Property.h.

46 { return m_typeinfo->name(); }
const std::type_info * m_typeinfo
property type
Definition: Property.h:141
T name(T...args)
const std::type_info* Gaudi::Details::PropertyBase::type_info ( ) const
inline

property type-info

Definition at line 44 of file Property.h.

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

Member Data Documentation

boost::string_ref Gaudi::Details::PropertyBase::m_documentation
private

property doc string

Definition at line 139 of file Property.h.

boost::string_ref Gaudi::Details::PropertyBase::m_name
private

property name

Definition at line 137 of file Property.h.

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

type of owner of the property (if defined)

Definition at line 143 of file Property.h.

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

property type

Definition at line 141 of file Property.h.


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