1#ifndef OPAL_ARefExpr_HH
2#define OPAL_ARefExpr_HH
46 ARefExpr(
const std::string& objName,
const std::string& attName);
55 virtual std::vector<T>
evaluate()
const;
58 virtual void print(std::ostream& os,
int precedence = 99)
const;
84 : obj_name(objName), att_name(attName), itsObject(0), itsAttr(0) {}
90 obj_name(rhs.obj_name),
91 att_name(rhs.att_name),
92 itsObject(rhs.itsObject),
93 itsAttr(rhs.itsAttr) {}
97 if (itsObject) itsObject->unregisterReference(
this);
111 return value->evaluate();
113 return std::vector<T>(1, value->evaluate());
116 "ARefExpr::evaluate()",
117 "Reference \"" + getImage() +
"\" is not an array.");
120 return std::vector<T>();
126 std::ostringstream os;
135 if (!att_name.empty()) os <<
"->" << att_name;
140 if (itsObject == 0) {
142 if (itsObject == 0) {
143 throw OpalException(
"ARefExpr::fill()",
"Object \"" + obj_name +
"\" is unknown.");
148 itsObject->registerReference(
const_cast<ARefExpr<T>*
>(
this));
150 if (att_name.empty()) {
151 itsAttr = itsObject->findAttribute(
"VALUE");
155 "Object \"" + obj_name +
"\" is not a variable, constant or vector.");
158 itsAttr = itsObject->findAttribute(att_name);
162 "Attribute \"" + obj_name +
"->" + att_name +
"\" is unknown.");
Abstract base class for attribute values of different types.
A representation of an Object attribute.
An expression defined as a reference to an array.
const std::string getImage() const
virtual OArray< T > * clone() const
Make clone.
ARefExpr(const std::string &objName, const std::string &attName)
Constructor.
void operator=(const ARefExpr &)
const std::string obj_name
const std::string att_name
virtual std::vector< T > evaluate() const
Evaluate the reference and return the value referred to.
virtual void print(std::ostream &os, int precedence=99) const
Print expression.
Object attribute with a constant array value.
Object attribute with a constant scalar value.
Abstract base class for references which must be invalidated when an.
The base class for all OPAL objects.
Object * find(const std::string &name)
Find entry.
static OpalData * getInstance()
Representation objects and parsers for attribute expressions.