45 i != references.end(); ++i) {
69 i != itsAttr.end(); ++i) {
70 if(i->getName() ==
name)
return &(*i);
78 for(vector<Attribute>::const_iterator i = itsAttr.begin();
79 i != itsAttr.end(); ++i) {
80 if(i->getName() ==
name)
return &(*i);
89 throw ParseError(
"Object::makeTemplate()",
"Object \"" + name +
90 "\" cannot be used to define a macro.");
95 throw ParseError(
"Object::makeInstance()",
"Object \"" + getOpalName() +
96 "\" cannot be called as a macro.");
104 if(
Attribute *attr = findAttribute(name)) {
110 attr->parseComponent(stat,
true, index);
112 attr->parseComponent(stat,
false, index);
115 "Delimiter \"=\" or \":=\" expected.");
118 attr->parse(stat,
true);
120 attr->parse(stat,
false);
125 throw ParseError(
"Object::parse()",
"Object \"" + getOpalName() +
126 "\" has no attribute \"" + name +
"\".");
138 if(stat.
word(name)) {
140 if(
Attribute *attr = findAttribute(name)) {
141 attr->parse(stat,
true);
144 throw ParseError(
"Object::parse()",
"Object \"" + getOpalName() +
145 "\" has no attribute \"" + name +
"\".");
148 if(
Attribute *attr = findAttribute(name)) {
149 attr->parse(stat,
false);
152 throw ParseError(
"Object::parse()",
"Object \"" + getOpalName() +
153 "\" has no attribute \"" + name +
"\".");
159 itsAttr[0].parse(stat,
false);
165 string head = getOpalName();
166 Object *parent = getParent();
167 if(parent != 0 && ! parent->
getOpalName().empty()) {
168 if(! getOpalName().empty()) head +=
':';
173 int pos = head.length();
175 for(vector<Attribute>::const_iterator i = itsAttr.begin();
176 i != itsAttr.end(); ++i) {
177 if(*i) i->print(pos);
186 references.insert(ref);
191 references.erase(ref);
195 if (getParent() != 0)
return;
197 const unsigned int end = itsAttr.size();
198 const std::string name = getOpalName();
199 for (
unsigned int i = 0; i < end; ++ i) {
207 if(itsAttr.size() > 0) {
210 size_t maxLength = 16;
211 vector<Attribute>::const_iterator it;
212 for (it = itsAttr.begin(); it != itsAttr.end(); ++ it) {
213 string name = it->getName();
214 maxLength =
std::max(maxLength, name.length() + 1);
217 for (it = itsAttr.begin(); it != itsAttr.end(); ++ it) {
218 string type = it->getType();
219 string name = it->getName();
220 *
gmsg <<
'\t' << type << string(16 - type.length(),
' ');
221 *
gmsg << name << string(maxLength - name.length(),
' ');
222 *
gmsg << it->getHelp();
223 if(it->isReadOnly()) *
gmsg <<
" (read only)";
278 const Object *base =
this;
295 const Object *
object =
this;
297 while(
object != 0 &&
object != classObject) {
331 RCObject(), itsAttr(size), itsParent(0),
332 itsName(name), itsHelp(help), occurrence(0), sharedFlag(false) {
343 RCObject(), itsAttr(parent->itsAttr), itsParent(parent),
344 itsName(name), itsHelp(parent->itsHelp), occurrence(0), sharedFlag(false) {
virtual void print(std::ostream &) const
Print the object.
double Round(double value)
Round the double argument.
bool isFlagged() const
True, if [b]this[/b] is flagged by setFlag(true).
std::ostream & operator<<(std::ostream &os, const Attribute &attr)
void setParent(Object *)
Set parent object.
virtual bool isShared() const
Shared flag.
double parseRealConst(Statement &)
Parse real constant.
virtual void parseShortcut(Statement &)
Parser for single-attribute commands.
void copyAttributes(const Object &)
Copy attributes from another object.
virtual void setShared(bool)
Set/reset shared flag.
void mark()
Mark position in command.
bool isDirty() const
True, if the [b]modified[/b] flag is set.
bool isBuiltin() const
True, if [b]this[/b] is a built-in object.
Abstract interface for a stream of input tokens.
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
virtual Attribute * findAttribute(const std::string &name)
Find an attribute by name.
virtual Object * makeTemplate(const std::string &, TokenStream &, Statement &)
Macro handler function.
Object * getParent() const
Return parent pointer.
void setDirty(bool)
Set/reset the [b]modified[/b] flag.
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
virtual void execute()
Execute the command.
void restore()
Return to marked position.
static void addAttributeOwner(const std::string &owner, const OwnerType &type, const std::string &name)
virtual void replace(Object *oldObject, Object *newObject)
Replace references.
void parseDelimiter(Statement &stat, char delim)
Test for one-character delimiter.
Interface for abstract language parser.
bool word(std::string &value)
Return word value.
const Object * getBaseObject() const
Return the object's base type object.
const std::string & getOpalName() const
Return object name.
A representation of an Object attribute.
Interface for statements.
Abstract base class for references which must be invalidated when an.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
Abstract base class for reference counted objects.
virtual void printHelp(std::ostream &) const
Print help.
virtual Object * makeInstance(const std::string &name, Statement &, const Parser *)
Macro handler function.
virtual void update()
Update this object.
void unregisterReference(Invalidator *a)
Unegister a reference to this object.
The base class for all OPAL objects.
int increment()
Increment and return the occurrence counter.
void clear()
Clear the occurrence counter.
void setOpalName(const std::string &name)
Set object name.
void registerReference(Invalidator *a)
Register a reference to this object.
int occurrenceCount()
Return the occurrence counter.
bool builtin
Built-in flag.
std::string::iterator iterator
virtual void parse(Statement &)
Parse the object.
bool isTreeMember(const Object *subTree) const
Test for tree membership.
std::string parseString(Statement &, const char msg[])
Parse string value.
bool delimiter(char c)
Test for delimiter.
void setFlag(bool)
Flag/unflag this object, e. g. to control output of objects for.
Inform & endl(Inform &inf)
virtual bool canReplaceBy(Object *object)
Test if replacement is allowed.