1 #ifndef OPAL_ARefExpr_HH
2 #define OPAL_ARefExpr_HH
32 namespace Expressions {
49 ARefExpr(
const std::string &objName,
const std::string &attName);
58 virtual std::vector<T>
evaluate()
const;
61 virtual void print(std::ostream &os,
int precedence = 99)
const;
89 (
const std::string &objName,
const std::string &attName):
90 obj_name(objName), att_name(attName),
91 itsObject(0), itsAttr(0)
98 obj_name(rhs.obj_name), att_name(rhs.att_name),
99 itsObject(rhs.itsObject), itsAttr(rhs.itsAttr)
105 if(itsObject) itsObject->unregisterReference(
this);
121 return value->evaluate();
123 return std::vector<T>(1, value->evaluate());
126 getImage() +
"\" is not an array.");
129 return std::vector<T>();
136 std::ostringstream os;
146 if(! att_name.empty()) os <<
"->" << att_name;
156 "Object \"" + obj_name +
"\" is unknown.");
161 itsObject->registerReference(
const_cast<ARefExpr<T>*
>(
this));
163 if(att_name.empty()) {
164 itsAttr = itsObject->findAttribute(
"VALUE");
166 throw OpalException(
"ARefExpr::fill()",
"Object \"" + obj_name +
167 "\" is not a variable, constant or vector.");
170 itsAttr = itsObject->findAttribute(att_name);
172 throw OpalException(
"ARefExpr::fill()",
"Attribute \"" + obj_name +
173 "->" + att_name +
"\" is unknown.");
181 #endif // OPAL_ARefExpr_HH
static OpalData * getInstance()
The base class for all OPAL objects.
ARefExpr(const std::string &objName, const std::string &attName)
Constructor.
Object attribute with a constant array value.
virtual void print(std::ostream &os, int precedence=99) const
Print expression.
const std::string getImage() const
The base class for all OPAL exceptions.
const std::string obj_name
Object attribute with a constant scalar value.
void operator=(const ARefExpr &)
Abstract base class for attribute values of different types.
Abstract base class for references which must be invalidated when an.
virtual std::vector< T > evaluate() const
Evaluate the reference and return the value referred to.
An expression defined as a reference to an array.
Object * find(const std::string &name)
Find entry.
virtual OArray< T > * clone() const
Make clone.
const std::string att_name
A representation of an Object attribute.