1 #ifndef OPAL_ADeferred_HH
2 #define OPAL_ADeferred_HH
54 explicit ADeferred(
const std::vector<T> &val);
74 virtual void print(std::ostream &)
const;
118 itsLaw(rhs.itsLaw->clone()),
119 itsOverrides(rhs.itsOverrides.size()),
120 in_evaluation(false) {
169 "Recursive expression definitions found.");
171 in_evaluation =
true;
174 if(itsLaw.isValid()) this->value = itsLaw->evaluate();
175 in_evaluation =
false;
176 if(this->value.size() < itsOverrides.size()) {
177 this->value.resize(itsOverrides.size());
181 if(itsOverrides[i].isValid()) {
182 this->value[i] = itsOverrides[i]->evaluate();
186 in_evaluation =
false;
188 "Evaluating expression \"" +
189 this->getImage() +
"\": " + ex.
what());
191 in_evaluation =
false;
193 "Evaluating expression \"" +
194 this->getImage() +
"\": " + ex.
what());
195 }
catch(std::exception &ex) {
196 in_evaluation =
false;
198 "Standard C++ exception while evaluating \"" +
199 this->getImage() +
"\": " + ex.
what());
201 in_evaluation =
false;
203 "Unknown exception while evaluating \"" +
204 this->getImage() +
"\": ");
214 return itsLaw.isValid() || (! itsOverrides.empty());
221 if(itsLaw.isValid()) itsLaw->print(os, 0);
224 if(! itsOverrides.empty()) {
225 os <<
"; overrides: {";
228 while(i != itsOverrides.end()) {
229 if(i->isValid())(*i)->print(os);
230 if(++i == itsOverrides.end())
break;
244 while(
int(itsOverrides.size()) < index) {
248 itsOverrides[index-1] = expr;
Representation objects and parsers for attribute expressions.
A pointer to a scalar expression.
An array of pointers to scalar expressions.
A pointer to an array expression.
The abstract base class for all exceptions in CLASSIC.
Object attribute with a `‘deferred’' array value.
void operator=(const ADeferred< T > &)
ArrayOfPtrs< T > itsOverrides
Overrides for single components.
virtual void print(std::ostream &) const
Print the attribute value.
virtual std::vector< T > evaluate()
Evaluate.
virtual bool isExpression() const
Get expression flag.
ADeferred()
Default constructor.
PtrToArray< T > itsLaw
The generating law for the array expression.
virtual ADeferred< T > * clone() const
Make clone.
void setComponent(int i, const PtrToScalar< T > expr)
Set a component of the value.
Object attribute with a constant array value.
The base class for all OPAL exceptions.
virtual const std::string & what() const
Return the message string for the exception.
virtual const std::string & where() const
Return the name of the method or function which detected the exception.