class ASTnode |
ASTnode class (base class for all other kinds of nodes).
| ASTnode ( const ASTnode ©FromMe ) The copy constructor: | |
| ASTnode ( void ) Sets the parent pointer to be null by default | |
| NotVirtualIsOfType ( ASTtype T ) This function should always be identical to isOfType except that it is not a virtual function. | |
| Unparse (int indent) Every subtype must provide an unparse operation that outputs the node to a global output stream called "os". | |
| copyFrom ( const ASTnode ©FromMe ) The routine that copies low-level values from one ASTnode to another - used by the copy constructor | |
| isOfType ( ASTtype T ) Call this function when you want to know whether or not a particular ASTnode object is of a certain type | |
| myParent (void) Return the parent of this ASTnode. | |
| myType (void) Return the type of this ASTnode. | |
| removeChild ( ASTnode* child ) Removes the given ASTnode from this ASTnode, assuming that the given ASTnode is an immediate child of this ASTnode. | |
| removeMe ( void ) Remove me from my parent ASTnode by calling my parent's removeChild() on me. | |
| searchByTag ( string &searchFor) Given a tag name, find the AST object it resides in. | |
| searchByTag ( char* searchFor) Overloaded Version Just calls the above version of this function. | |
| searchForType ( ASTtype type, int delim = -1) This method returns a list of all the nodes of the given type. | |
| setParent ( ASTnode* p ) Set the parent of this node to a new value. | |
| unlinkChild ( ASTnode* child ) unlinks the given ASTnode from this ASTnode, assuming that the given ASTnode is a child of this ASTnode. | |
| unlinkMe ( void ) Remove me from my parent ASTnode, but do not delete me from the universe. | |
| ~ASTnode ( void ) The destructor: |
| | |
| ASTtype Whenever a new class derived from ASTnode is added to asth, it needs to have a name for it added to this enumerated type |
| printIndent (int indent) |
ASTnode class (base class for all other kinds of nodes). -------------------------------------------------------- This class defines nothing but the Unparse function, which all AST types must have. When the root of the AST tree has its Unparse() function called, it will cause a percolation through all the Unparse() functions of all the nodes in the tree.
Unparse simply writes the tree out in star format to a file. The file is hardcoded to be the stream called (*os).
This search is case-insensitive. The names of things, according to the STAR specification, are supposed to be case-insensitive. This is being applied not only to tag names but also to saveframe names and datablock names.
The caller of this function needs to use the isOfType() and/or myType() methods to determine what type to cst the object. Returns a NULL if nothing was found.
The second parameter is optional and is only useful when you are searching for DATAVALUENODEs. It determines the kind of DATAVALUENODE you are searching for, by delimiter type. For example, you could search for only those DATAVALUENODEs that are semicolon-delimited by passing DataValueNode::SEMICOLON as the second argument. Or you could look for just framecodes by passing DataValueNode::FRAMECODE as the second parameter. Passing a negative number says you want all the DataValueNodes, regardless of their delimiter type.
Although the second parameter is an integer, think of it as the enum DataValueNode::ValType. The only reason it is shown as an integer in the prototype here is that this class (ASTnode) needs to be defined before the class "DataValueNode" can be defined, and thus at this point the compiler has no clue what "DataValueNode::ValType" means yet.
If the search is for some ASTtype other than DATAVALUENODE, then it is irrelevant what the second parameter of this function is, as it will never be used - You can just leave it off and accept the default.
This function MUST be overridden for each subclass of ASTnode.
The string must contain the comment characters embedded inside, like so: "# this is a\n# multiline comment.", not like this: "this is a\nmultiline comment." This is so that the caller is allowed to have the comment contain blank lines like this:
* # This is an example comment. * * # The comment has some blank * * # lines in it. *If the Unparse() function were designed to insert the comment characters (#) itself, then such a comment block would be impossible to create.
Note that the comment lines are not syntax-checked in any way, so using these functions it is entirely possible to create invalid STAR files, since these "comments" can really be strings with anything at all in them - so be careful.
To get rid of the preComment if you change your mind, set it to a zero-length string with setPreComment().
These functions start counting at 1, not zero.
These functions actually give the location where the particular part of speech ENDED, not where it started. For example, with a DataLoopNode, the location given is the location of the closing "stop_" keyword, not the opening "loop_" keyword. This is an unfortunate neccessity due to the way the parser reads the data. It doesn't know whether or not it has encountered a complete grammatical construct until it reaches the end of the construct, at which point it has lost track of what the location was at the start of the grammatical construct.
These functions start counting at 1, not zero.
These functions actually give the location where the particular part of speech ENDED, not where it started. For example, with a DataLoopNode, the location given is the location of the closing "stop_" keyword, not the opening "loop_" keyword. This is an unfortunate neccessity due to the way the parser reads the data. It doesn't know whether or not it has encountered a complete grammatical construct until it reaches the end of the construct, at which point it has lost track of what the location was at the start of the grammatical construct.
WARNING: The list returned is allocated in heap space. It is the caller's responsibility to delete the list after it is no longer needed.
YOU NEVER NEED TO OVERRIDE THESE FUNCTIONS IN ANY OF THE SUBCLASSES OF ASTNODE! THEY OPERATE THE SAME WAY IN ALL THE SUBCLASSES. THEY MAKE ALL THEIR CALLS THROUGH THE EXISTING searchByTag() calls.
This search is case-insensitive. The names of things, according to the STAR specification, are supposed to be case-insensitive. This is being applied not only to tag names but also to saveframe names and datablock names.
(However, the values are case-sensitive. A search for a tag of _t1 is identical to a search for a tag of _T1, but a search for a value of "V1" is different from a search for a value of "v1".)
YOU NEVER NEED TO OVERRIDE THESE FUNCTIONS IN ANY OF THE SUBCLASSES OF ASTNODE! THEY OPERATE THE SAME WAY IN ALL THE SUBCLASSES. THEY MAKE ALL THEIR CALLS THROUGH THE EXISTING searchByTag() calls.
Only searches starting at the node it was called from, and its children. Recurses downward, but does not recurse upward. This function is only capable of returning one answer, so it cannot be called at the same levels where searchByTag() can be called (see above).
This search is case-insensitive. The names of things, according to the STAR specification, are supposed to be case-insensitive. This is being applied not only to tag names but also to saveframe names and datablock names.
(However, the values are case-sensitive. A search for a tag of _t1 is identical to a search for a tag of _T1, but a search for a value of "V1" is different from a search for a value of "v1".)
WARNING: The list returned is allocated in heap space. It is the caller's responsibility to delete the list after it is no longer needed.
WARNING: The list returned is allocated in heap space. It is the caller's responsibility to delete the list after it is no longer needed.
Alphabetic index HTML hierarchy of classes or Java