class LoopRowNode : public ASTnode, private ASTnodeWithPosBits

This class is a single row of values in a loop

Inheritance:


Public Fields

LoopTableNode* innerLoop
string myVal

Public Methods

void addInnerLoopValue (const DataLoopNameListNode::Status dstat, const int row, const int currRow, DVNWithPos *value)
DEPRECIATED - use the STL vector operations instead.
void addValue (DVNWithPos *value)
DEPRECIATED - use the STL vector operations instead.
void debugDump ( void )
void FlattenNestedLoop (List<DataValueNode*>* M)
DEPRECIATED - use the STL vector operations instead.
virtual void flushValCache (void)
Flushes the value cache for this row
StarFileNode::Status LoopRowNode::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.
DataValueNode* returnLoopValue (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

Public


void setTabFlag ( bool setTo )
bool getTabFlag ( void )

Sets (or gets) the tabulation flag for this row, and all nested loops inside it
private :
Was this in version 1: ASTlist myVals;

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)

Inherited from ASTnodeWithPosBits:


Documentation

This class is a single row of values in a loop.

A single row of values in the loop is a list (STL vector) of DataValueNodes. In addition each loop row can have a table of values hanging "under" it at the next nesting level. And the rows of that table can have other tables under them, and so on.

These types are for use with the STL vector-like methods of this class

typedef DataValueNode* 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

LoopRowCol here

iterator()

iterator( const LoopRowCol ©Me )

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)

LoopRowCol here

const_iterator()

const_iterator( const LoopRowCol ©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)

--------------------------------------------------
insert() and erase()    *
--------------------------------------------------
The following functions will only work if this LoopRowNode has not
yet been attached to a loop in a STAR tree.  if this LoopRowNode
*HAS* been attached to a loop in the STAR tree already, then these
methods will be disallowed because that would cause a mismatch
between the number of values in the loop row and the number of
tagnames for the loop.

Thus this can work:
DataLoopNode  some_loop;
LoopRowNode  some_row;
...
some_row.insert( some_row.end(),
new DataValueNode( "hello" );
some_row.insert( some_row.end(),
new DataValueNode( "world" );
some_loop.getVals.insert( begin(), some_row );
* (it only works assuming that two values per row is
* the proper amount for some_loop, else it's an error.)

But this will not work:
DataLoopNode  some_loop;
LoopRowNode  some_row;
...
...
some_loop.getVals[0].insert( end(),
new DataValueNode( "hello " );
* (You cannot insert or delete values from a row
* of data that is already in a loop.  You can only
* insert or delete entire rows at a time from an
* existing loop.)



Insert - Insert before 'pos', the data value 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.)

bool insert( iterator pos, DataValueNode &v )
This allocates a copy of the data, rather than a pointer to it, so if the caller is passing a heap-allocated DataValueNode, the caller needs to delete it later

bool insert( iterator pos, DataValueNode *v )
TODO - document this: give node, erather than copy node

bool erase( iterator pos )
erase - Remove the value given.

DataValueNode* elementAt( const short pos )
elementAt() - get the DataValueNode at the position given. Counting starts at zero as the first element.

void insertElementAt( const short pos, DataValueNode &v )
insertElementAt() - insert a new value at the position given (shifting all other values forward)

void removeElementAt( const short pos )
removeElementAt() - erase a value at the position given (shifting all other values downward)

void setElementAt( const short pos, DataValueNode &v )
Set the value in-place at a particular column in the row

LoopRowNode( const bool tflag )
Parameters:
tflag - true = loop is tabular, false = loop is linear (only important when outputting with Unparse()).

LoopRowNode( const bool tflag, size_t initSize )
Parameters:
tflag - true = loop is tabular, false = loop is linear (only important when outputting with Unparse()).
initSize - = the initial allocated capacity of the vector. (Not the actual size of the vector)

LoopRowNode( IterNode& N)
Copy Constructor.

LoopRowNode( bool link, IterNode& N)
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.

LoopRowNode( vector<DataValueNode*> &v, const bool tflag = false )
Make a new Iternode with the values given in the vector. (ASTlist is derived from vector, so an ASTlist can be used as the argument as well.)

void addValue(DVNWithPos *value)
DEPRECIATED - use the STL vector operations instead.

void addInnerLoopValue(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.

DataValueNode* returnLoopValue(unsigned position)
DEPRECIATED - use the STL vector operations instead.

StarFileNode::Status LoopRowNode::RemoveColumnValues( int nest, int ele )
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.

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.

Parameters:
type - type to search for.
delim - the delimiter type to search for if searching for DataValueNode's (default is "dont-care").

void setTabFlag( bool setTo )

bool getTabFlag( void )

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

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.

private :
Was this in version 1: ASTlist myVals;

string myVal

LoopTableNode* innerLoop

void debugDump( void )

virtual void flushValCache(void)
Flushes the value cache for this row. Call this routine whenever you are done using the values in this row. Failure to do so will result in an excessive memory footprint for this program if you iterate over large loops, but doing so to often merely results in slow (but correct) operation as the same value nodes are regenerated and thrown away multiple times. When in doubt, do it a lot. Note that after calling flushValCache(), any DataValueNode pointers you are holding onto from this row will become freed and invalid.
VALID USAGE
LoopRowNode *aRow = (*myTable)[3];     *        *    DataValueNode firstVal = (*aRow)[0];
DataValueNode secondVal = (*aRow)[1];
string concat = firstVal->myValue() + secondVal->myValue();
firstVal->setValue( concat );
aRow->flushValCache();
INVALID USAGE!
LoopRowNode *aRow = (*myTable)[3];     *        *    DataValueNode firstVal = (*aRow)[0];
DataValueNode secondVal = (*aRow)[1];
string concat = firstVal->myValue() + secondVal->myValue();
aRow->flushValCache();
*           *    firstVal->setValue( concat );

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 datavalue from the list: )


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++