1#ifndef OPAL_SRefExpr_HH
2#define OPAL_SRefExpr_HH
45 SRefExpr(
const std::string& objName,
const std::string& attName);
61 virtual void print(std::ostream& os,
int precedence = 99)
const;
87 : obj_name(objName), att_name(attName), itsObject(0), itsAttr(0) {}
93 obj_name(rhs.obj_name),
94 att_name(rhs.att_name),
95 itsObject(rhs.itsObject),
96 itsAttr(rhs.itsAttr) {}
100 if (itsObject) itsObject->unregisterReference(
this);
114 return value->evaluate();
117 "SRefExpr::evaluate()",
118 "Reference \"" + getImage() +
"\" is not a variable.");
127 std::ostringstream os;
142 if (!att_name.empty()) os <<
"->" << att_name;
148 if (itsObject == 0) {
150 if (itsObject == 0) {
151 if (att_name.empty()) {
154 "\nThe <variable> \"" + obj_name +
"\" is unknown.\n");
156 throw ParseError(
"SRefExpr::fill()",
"Object \"" + obj_name +
"\" is unknown.");
162 itsObject->registerReference(
const_cast<SRefExpr<T>*
>(
this));
164 if (att_name.empty()) {
165 itsAttr = itsObject->findAttribute(
"VALUE");
169 "Object \"" + obj_name +
"\" is not a variable, constant or vector.");
172 itsAttr = itsObject->findAttribute(att_name);
176 "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 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.
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.