Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v28r2p1 (f1a77ff4)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DataObjIDProperty.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_DATAOBJIDPROPERTY_H
2 #define GAUDIKERNEL_DATAOBJIDPROPERTY_H 1
3 
5 #include "GaudiKernel/Parsers.h"
6 #include "GaudiKernel/Property.h"
8 #include "GaudiKernel/ToStream.h"
9 
10 #include <iostream>
11 
12 //---------------------------------------------------------------------------
13 
24 //---------------------------------------------------------------------------
25 
27 {
28 public:
30  DataObjIDProperty& operator=( const DataObjID& value );
31  ~DataObjIDProperty() override;
32 
33  DataObjIDProperty* clone() const override;
34  bool load( Property& destination ) const override;
35  bool assign( const Property& source ) override;
36  std::string toString() const override;
37  void toStream( std::ostream& out ) const override;
38  StatusCode fromString( const std::string& s ) override;
39  const DataObjID& value() const;
40  bool setValue( const DataObjID& value );
41 
42 private:
47 };
48 
49 namespace Gaudi
50 {
51  template <>
52  class Property<DataObjID&> : public ::DataObjIDProperty
53  {
54  public:
55  Property( const std::string& name, DataObjID& value ) : ::DataObjIDProperty( name, value ) {}
56 
58  virtual ~Property() {}
59  };
60 } // namespace Gaudi
61 
63 {
64  setValue( value );
65  return *this;
66 }
67 
68 inline DataObjIDProperty* DataObjIDProperty::clone() const { return new DataObjIDProperty( *this ); }
69 
70 inline bool DataObjIDProperty::load( Gaudi::Details::PropertyBase& destination ) const
71 {
72  return destination.assign( *this );
73 }
74 
76 {
77  return fromString( source.toString() ).isSuccess();
78 }
79 
80 inline const DataObjID& DataObjIDProperty::value() const
81 {
82  useReadHandler();
83  return *m_pValue;
84 }
85 
86 //---------------------------------------------------------------------------
87 
89 {
90 public:
93  virtual ~DataObjIDCollProperty();
94 
95  DataObjIDCollProperty* clone() const override;
96  bool load( Property& destination ) const override;
97  bool assign( const Property& source ) override;
98  std::string toString() const override;
99  void toStream( std::ostream& out ) const override;
100  StatusCode fromString( const std::string& s ) override;
101  const DataObjIDColl& value() const;
102  bool setValue( const DataObjIDColl& value );
103 
104 private:
109 };
110 
111 namespace Gaudi
112 {
113  template <>
114  class Property<DataObjIDColl&> : public ::DataObjIDCollProperty
115  {
116  public:
117  Property( const std::string& name, DataObjIDColl& value ) : ::DataObjIDCollProperty( name, value ) {}
118 
120  virtual ~Property() {}
121  };
122 
123  template <>
125  {
126  public:
127  Property( const std::string& name, DataObjIDColl& value ) : ::DataObjIDCollProperty( name, value ) {}
128 
130  template <class OWNER>
131  inline Property( OWNER* owner, const std::string& name, const DataObjIDColl& initval = DataObjIDColl{},
132  std::string doc = "" )
133  : ::DataObjIDCollProperty( name, *( new DataObjIDColl{initval} ) )
134  {
137  m_data.reset( const_cast<DataObjIDColl*>( &value() ) );
138  setDocumentation( std::move( doc ) );
139  owner->declareProperty( *this );
140  setOwnerType<OWNER>();
141  }
142 
143  operator const DataObjIDColl&() const { return value(); }
144 
146  virtual ~Property() {}
147  private:
149  };
150 } // namespace Gaudi
151 
153 {
154  setValue( value );
155  return *this;
156 }
157 
159 
161 {
162  return destination.assign( *this );
163 }
164 
166 {
167  return fromString( source.toString() ).isSuccess();
168 }
169 
171 {
172  useReadHandler();
173  return *m_pValue;
174 }
175 
176 #endif
Property(const std::string &name, DataObjIDColl &value)
std::ostream & toStream(ITERATOR first, ITERATOR last, std::ostream &s, const std::string &open, const std::string &close, const std::string &delim)
the helper function to print the sequence
Definition: ToStream.h:315
bool assign(const Property &source) override
Property(OWNER *owner, const std::string &name, const DataObjIDColl &initval=DataObjIDColl{}, std::string doc="")
Autodeclaring constructor with property name, value and documentation.
Implementation of property with value of concrete type.
Definition: Property.h:314
DataObjIDCollProperty * clone() const override
clones the current property
virtual bool load(PropertyBase &dest) const =0
export the property value to the destination
virtual ~Property()
virtual Destructor
virtual bool assign(const PropertyBase &source)=0
import the property value form the source
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:367
Property(const std::string &name, DataObjIDColl &value)
virtual std::string toString() const =0
value -> string
bool load(Property &destination) const override
Gaudi::Details::PropertyBase Property
backward compatibility hack for old Property base class
Definition: PropertyFwd.h:28
DataObjIDProperty * clone() const override
clones the current property
std::unique_ptr< DataObjIDColl > m_data
DataObjIDCollProperty & operator=(const DataObjIDColl &value)
virtual void toStream(std::ostream &out) const =0
value -> stream
virtual StatusCode fromString(const std::string &value)=0
string -> value
Helper class to simplify the migration old properties deriving directly from PropertyBase.
Definition: Property.h:751
PropertyMgr & operator=(const PropertyMgr &)=delete
STL class.
virtual ~Property()
virtual Destructor
DataObjID * m_pValue
Pointer to the real property.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual PropertyBase * clone() const =0
clones the current property
DataObjIDProperty & operator=(const DataObjID &value)
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
const DataObjID & value() const
bool assign(const Property &source) override
virtual ~Property()
virtual Destructor
T move(T...args)
STL class.
DataObjIDProperty.h GaudiKernel/DataObjProperty.h.
string s
Definition: gaudirun.py:245
DataObjIDColl * m_pValue
Pointer to the real property.
Property(const std::string &name, DataObjID &value)
implementation of various functions for streaming.
const DataObjIDColl & value() const
#define GAUDI_API
Definition: Kernel.h:107
STL class.
bool load(Property &destination) const override
Helper functions to set/get the application return code.
Definition: __init__.py:1
PropertyBase & operator=(const PropertyBase &)=default
assignment operator