class LoopTableNode : public ASTnode, private ASTnodeWithPosBits

A LoopTableNode is a table of rows in a DataLoopNode

Inheritance:


Public Fields

private : ASTlist <LoopRowNode *> myIters
int rowsPerLine

Public Methods

void addValue (const DataLoopNameListNode::Status dstat, const int row, const int currRow, DVNWithPos *value)
DEPRECIATED - use the STL vector operations instead.
void FlattenNestedLoop (List<DataValueNode*>* M)
DEPRECIATED - use the STL vector operations instead.
void flushValCache ( void )
Flush the cache that builds up when values in this loop have been examined
StarFileNode::Status LoopTableNode::RemoveColumnValues ( int nest, int ele )
DEPRECIATED - use the STL vector operations instead
virtual int myLongestStr ( void )
Returns the length of the longest string in this object
void reset ()
DEPRECIATED - use the STL vector operations instead.
ASTlist <DataValueNode *> * returnLoopValues (unsigned position)
DEPRECIATED - use the STL vector operations instead.
DataLoopValListNode::Status returnNextLoopElement (DataValueNode* & v)
DEPRECIATED - use the STL vector operations instead.
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

Protected Methods

virtual void calcPrintSizes ( List **presizes, List **postsizes )

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 bool isOfType( ASTtype T )
virtual ASTnode* myParent(void)
virtual ASTtype myType(void)
bool NotVirtualIsOfType( ASTtype T )
virtual bool removeChild( ASTnode *child )
virtual bool removeMe( void )
virtual List <ASTnode*> * searchByTag( string &searchFor)
virtual List <ASTnode*> * searchByTag( char *searchFor)
virtual void setParent( ASTnode *p )
virtual bool unlinkMe( void )
virtual void Unparse(int indent)

Public

virtual ASTnode* myParallelCopy( void )
void setPeer( ASTnode *)
This method returns a pointer to an ASTnode
const string& getPreComment( void )
void setPreComment( const string &cmt )
These functions are used to give each node in the AST tree the ability to remember a comment to be pasted into the file in front of that node
virtual List <ASTnode*> * searchForTypeByTag( ASTtype type, string &tag)
Overloaded Version
virtual List <ASTnode*> * searchForTypeByTag( ASTtype type, char *tag)
Overloaded Version
This method is exactly the same as 'searchByTag()', except that it tries to return an object of the type given
virtual List <ASTnode*> * searchForTypeByTagValue( ASTtype type, string &tag, string &value)
Overloaded Version
virtual List <ASTnode*> * searchForTypeByTagValue( ASTtype type, string &tag, char *value )
Overloaded Version Just calls the above version of this function
virtual List <ASTnode*> * searchForTypeByTagValue( ASTtype type, char *tag, string &value)
Overloaded Version Just calls the above version of this function
virtual List <ASTnode*> * searchForTypeByTagValue( ASTtype type, char *tag, char *value )
Overloaded Version Just calls the above version of this function
This method is exactly like 'searchByTag()', except that it tries to return an object of the type given
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*> * searchByTagValue( string &tag, char *value)
Overloaded Version Just calls the above version of this function
virtual List <ASTnode*> * searchByTagValue( char *tag, string &value)
Overloaded Version Just calls the above version of this function
virtual List <ASTnode*> * searchByTagValue( char *tag, char *value)
Overloaded Version Just calls the above version of this function
virtual int getLineNum( void ) const
virtual void setLineNum( const int num )
These functions return the line number and set the line number on which this node was found in the STAR file
virtual int getColNum( void ) const
virtual void setColNum( const int num )
These functions return the column number and set the column number on which this node was found in the STAR file

Inherited from ASTnodeWithPosBits:


Documentation

A LoopTableNode is a table of rows in a DataLoopNode.

You can think of a loop in a STAR file as being a table of values, with each iteration of the loop being a row on the table. This is the view taken by the starlib. Things are further complicated by the fact that each row of the table can have another table under it (another nesting level), but even then, those tables are the same structure as the outermost one.

Thus, this class, LoopTableNode, stores a table at some arbitrary nesting level in the loop. A simple singly nested loop will have only one loop table node, but a multiply nested loop will have a whole tree of loop tables.

These types are used with the STL vector look-alike functions:

typedef LoopRowNode* value_type

typedef value_type* pointer

typedef const value_type* const_pointer

typedef value_type& reference

typedef const value_type& const_reference

typedef size_t size_type

typedef size_t difference_type

ASTlist <LoopRowNode*> ::iterator vIter

iterator()

iterator( const ASTlist<LoopRowNode*>::iterator ©Me )

~iterator()

bool operator==( const iterator &x ) const

bool operator!=( const iterator &x ) const

reference operator*() const

value_type operator->() const

iterator& operator++()

iterator& operator++(int)

iterator& operator--()

iterator& operator--(int)

iterator& operator+=(size_type n)

iterator& operator-=(size_type n)

ASTlist <LoopRowNode*> ::const_iterator vIter

const_iterator()

const_iterator( const ASTlist<LoopRowNode*>::const_iterator ©Me )

~const_iterator()

bool operator==( const iterator &x ) const

bool operator!=( const iterator &x ) const

const_reference operator*() const

const value_type operator->() const

const_iterator& operator++()

const_iterator& operator++(int)

const_iterator& operator--()

const_iterator& operator--(int)

const_iterator& operator+=(size_type n)

const_iterator& operator-=(size_type n)

iterator iteratorFor( const LoopRowNode *ptr )
Convert from a pointer-to-LoopRowNode into an iterator for this LoopTableNode class. This is an operation that takes linear time, so use it with care. If the object refered to is not here, then the end iterator is returned.

Insertions/Deletions. These cannot be done in exactly the same syntax as vector<> because we need to check for things that are illegal in STAR and disallow them. However, it should look quite familiar to someone who is fluent in the STL vector class.

bool insert( iterator pos, vector<DataValueNode*> &v, const bool tflag )
Insert - Insert before 'pos', the row of data given by
'v'.  Returns true if it worked or false otherwise.
(Will fail if the number of values does not match
what is in the loop's tagname list.)
(This function makes a copy of the passed vector, it does not use the passed vector itself (in other words, you can delete it after calling (and the DataValueNodes it points to).

bool insert( iterator pos, LoopRowNode &v )
Insert - Insert before 'pos', the LoopRowNode given.  If the
LoopRowNode given has the wrong number of values, it
will fail and return false, else it returns true.
(This function makes a copy of the passed LoopRowNode, it does not use
the passed LoopRowNode itself (in other words, you can delete
it after calling (The LoopRowNode and the DataValueNodes IN the
LoopRowNode).)

This version makes a deep copy of the node given:

bool insert( iterator pos, LoopRowNode *v )
This version makes a link to the node given, so don't delete it afterword: (You are "giving" the new node to the class after having allocated it yourself

bool insert( iterator pos, LoopTableNode &t )
Insert - Insert before 'pos', the table of data given
by the LoopTableNode.  If the layout of values is not
consistent with the layout defined by the names
in the DataLoopNode, it will fail and return false,
else it returns true.
(This function performs a DEEP COPY of the given loop node, so everything in the passed argument can be deleted after calling, if it is appropriate.)

bool insert( iterator pos, LoopTableNode *t )
This version makes a shallow link instead of a deep copy, so do not delete the node after passing it. (You are "giving" the node to the library, after having allocated it yourself.)

void erase( iterator pos )
erase - Remove the row (LoopRowNode) given. If there is any nested table under it, it gets removed as well.

void erase( iterator from, iterator to )
erase - Remove the range of rows given, using typical STL range conventions: The range is inclusive of the start, but exclusive of the end: [from,to)

These methods provide a shortcut to get to the data inside the loop:

string getString( int row, int col )
This method retrieves the value at the specified row and column (indeces start at zero). If no such row or column exists in the table, then a null-length string is returned.

void setString( int row, int col, const string &val )
This method sets the value at the specified row and column to the given value. The delimiter type is not passed, but is calculated based on the contents of the string.

LoopTableNode(const string &tflag, bool indentFl = true, int rowsPerLn = 1 )

LoopTableNode( bool tflag )
call with tflag = true for "tabulate" or false for "linear"

LoopTableNode( LoopIter& I)
Copy Constructor.

LoopTableNode( bool link, LoopIter& I)
Copy with parallel link. Set "link" to true to create a copy with a parallel link, or set it to false to create a copy without a parallel link. See the external documentation for more details on parallel copies.

void setIndentFlag( bool setTo )

bool getIndentFlag( void ) const

Sets (or gets) the boolean flag for whether or not to indent the values in this loop. When a loop is first constructed, the default is "true".

void setRowsPerLine( int setTo )

bool getRowsPerLine( void ) const

Sets (or gets) the number of loop iterations to print on one line of text when unparsing. This only has meaning when the loop is tabulated, and is ignored when the loop is linearly printed. The default is 1.

void setTabFlag( bool setTo )

bool getTabFlag( void )

Sets (or gets) the tabulation flag for this loop, and all nested loops inside it. true = tab, false = linear.

void addValue(const DataLoopNameListNode::Status dstat, const int row, const int currRow, DVNWithPos *value)
DEPRECIATED - use the STL vector operations instead.

void FlattenNestedLoop(List<DataValueNode*>* M)
DEPRECIATED - use the STL vector operations instead.

void reset()
DEPRECIATED - use the STL vector operations instead.

DataLoopValListNode::Status returnNextLoopElement(DataValueNode* & v)
DEPRECIATED - use the STL vector operations instead.

ASTlist <DataValueNode *> * returnLoopValues(unsigned position)
DEPRECIATED - use the STL vector operations instead.

StarFileNode::Status LoopTableNode::RemoveColumnValues( int nest, int ele )
DEPRECIATED - use the STL vector operations instead.
(Removing the tagname from the name list with the erase() operator causes it to remove the values under that 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

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. This function MUST be overridden for each subclass of ASTnode.
Returns:
true if the child was unlinked. false if the given ASTnode was not even in this class anywhere, and therefore nothing was done.

private : ASTlist <LoopRowNode *> myIters

int rowsPerLine

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 is the longest value in all the lists: )

void flushValCache( void )
Flush the cache that builds up when values in this loop have been examined. This routine is needed because there is no garbage collection in C. There is no way for the library to tell when the calling programmer is done using a pointer. This routine explicitly tells the library that it is now safe to flush the value cache, which has the effect of invalidating all DataValueNode pointers that were held by the calling program. If the value cache is not flushed as soon as you are done with your data value node pointers, the memory footprint of this library will be very large when processing STAR files that contain long loops. Calling flushValCache at the LoopNode level flushes all data value node pointers within that loop. It is also possible to flush the value cache at the row and value level to just flush parts of it. Please be warned that any call to "Unparse" will automaticly flush the value cache, and invalidate any data value node pointers you may have been hanging on ot.

virtual void calcPrintSizes( List **presizes, List **postsizes )


This class has no child classes.

alphabetic index hierarchy of classes


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

generated by doc++