class
Object
: public RCObject
(Return to index)
The base class for all MAD objects.
Any MAD object which may be generated by parsing a command or
definition.
All known Objects are referred to via Pointer<Object> to
make memory management easy.
Objects are linked by name to the MAD directory, which resides in
the global object MadData. Each Object has a pointer pointing
to its parent object. This may be an exemplar object, or a previously
generated command or definition object. This mechanism allows to find
easily whether an Object belongs to a given class (see isTreeMember()).
The class Object has as base class the abstract class RCObject.
Type: |
Abstract |
Superclasses: |
public RCObject |
Include file: |
./AbstractObjects/Object.hh |
Inheritance
Synopsis (including inherited members):
- Public members:
- Protected Members:
Documentation:
- Public members:
-
virtual bool canReplaceBy
(Object*)
;
- Test if replacement is allowed.
By default redefinition of an existing Object is not allowed.
-
void clear
()
;
- Clear the occurrence counter.
-
virtual Object* clone
(const string&)
= 0
;
- Return a clone.
Call the clone constructor to generate a copy of this
with a new name name.
-
void copyAttributes
(const Object&)
;
- Copy attributes from another object.
-
virtual void doomGet
(const DoomReader&)
;
- Read an Object from the DOOM data base.
-
virtual void doomPut
(DoomWriter&)const
;
- Write an Object to the DOOM data base.
-
virtual void execute
()
;
- Execute the command.
For definitions check validity, for actions execute the action.
-
virtual Attribute* findAttribute
(const string&)
;
- Find an attribute by name.
Find the Object's attribute identified by name
(version for non-constant object).
-
virtual const Attribute* findAttribute
(const string&)const
;
- Find an attribute by name.
Find the Object's attribute identified by name
(version for constant object).
-
const Object* getBaseObject
()const
;
- Return the object's base type object.
Return the top-most ancestor of this object, i. e. the built-in
object from which this is ultimately derived.
-
virtual const string getCategory
()const
= 0
;
- Return the object category as a string.
Is overridden by the (still abstract) sub-classes of Object.
-
double getDoomTime
()const
;
- Return the time stamp stored by setDoomTime().
-
const string& getMadName
()const
;
- Return object name.
-
Object* getParent
()const
;
- Return parent pointer.
-
int increment
()
;
- Increment and return the occurrence counter.
-
bool isBuiltin
()const
;
- True, if this is a built-in object.
-
bool isDirty
()const
;
- True, if the modified flag is set.
-
bool isFlagged
()const
;
- True, if this is flagged by setFlag(true).
-
virtual bool isShared
()const
;
- Shared flag.
If true, this object cannot be cloned to create new elements.
If it is an element or a line, all references are to the same object.
-
bool isTreeMember
(const Object*)const
;
- Test for tree membership.
Return true, if this has been directly or indirectly derived
from subTree.
-
std::vector<Attribute> itsAttr
;
- The object attributes (see Attribute.hh).
-
virtual Object* makeInstance
(const string&,Statement&)
;
- Macro handler function.
Construct an instance object from an ``archetype'' object.
The default version throws MadException.
-
virtual Object* makeTemplate
(const string&,TokenStream&,Statement&)
;
- Macro handler function.
Construct an ``archetype'' object for a MACRO commands.
The default version throws MadException.
-
int occurrenceCount
()
;
- Return the occurrence counter.
-
virtual void parse
(Statement&)
;
- Parse the object.
Parse the statement and fill in the Object's attributes.
-
virtual void parseShortcut
(Statement&)
;
- Parser for single-attribute commands.
This parser allows to use unnamed attributes for command which
have only one attribute.
-
virtual void print
(std::ostream&)const
;
- Print the object.
Print a MAD-readable image of this on the given output stream.
-
virtual void printHelp
(std::ostream&)const
;
- Print help.
Print help information for this on the given output stream.
-
void registerReference
(AttributeBase*)
;
- Register a reference to this object.
Place a in the list of references. Whenever this
is erased or modified, a will be notified of the change.
-
virtual void replace
(Object*,Object*)
;
- Replace references.
Called for all defined objects, when an object oldObject is
replaced by a new definition newObject.
This default version does nothing.
Some derived classes may react to the redefinition by invalidating
themselves or by replacing reference inside their data.
-
void setDirty
(bool)
;
- Set/reset the modified flag.
Set the flag when an object is created and modified,
reset it when the object is saved in the DOOM data base.
-
void setDoomTime
(double)
;
- Store the time stamp read from the DOOM data base.
-
void setFlag
(bool)
;
- Flag/unflag this object, e. g. to control output of objects for
flagged objects only.
-
void setMadName
(const string&)
;
- Set object name.
-
void setParent
(Object*)
;
- Set parent object.
This method should normally be called only from Directory.
-
virtual void setShared
(bool)
;
- Set/reset shared flag.
If true, this object cannot be cloned to create new elements.
If it is an element or a line, all references are to the same object.
-
virtual bool shouldTrace
()const
= 0
;
- Trace flag.
If true, the object's execute() function should be traced.
-
virtual bool shouldUpdate
()const
= 0
;
- Update flag.
If true, the data structure should be updated before calling execute().
-
void unregisterReference
(AttributeBase*)
;
- Unegister a reference to this object.
Remove a from the list of references. The object a
will no longer be notified of any change to this.
-
virtual void update
()
;
- Update this object.
Called for all defined objects, before an action command is executed.
This default version does nothing.
Derived classes may use this call to update their internal state.
The beam line elements can update their CLASSIC counterpart.
- Protected members:
-
Object
(int,const char*,const char*)
;
- Constructor for exemplars.
The exemplar object will have the name name, and the help
text help; it initially reserves size attributes.
-
Object
(const string&,Object*)
;
- Constructor for clones.
The clone object will have the name name; it inherits its
attributes (shared) from the object *parent.
-
bool builtin
;
- Built-in flag.
True, if the object is built-in to MAD-9, i. e. if it is an exemplar
or a predefined definition.
-
bool flagged
;
- Object flag.
This flag can be freely set and reset during the execution of a command.
-
bool modified
;
- Dirty flag.
True when this is new or modified and should be saved in the
DOOM data base.
Documentation generated by fci on Mon Feb 7 12:30:04 2000