The Gaudi Framework  v38r0 (2143aa4c)
Gaudi::Details::WeakPropertyRef Class Reference

Optional reference to a property that can be used to refer to a sting or to the string representation of a property instance value. More...

#include </builds/gaudi/Gaudi/GaudiKernel/include/Gaudi/Details/PropertyBase.h>

Collaboration diagram for Gaudi::Details::WeakPropertyRef:

Public Member Functions

 WeakPropertyRef ()=default
 
 WeakPropertyRef (std::string value)
 
 WeakPropertyRef (PropertyBase &property)
 
 WeakPropertyRef (const WeakPropertyRef &other)=delete
 
 WeakPropertyRef (WeakPropertyRef &&other)
 
 ~WeakPropertyRef ()
 
WeakPropertyRefoperator= (WeakPropertyRef &&other)
 
WeakPropertyRefoperator= (PropertyBase &value)
 
WeakPropertyRefoperator= (const std::string &value)
 
 operator std::string () const
 
bool isBound () const
 
bool isSet () const
 

Private Member Functions

void detach ()
 

Private Attributes

friend PropertyBase
 
PropertyBasem_property = nullptr
 
std::string m_value
 
bool m_unset = true
 

Detailed Description

Optional reference to a property that can be used to refer to a sting or to the string representation of a property instance value.

Definition at line 155 of file PropertyBase.h.

Constructor & Destructor Documentation

◆ WeakPropertyRef() [1/5]

Gaudi::Details::WeakPropertyRef::WeakPropertyRef ( )
default

◆ WeakPropertyRef() [2/5]

Gaudi::Details::WeakPropertyRef::WeakPropertyRef ( std::string  value)
inline

Definition at line 160 of file PropertyBase.h.

160 : m_value{ std::move( value ) }, m_unset{ false } {}

◆ WeakPropertyRef() [3/5]

Gaudi::Details::WeakPropertyRef::WeakPropertyRef ( PropertyBase property)
inline

Definition at line 161 of file PropertyBase.h.

161 : m_property{ &property } { property.add( this ); }

◆ WeakPropertyRef() [4/5]

Gaudi::Details::WeakPropertyRef::WeakPropertyRef ( const WeakPropertyRef other)
delete

◆ WeakPropertyRef() [5/5]

Gaudi::Details::WeakPropertyRef::WeakPropertyRef ( WeakPropertyRef &&  other)
inline

Definition at line 163 of file PropertyBase.h.

164  : m_property{ other.m_property }, m_value{ std::move( other.m_value ) }, m_unset{ other.m_unset } {
165  if ( m_property ) {
166  other.m_property = nullptr;
167  m_property->remove( &other );
168  m_property->add( this );
169  }
170  }

◆ ~WeakPropertyRef()

Gaudi::Details::WeakPropertyRef::~WeakPropertyRef ( )
inline

Definition at line 171 of file PropertyBase.h.

171  {
172  if ( m_property ) m_property->remove( this );
173  }

Member Function Documentation

◆ detach()

void Gaudi::Details::WeakPropertyRef::detach ( )
inlineprivate

Definition at line 216 of file PropertyBase.h.

216 { m_property = nullptr; }

◆ isBound()

bool Gaudi::Details::WeakPropertyRef::isBound ( ) const
inline

Definition at line 208 of file PropertyBase.h.

208 { return m_property; }

◆ isSet()

bool Gaudi::Details::WeakPropertyRef::isSet ( ) const
inline

Definition at line 209 of file PropertyBase.h.

209 { return !m_unset; }

◆ operator std::string()

Gaudi::Details::WeakPropertyRef::operator std::string ( ) const

Definition at line 508 of file Property.cpp.

508  {
510  return m_property ? ( ( m_property->type_info() == &typeid( std::string ) ) ? toString( m_property->toString() )
511  : m_property->toString() )
512  : m_value;
513 }

◆ operator=() [1/3]

WeakPropertyRef& Gaudi::Details::WeakPropertyRef::operator= ( const std::string value)
inline

Definition at line 200 of file PropertyBase.h.

200  {
201  if ( m_property ) m_property->fromString( value ).ignore();
202  m_value = value;
203  m_unset = false;
204  return *this;
205  }

◆ operator=() [2/3]

WeakPropertyRef& Gaudi::Details::WeakPropertyRef::operator= ( PropertyBase value)
inline

Definition at line 188 of file PropertyBase.h.

188  {
189  if ( m_property != &value ) {
190  if ( m_property ) {
191  m_property->remove( this );
192  if ( !m_unset ) m_value = m_property->toString();
193  }
194  if ( !m_unset ) value.fromString( m_value ).ignore();
195  m_property = &value;
196  value.add( this );
197  }
198  return *this;
199  }

◆ operator=() [3/3]

WeakPropertyRef& Gaudi::Details::WeakPropertyRef::operator= ( WeakPropertyRef &&  other)
inline

Definition at line 174 of file PropertyBase.h.

174  {
175  if ( this != &other ) {
176  if ( m_property ) m_property->remove( this );
177  m_property = other.m_property;
178  other.m_property = nullptr;
179  if ( m_property ) {
180  m_property->remove( &other );
181  m_property->add( this );
182  }
183  m_value = std::move( other.m_value );
184  m_unset = other.m_unset;
185  }
186  return *this;
187  }

Member Data Documentation

◆ m_property

PropertyBase* Gaudi::Details::WeakPropertyRef::m_property = nullptr
private

Definition at line 212 of file PropertyBase.h.

◆ m_unset

bool Gaudi::Details::WeakPropertyRef::m_unset = true
private

Definition at line 214 of file PropertyBase.h.

◆ m_value

std::string Gaudi::Details::WeakPropertyRef::m_value
private

Definition at line 213 of file PropertyBase.h.

◆ PropertyBase

friend Gaudi::Details::WeakPropertyRef::PropertyBase
private

Definition at line 156 of file PropertyBase.h.


The documentation for this class was generated from the following files:
std::string
STL class.
Gaudi::Details::WeakPropertyRef::m_unset
bool m_unset
Definition: PropertyBase.h:214
std::move
T move(T... args)
Gaudi::Details::PropertyBase::type_info
const std::type_info * type_info() const
property type-info
Definition: PropertyBase.h:45
Gaudi::Details::WeakPropertyRef::m_value
std::string m_value
Definition: PropertyBase.h:213
Gaudi::Details::PropertyBase::remove
void remove(WeakPropertyRef *ref)
Definition: PropertyBase.h:150
Gaudi::Details::PropertyBase::fromString
virtual StatusCode fromString(const std::string &value)=0
string -> value
Gaudi::Details::PropertyBase::add
void add(WeakPropertyRef *ref)
Definition: PropertyBase.h:147
StatusCode::ignore
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition: StatusCode.h:139
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:354
Gaudi::Details::WeakPropertyRef::m_property
PropertyBase * m_property
Definition: PropertyBase.h:212
Gaudi::Details::PropertyBase::toString
virtual std::string toString() const =0
value -> string