1 #ifndef OPAL_ARefBas_HH
2 #define OPAL_ARefAttr_HH
30 namespace Expressions {
52 ARefAttr(
const string &oName,
const string &aName);
62 virtual std::vector<T>
evaluate()
const;
73 virtual void print(std::ostream &)
const;
77 virtual void set(
const std::vector<T> &)
const;
102 inline std::ostream &operator<<(std::ostream &os, const ARefAttr<T> &a) {
113 obj_name(oName), att_name(aName), itsObject(0), itsAttr(0)
119 obj_name(rhs.obj_name), att_name(rhs.att_name),
120 itsObject(rhs.itsObject), itsAttr(rhs.itsAttr)
126 if(itsObject) itsObject->unregisterReference(
this);
142 return value->evaluate();
145 itsAttr->getName() +
"\" is of the wrong type.");
163 if(! att_name.empty()) os <<
"->" << att_name;
174 "Object \"" + obj_name +
"\" is unknown.");
179 itsObject->registerReference(
const_cast<ARefAttr<T>*
>(
this));
181 if(att_name.empty()) {
182 itsAttr = itsObject->findAttribute(
"VALUE");
184 throw OpalException(
"ARefAttr::fill()",
"Object \"" + obj_name +
185 "\" is not a variable, constant or vector.");
188 itsAttr = itsObject->findAttribute(att_name);
190 throw OpalException(
"ARefAttr::fill()",
"Attribute \"" + obj_name +
191 "->" + att_name +
"\" is unknown.");
201 "Attribute is not of real array type.");
220 itsAttr->getName() +
"\" is of the wrong type.");
227 #endif // OPAL_ARefAttr_HH
Abstract base class for attribute values of different types.
An attribute defined as a reference to an array.
The base class for all OPAL exceptions.
virtual void set(const std::vector< T > &) const
Store new value.
void print(int &len) const
Print attribute.
virtual vector< double > getRealArray()
Return real array value.
void operator=(const ARefAttr &)
static OpalData * getInstance()
virtual void invalidate()
Invalidate.
A representation of an Object attribute.
Object attribute with a ``deferred'' array value.
virtual std::vector< T > evaluate() const
Evaluate.
virtual ARefAttr< T > * clone() const
Make clone.
Object * find(const std::string &name)
Find entry.
The base class for all OPAL objects.
virtual void print(std::ostream &) const
Print the reference.
static const string typeName