| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
28 class GAUDI_API DataObjIDProperty : public ::Property {
29 public:
30
31 DataObjIDProperty( const std::string& name, DataObjID& ref );
32 DataObjIDProperty& operator=( const DataObjID& value );
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:
48 DataObjID* m_pValue;
49 };
50
51 template<>
52 class SimplePropertyRef< DataObjID > :
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
66 DataObjIDProperty&
67 DataObjIDProperty::operator=( const DataObjID& value )
68 {
69 setValue( value );
70 return *this;
71 }
72
73 inline
74 DataObjIDProperty*
75 DataObjIDProperty::clone() const
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
89 DataObjIDProperty::assign( const Property& source )
90 {
91 return fromString( source.toString() ).isSuccess();
92 }
93
94 inline
95 const DataObjID&
96 DataObjIDProperty::value() const
97 {
98 useReadHandler();
99 return *m_pValue;
100 }
101
102 //---------------------------------------------------------------------------
103
104 class GAUDI_API DataObjIDCollProperty : public ::Property {
105 public:
106
107 DataObjIDCollProperty( const std::string& name, DataObjIDColl& ref );
108 DataObjIDCollProperty& operator=( const DataObjIDColl& value );
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:
124 DataObjIDColl* m_pValue;
125 };
126
127 template<>
128 class SimplePropertyRef< DataObjIDColl > :
129 public ::DataObjIDCollProperty
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
142 DataObjIDCollProperty&
143 DataObjIDCollProperty::operator=( const DataObjIDColl& value )
144 {
145 setValue( value );
146 return *this;
147 }
148
149 inline
150 DataObjIDCollProperty*
151 DataObjIDCollProperty::clone() const
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
165 DataObjIDCollProperty::assign( const Property& source )
166 {
167 return fromString( source.toString() ).isSuccess();
168 }
169
170 inline
171 const DataObjIDColl&
172 DataObjIDCollProperty::value() const
173 {
174 useReadHandler();
175 return *m_pValue;
176 }
177
178
179
180
181 #endif
DataObjIDCollProperty::fromString
virtual StatusCode fromString(const std::string &s)
string -> value
Definition: DataObjIDProperty.cpp:241
Property::useReadHandler
virtual void useReadHandler() const
use the call-back function at reading
Definition: Property.cpp:80
DataObjIDProperty::DataObjIDProperty
DataObjIDProperty(const std::string &name, DataObjID &ref)
Definition: DataObjIDProperty.cpp:171
Property::assign
virtual bool assign(const Property &source)=0
import the property value form the source
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
Property::toString
virtual std::string toString() const =0
value -> string
DataObjID
Definition: DataObjID.h:38
SimplePropertyRef
SimplePropertyRef templated class.
Definition: HistoProperty.h:14
Property::name
const std::string & name() const
property name
Definition: Property.h:45
Parsers.h
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
DataObjIDProperty::assign
virtual bool assign(const Property &source)
import the property value form the source
Definition: DataObjIDProperty.h:89
DataObjIDCollProperty::load
virtual bool load(Property &destination) const
export the property value to the destination
Definition: DataObjIDProperty.h:158
DataObjIDProperty::setValue
bool setValue(const DataObjID &value)
Definition: DataObjIDProperty.cpp:198
Property::load
virtual bool load(Property &dest) const =0
export the property value to the destination
DataObjIDProperty::load
virtual bool load(Property &destination) const
export the property value to the destination
Definition: DataObjIDProperty.h:82
DataObjIDProperty::clone
virtual DataObjIDProperty * clone() const
clone: "virtual constructor"
Definition: DataObjIDProperty.h:75
DataObjIDCollProperty::operator=
DataObjIDCollProperty & operator=(const DataObjIDColl &value)
Definition: DataObjIDProperty.h:143
std::string
STL class.
compareRootHistos.ref
string ref
Definition: compareRootHistos.py:14
SimplePropertyRef< DataObjID >::~SimplePropertyRef
virtual ~SimplePropertyRef()
virtual Destructor
Definition: DataObjIDProperty.h:61
DataObjIDProperty::m_pValue
DataObjID * m_pValue
Pointer to the real property.
Definition: DataObjIDProperty.h:48
DataObjIDCollProperty::setValue
bool setValue(const DataObjIDColl &value)
Definition: DataObjIDProperty.cpp:254
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
DataObjIDCollProperty
Definition: DataObjIDProperty.h:104
DataObjIDProperty::operator=
DataObjIDProperty & operator=(const DataObjID &value)
Definition: DataObjIDProperty.h:67
dump_component_properties.value
list value
Definition: dump_component_properties.py:12
std::unordered_set
STL class.
DataObjIDProperty::value
const DataObjID & value() const
Definition: DataObjIDProperty.h:96
PropertyWithValue::value
const TYPE & value() const
explicit conversion
Definition: Property.h:341
DataObjID.h
Property::operator=
Property & operator=(const Property &)=default
assignment operator
DataObjIDCollProperty::clone
virtual DataObjIDCollProperty * clone() const
clone: "virtual constructor"
Definition: DataObjIDProperty.h:151
Property
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
DataObjIDProperty::fromString
virtual StatusCode fromString(const std::string &s)
string -> value
Definition: DataObjIDProperty.cpp:185
SimplePropertyRef< DataObjIDColl >::SimplePropertyRef
SimplePropertyRef(const std::string &name, DataObjIDColl &value)
Definition: DataObjIDProperty.h:132
DataObjIDProperty
DataObjIDProperty.h GaudiKernel/DataObjProperty.h.
Definition: DataObjIDProperty.h:28
Property.h
PropertyMgr.h
gaudirun.s
string s
Definition: gaudirun.py:245
DataObjIDCollProperty::m_pValue
DataObjIDColl * m_pValue
Pointer to the real property.
Definition: DataObjIDProperty.h:124
SimplePropertyRef< DataObjID >::SimplePropertyRef
SimplePropertyRef(const std::string &name, DataObjID &value)
Definition: DataObjIDProperty.h:56
SimplePropertyRef< DataObjIDColl >::~SimplePropertyRef
virtual ~SimplePropertyRef()
virtual Destructor
Definition: DataObjIDProperty.h:137
StatusCode.h
ToStream.h
implementation of various functions for streaming.
DataObjIDCollProperty::value
const DataObjIDColl & value() const
Definition: DataObjIDProperty.h:172
DataObjIDCollProperty::assign
virtual bool assign(const Property &source)
import the property value form the source
Definition: DataObjIDProperty.h:165
DataObjIDCollProperty::DataObjIDCollProperty
DataObjIDCollProperty(const std::string &name, DataObjIDColl &ref)
Definition: DataObjIDProperty.cpp:227
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:107
Property::clone
virtual Property * clone() const =0
clone: "virtual constructor"
std::ostream
STL class.
Property::toStream
virtual void toStream(std::ostream &out) const =0
value -> stream
Property::fromString
virtual StatusCode fromString(const std::string &value)=0
string -> value