DataObjIDProperty.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_DATAOBJIDPROPERTY_H
2 #define GAUDIKERNEL_DATAOBJIDPROPERTY_H 1
3 
4 #include "GaudiKernel/StatusCode.h"
5 #include "GaudiKernel/Parsers.h"
6 #include "GaudiKernel/Property.h"
7 #include "GaudiKernel/PropertyMgr.h"
8 #include "GaudiKernel/ToStream.h"
9 #include "GaudiKernel/DataObjID.h"
10 
11 #include <iostream>
12 
13 //---------------------------------------------------------------------------
14 
25 //---------------------------------------------------------------------------
26 
27 
29  public:
30 
31  DataObjIDProperty( const std::string& name, DataObjID& ref );
33  virtual ~DataObjIDProperty();
34 
35  virtual DataObjIDProperty* clone() const;
36  virtual bool load( Property& destination ) const;
37  virtual bool assign( const Property& source );
38  virtual std::string toString() const;
39  virtual void toStream(std::ostream& out) const;
40  virtual StatusCode fromString(const std::string& s);
41  const DataObjID& value() const;
42  bool setValue( const DataObjID& value );
43 
44  private:
49 };
50 
51 template<>
53  public ::DataObjIDProperty
54 {
55 public:
56  SimplePropertyRef(const std::string& name, DataObjID& value) :
57  ::DataObjIDProperty(name, value)
58  {}
59 
61  virtual ~SimplePropertyRef() {}
62 };
63 
64 
65 inline
68 {
69  setValue( value );
70  return *this;
71 }
72 
73 inline
76 {
77  return new DataObjIDProperty( *this );
78 }
79 
80 inline
81 bool
82 DataObjIDProperty::load( Property& destination ) const
83 {
84  return destination.assign( *this );
85 }
86 
87 inline
88 bool
90 {
91  return fromString( source.toString() ).isSuccess();
92 }
93 
94 inline
95 const DataObjID&
97 {
99  return *m_pValue;
100 }
101 
102 //---------------------------------------------------------------------------
103 
105  public:
106 
107  DataObjIDCollProperty( const std::string& name, DataObjIDColl& ref );
109  virtual ~DataObjIDCollProperty();
110 
111  virtual DataObjIDCollProperty* clone() const;
112  virtual bool load( Property& destination ) const;
113  virtual bool assign( const Property& source );
114  virtual std::string toString() const;
115  virtual void toStream(std::ostream& out) const;
116  virtual StatusCode fromString(const std::string& s);
117  const DataObjIDColl& value() const;
118  bool setValue( const DataObjIDColl& value );
119 
120  private:
125 };
126 
127 template<>
130 {
131 public:
132  SimplePropertyRef(const std::string& name, DataObjIDColl& value) :
133  ::DataObjIDCollProperty(name, value)
134  {}
135 
137  virtual ~SimplePropertyRef() {}
138 };
139 
140 
141 inline
144 {
145  setValue( value );
146  return *this;
147 }
148 
149 inline
152 {
153  return new DataObjIDCollProperty( *this );
154 }
155 
156 inline
157 bool
158 DataObjIDCollProperty::load( Property& destination ) const
159 {
160  return destination.assign( *this );
161 }
162 
163 inline
164 bool
166 {
167  return fromString( source.toString() ).isSuccess();
168 }
169 
170 inline
171 const DataObjIDColl&
173 {
174  useReadHandler();
175  return *m_pValue;
176 }
177 
178 
179 
180 
181 #endif
virtual StatusCode fromString(const std::string &s)
string -> value
virtual void useReadHandler() const
use the call-back function at reading
Definition: Property.cpp:78
DataObjIDProperty(const std::string &name, DataObjID &ref)
virtual bool assign(const Property &source)=0
import the property value form the source
virtual std::string toString() const =0
value -> string
#define GAUDI_API
Definition: Kernel.h:107
SimplePropertyRef templated class.
Definition: HistoProperty.h:14
const std::string & name() const
property name
Definition: Property.h:45
virtual bool assign(const Property &source)
import the property value form the source
virtual bool load(Property &destination) const
export the property value to the destination
bool setValue(const DataObjID &value)
virtual bool load(Property &dest) const =0
export the property value to the destination
virtual bool load(Property &destination) const
export the property value to the destination
virtual DataObjIDProperty * clone() const
clone: "virtual constructor"
DataObjIDCollProperty & operator=(const DataObjIDColl &value)
virtual ~SimplePropertyRef()
virtual Destructor
bool setValue(const DataObjIDColl &value)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
DataObjIDProperty & operator=(const DataObjID &value)
const DataObjID & value() const
const TYPE & value() const
explicit conversion
Definition: Property.h:341
Property & operator=(const Property &)=default
assignment operator
virtual DataObjIDCollProperty * clone() const
clone: "virtual constructor"
DataObjIDColl * m_pValue
Pointer to the real property.
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
virtual StatusCode fromString(const std::string &s)
string -> value
SimplePropertyRef(const std::string &name, DataObjIDColl &value)
DataObjIDProperty.h GaudiKernel/DataObjProperty.h.
string s
Definition: gaudirun.py:246
SimplePropertyRef(const std::string &name, DataObjID &value)
virtual ~SimplePropertyRef()
virtual Destructor
DataObjID * m_pValue
Pointer to the real property.
const DataObjIDColl & value() const
virtual bool assign(const Property &source)
import the property value form the source
DataObjIDCollProperty(const std::string &name, DataObjIDColl &ref)
virtual Property * clone() const =0
clone: "virtual constructor"
virtual void toStream(std::ostream &out) const =0
value -> stream
std::unordered_set< DataObjID, DataObjID_Hasher > DataObjIDColl
Definition: DataObjID.h:124
virtual StatusCode fromString(const std::string &value)=0
string -> value