1 #ifndef OPAL_SRefExpr_HH
2 #define OPAL_SRefExpr_HH
31 namespace Expressions {
48 SRefExpr(
const std::string &objName,
const std::string &attName);
64 virtual void print(std::ostream &os,
int precedence = 99)
const;
92 (
const std::string &objName,
const std::string &attName):
93 obj_name(objName), att_name(attName),
94 itsObject(0), itsAttr(0)
101 obj_name(rhs.obj_name), att_name(rhs.att_name),
102 itsObject(rhs.itsObject), itsAttr(rhs.itsAttr)
108 if(itsObject) itsObject->unregisterReference(
this);
124 return value->evaluate();
126 throw ParseError(
"SRefExpr::evaluate()",
"Reference \"" +
127 getImage() +
"\" is not a variable.");
137 std::ostringstream os;
154 if(! att_name.empty()) os <<
"->" << att_name;
164 if(att_name.empty()) {
166 "\nThe <variable> \"" + obj_name +
"\" is unknown.\n");
169 "Object \"" + obj_name +
"\" is unknown.");
175 itsObject->registerReference(
const_cast<SRefExpr<T>*
>(
this));
177 if(att_name.empty()) {
178 itsAttr = itsObject->findAttribute(
"VALUE");
180 throw ParseError(
"SRefExpr::fill()",
"Object \"" + obj_name +
181 "\" is not a variable, constant or vector.");
184 itsAttr = itsObject->findAttribute(att_name);
186 throw ParseError(
"SRefExpr::fill()",
"Attribute \"" + obj_name +
187 "->" + att_name +
"\" is unknown.");
195 #endif // OPAL_SRefExpr_HH
An expression defined as a reference to a scalar.
const std::string obj_name
Abstract base class for attribute values of different types.
void operator=(const SRefExpr &)
virtual void invalidate()
Invalidate.
static OpalData * getInstance()
const std::string att_name
const std::string getImage() const
A representation of an Object attribute.
Abstract base class for references which must be invalidated when an.
virtual T evaluate() const
Evaluate.
SRefExpr(const std::string &objName, const std::string &attName)
Constructor.
virtual void print(std::ostream &os, int precedence=99) const
Print expression.
virtual Scalar< T > * clone() const
Make clone.
Object * find(const std::string &name)
Find entry.
Object attribute with a constant scalar value.
The base class for all OPAL objects.