class
AttributeHandler
: public RCObject
(Return to index)
Abstract base class for attribute parsers.
An attribute parser defines the data type for an attribute. It is
used to parse and print the attribute, to read the attribute from
the DOOM data base, and to write it to that data base. It contains
contains the name and help text for the attribute, and sometimes a
default value for the attribute.
When ``is_readonly'' is true, the attribute cannot be redefined by
the user.
When ``is_deferred'' is true, the attribute must be re-evaluated
whenever it is used. This is the case for random error values.
When ``is_deferred'' is false, any expression for the attribute is
cached. It is re-evaluated only when any other definition has changed.
Type: |
Abstract |
Superclasses: |
public RCObject |
Include file: |
./AbstractObjects/AttributeHandler.hh |
Inheritance
Synopsis (including inherited members):
- Public members:
-
AttributeHandler
(const string&,const string&,AttributeBase*)
;
-
virtual ~AttributeHandler
()
;
-
virtual AttributeHandler* clone
()const
;
-
virtual void doomGet
(Attribute&,const DoomReader&,int)const
= 0
;
-
virtual void doomPut
(const Attribute&,DoomWriter&,int)const
= 0
;
-
virtual AttributeBase* getDefault
()const
;
-
virtual const string& getHelp
()const
;
-
virtual const string& getName
()const
;
-
virtual const string& getType
()const
= 0
;
-
virtual void parse
(Attribute&,Statement&,bool)const
= 0
;
-
virtual void parseComponent
(Attribute&,Statement&,bool,int)const
;
-
bool isDeferred
()const
;
-
void setDeferred
(bool)
;
-
bool isReadOnly
()const
;
-
void setReadOnly
(bool)
;
- Protected Members:
Documentation:
- Public members:
-
AttributeHandler
(const string&,const string&,AttributeBase*)
;
- Constructor.
Assigns the attribute name name and the help text help,
as well as a possible default value deffor the attribute.
-
virtual AttributeHandler* clone
()const
;
- Make clone.
Attribute handlers are always shared, so this method should never
be called. It exists only to fulfill the requirements of the class
Pointer.
-
virtual void doomGet
(Attribute&,const DoomReader&,int)const
= 0
;
- Read attribute from the DOOM data base.
Uses the DoomReader r for the object being read,
and the position i within this reader.
Called by Attribute::doomGet()
-
virtual void doomPut
(const Attribute&,DoomWriter&,int)const
= 0
;
- Write the attribute a to the DOOM data base.
Uses the DoomWriter w for the object being read,
and the position i within this writer.
Called by Attribute::doomPut()
-
virtual AttributeBase* getDefault
()const
;
- Return default value.
Return the default value stored in this parser.
-
virtual const string& getHelp
()const
;
- Return help string.
-
virtual const string& getName
()const
;
- Return attribute name.
-
virtual const string& getType
()const
= 0
;
- Return attribute type.
Return a string describing the attribute type
("logical", "real", etc.).
-
bool isDeferred
()const
;
- Return defer flag.
True, if any expression evaluation is to be deferred.
See Expressions::ADeferred and Expressions::SDeferred
for details.
-
bool isReadOnly
()const
;
- Return read-only flag.
If parse is called with this flag set,
then MadException is thrown.
-
virtual void parse
(Attribute&,Statement&,bool)const
= 0
;
- Parse new value.
Parse value from the statement s and assign it to the
attribute a.
-
virtual void parseComponent
(Attribute&,Statement&,bool,int)const
;
- Parse component value.
Parse value from the statement s and assign it to the
attribute a, indexed by i.
The default version assumes that the value is scalar,
and it throws MadException.
-
void setDeferred
(bool)
;
- Set or reset defer flag.
If the flag is set, expressions are evaluated only when the value
is fetched.
-
void setReadOnly
(bool)
;
- Set or reset read-only flag.
If parse is called with the flag set,
then MadException is thrown.
- Protected members:
-
bool is_deferred
;
- Defer flag.
-
bool is_readonly
;
- Read-only flag.
-
Pointer<AttributeBase> itsDefault
;
- Default value.
-
const string itsHelp
;
- Help text.
-
const string itsName
;
- Attribute name.
Documentation generated by fci on Mon Feb 7 12:29:45 2000