1#ifndef OPAL_SRefExpr_HH
2#define OPAL_SRefExpr_HH
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.");
Representation objects and parsers for attribute expressions.
A representation of an Object attribute.
Abstract base class for attribute values of different types.
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()
An expression defined as a reference to a scalar.
SRefExpr(const std::string &objName, const std::string &attName)
Constructor.
const std::string att_name
const std::string obj_name
const std::string getImage() const
virtual T evaluate() const
Evaluate.
virtual void print(std::ostream &os, int precedence=99) const
Print expression.
virtual Scalar< T > * clone() const
Make clone.
virtual void invalidate()
Invalidate.
void operator=(const SRefExpr &)
Object attribute with a constant scalar value.