class BlockNode : public ASTnode

A single block in the file - this can be either a data block or a global block - they are both handled the same way

Inheritance:


Public Fields

protected : DataListNode* myDataList
HeadingNode* myHeading

Public Methods

StarFileNode::Status AddSaveFrame (const string & name)
DEPRECIATED - use STL vector insert() on the list returned by GiveMyDataList instead
StarFileNode::Status AddSaveFrameDataItem ( const string & name, const string & value, DataValueNode::ValType type)
DEPRECIATED - use STL vector insert() on the list returned by GiveMyDataList instead
StarFileNode::Status AddSaveFrameLoop ()
DEPRECIATED - use STL vector insert() on the list returned by GiveMyDataList instead
StarFileNode::Status AddSaveFrameLoopDataName (const string & name)
DEPRECIATED - use STL vector insert() on the list returned by GiveMyDataList instead
StarFileNode::Status AddSaveFrameLoopDataValue ( const string & value, DataValueNode::ValType type )
DEPRECIATED - use STL vector insert() on the list returned by GiveMyDataList instead
void AddSaveFrameToDataBlock (DataNode* newNode)
DEPRECIATED - use STL vector insert() on the list returned by GiveMyDataList instead
ASTlist <DataNode*> * GiveMyDataList (void)
Return the list of data nodes that reside inside this block node: This list is a vector and can be used like the STL vector to add/delete/iterate over the the things in the block
virtual bool isOfType ( ASTtype T )
virtual int myLongestStr ( void )
Returns the length of the longest string in this object
string myName () const
Return the label of this block node, eg "data_foo" :
virtual ASTnode::ASTtype myType (void)
void RemoveSaveFrame (string saveframeName)
DEPRECIATED - use STL vector erase() on the list returned by GiveMyDataList instead
DataNode* ReturnDataBlockDataNode (string saveframeName)
Return the data node matching the name given (A save frame, data item, or loop)
virtual List <ASTnode*> * searchByTag ( string &searchFor)
Given a tag name, find the AST object it resides in
virtual List <ASTnode*> * searchByTagValue ( string &tag, string &value )
Given a tag name and a value, find the AST object that that particular tag and value pair resides in
virtual List <ASTnode*> * searchForType ( ASTtype type, int delim = -1 )
This method returns a list of all the nodes of the given type that are inside this node, or children of this node, or children of children of this node, etc all the way down to the leaf nodes
virtual bool unlinkChild ( ASTnode *child )
unlinks the given ASTnode from this ASTnode, assuming that the given ASTnode is a child of this ASTnode
virtual void Unparse (int indent)
virtual ~BlockNode ()
Destructor. This will destruct everything inside the block as well.

Public



Constructors:
BlockNode (HeadingNode *h, DataListNode *n)
BlockNode (const string & name)
give the name to call the block.
BlockNode ( BlockNode &n )
deep copy constructor
BlockNode ( bool link, BlockNode &n )
for more details on parallel copies.

Inherited from ASTnode:

Public Classes

enum ASTtype
ASTNODE
BLOCKNODE
DATABLOCKNODE
DATAFILENODE
DATAHEADINGNODE
DATAITEMNODE
DATALISTNODE
DATALOOPNAMELISTNODE
DATALOOPDEFLISTNODE
DEPRECIATED - Do not use:
DATALOOPNODE
DATALOOPVALLISTNODE
DATANAMENODE
DATANODE
DATAVALUENODE
GLOBALBLOCKNODE
GLOBALHEADINGNODE
HEADINGNODE
LOOPROWNODE
ITERNODE
DEPRECIATED - Do not use:
LOOPNAMELISTNODE
LOOPDEFLISTNODE
DEPRECIATED - Do not use:
LOOPTABLENODE
LOOPITER
DEPRECIATED - Do not use:
LOOPVALLISTNODE
DEPRECIATED - Do not use:
SAVEFRAMELISTNODE
SAVEFRAMENODE
SAVEHEADINGNODE
STARLISTNODE
STARFILENODE

Public Methods

virtual void copyFrom( const ASTnode ©FromMe )
virtual ASTnode* myParent(void)
bool NotVirtualIsOfType( ASTtype T )
virtual bool removeChild( ASTnode *child )
virtual bool removeMe( void )
virtual void setParent( ASTnode *p )
virtual size_t sizeOfMe(void)
virtual bool unlinkMe( void )

Documentation

A single block in the file - this can be either a data block or a global block - they are both handled the same way

Constructors:

BlockNode(HeadingNode *h, DataListNode *n)

BlockNode(const string & name)
give the name to call the block.

BlockNode( BlockNode &n )
deep copy constructor

BlockNode( bool link, BlockNode &n )
for more details on parallel copies.

virtual ~BlockNode()
Destructor. This will destruct everything inside the block as well.

virtual ASTnode::ASTtype myType(void)

virtual bool isOfType( ASTtype T )

ASTlist <DataNode*> * GiveMyDataList(void)
Return the list of data nodes that reside inside this block node: This list is a vector and can be used like the STL vector to add/delete/iterate over the the things in the block

string myName() const
Return the label of this block node, eg "data_foo" :

DataNode* ReturnDataBlockDataNode(string saveframeName)
Return the data node matching the name given (A save frame, data item, or loop)

void RemoveSaveFrame(string saveframeName)
DEPRECIATED - use STL vector erase() on the list returned by GiveMyDataList instead.
Remove the data item matching the name given (usually a save frame).
See Also:
GiveMyDataList

void AddSaveFrameToDataBlock(DataNode* newNode)
DEPRECIATED - use STL vector insert() on the list returned by GiveMyDataList instead.
Attach the given data node (usually a save frame) to the AST. Note that it just makes a link to the object, not a copy. Do not delete the object after calling this.
See Also:
GiveMyDataList

virtual void Unparse(int indent)

StarFileNode::Status AddSaveFrame(const string & name)
DEPRECIATED - use STL vector insert() on the list returned by GiveMyDataList instead.
Add an empty save frame to the end of the block, using the name given:
See Also:
GiveMyDataList

StarFileNode::Status AddSaveFrameDataItem( const string & name, const string & value, DataValueNode::ValType type)
DEPRECIATED - use STL vector insert() on the list returned by GiveMyDataList instead.
Add a new item (tag/value pair) to the block in the last saveframe of he block. If the last thing in the block is not a save frame, returns ERROR
See Also:
GiveMyDataList

StarFileNode::Status AddSaveFrameLoop()
DEPRECIATED - use STL vector insert() on the list returned by GiveMyDataList instead.
Add a new empty loop to the last saveframe in the block. Returns ERROR if the last thing in the block is not a save frame. Note that no name is given, because the name of a loop is derived from its first tag name - and an empty loop has no first tag.
See Also:
GiveMyDataList

StarFileNode::Status AddSaveFrameLoopDataName(const string & name)
DEPRECIATED - use STL vector insert() on the list returned by GiveMyDataList instead.
Add a tag name to the last loop of the last save frame in the block. Returns ERROR if the last thing in the block is not a save frame, or if the last thing in the save frame is not a loop.
See Also:
GiveMyDataList

StarFileNode::Status AddSaveFrameLoopDataValue( const string & value, DataValueNode::ValType type )
DEPRECIATED - use STL vector insert() on the list returned by GiveMyDataList instead.
Add a value to the last loop of the last save frame in the block. Returns ERROR if the last thing in the block is not a save frame, or if the last thing in the save frame is not a loop.
See Also:
GiveMyDataList

virtual List <ASTnode*> * searchByTag( string &searchFor)
Given a tag name, find the AST object it resides in. It returns a pointer to the lowest level AST object that the tag resides in. 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.

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.

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.

Parameters:
searchFor - Look for this string as the tag name.

virtual List <ASTnode*> * searchForType( ASTtype type, int delim = -1 )
This method returns a list of all the nodes of the given type that are inside this node, or children of this node, or children of children of this node, etc all the way down to the leaf nodes.
Parameters:
type - type to search for
delim - the delimiter type if searching for a DataValueNode. The default is "dont-care".

virtual List <ASTnode*> * searchByTagValue( string &tag, string &value )
Given a tag name and a value, find the AST object that that particular tag and value pair resides in. This is like performing an SQL search: WHERE tag = value.

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.

Parameters:
tag - Look for this tag name...
value - Where it has this value

virtual bool unlinkChild( ASTnode *child )
unlinks the given ASTnode from this ASTnode, assuming that the given ASTnode is a child of this ASTnode. Does NOT call the destructor of the child node!! Use this function to remove the child from this ASTnode but not free it's space. RETURNS: true if the child was unlinked. false if the given ASTnode was not even in this class anywhere, and therefore nothing was done. This function MUST be overridden for each subclass of ASTnode.

protected : DataListNode* myDataList

HeadingNode* myHeading

virtual int myLongestStr( void )
Returns the length of the longest string in this object. Used by Unparse() at various levels of the AST tree. In this case it just returns the longest of the heading node or the data list node:


Direct child classes:
GlobalBlockNode
DataBlockNode

alphabetic index hierarchy of classes


Starlib is a creation of BioMagResBank: bmrb.wisc.edu starlib banner

generated by doc++