class DataLoopNode : public DataNode

A DataLoopNode is a list of tagnames and a list of values for those names

Inheritance:


Public Methods

StarFileNode::Status AddDataName (const string & name)
DEPRECIATED - instead use the STL vector-like methods outlined in the documentation for DataLoopNameListNode and LoopTableNode
StarFileNode::Status AddDataValue ( const string & value, DataValueNode::ValType type )
DEPRECIATED - instead use the STL vector-like methods outlined in the documentation for DataLoopNameListNode and LoopTableNode
StarFileNode::Status ChangeName (const string &oldName, const string &newName )
Find the old tag name in the loop and change it to the new name.
void FlattenNestedLoop ( List<DataNameNode*>* &L, List<DataValueNode*>* &M)
DEPRECIATED - instead use the STL vector-like methods outlined in the documentation for DataLoopNameListNode and LoopTableNode
virtual bool isOfType ( ASTtype T )
virtual string myName () const
Return the name of the loop (arbitrarily chosen to be the name of the first tag in the loop's names
virtual ASTnode::ASTtype myType (void)
bool NotVirtualIsOfType ( ASTtype T )
StarFileNode::Status RemoveColumn ( const string name )
DEPRECIATED - instead use the STL vector-like methods outlined in the documentation for DataLoopNameListNode and LoopTableNode
void reset ()
DEPRECIATED - instead use the STL vector-like methods outlined in the documentation for DataLoopNameListNode and LoopTableNode
virtual ASTlist <DataValueNode *> * returnLoopValues (const string & tagName)
DEPRECIATED - instead use the STL vector-like methods outlined in the documentation for DataLoopNameListNode and LoopTableNode
DataLoopValListNode::Status returnNextLoopElement (DataValueNode* & v)
DEPRECIATED - instead use the STL vector-like methods outlined in the documentation for DataLoopNameListNode and LoopTableNode
void setNames ( DataLoopNameListNode &N )
Although this method is public, you should not use it
void setVals ( LoopTableNode &L )
Although this method is public, you should not use it
void tagPositionDeep ( string tagName, int *nestLevel, int *column )
Get the integer indexes that tell where the given tagname is located
virtual void Unparse (int indent, int )
virtual void Unparse (int indent)
virtual ~DataLoopNode ()
Destructor:

Public


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

LoopTableNode& getVals ( void )
LoopTableNode* getValsPtr ( void )

getVals returns a reference or pointer to the LoopTableNode inside this DataValueNode

void setIndentFlag ( bool flg )
bool getIndentFlag ( void ) const

sets or gets the indention flag for the loop

DataLoopNode (DataLoopNameListNode *d, DataLoopValListNode *l, const string &tflag = string("tabulate"))
virtual int getLineNum (void) const
Get one value out of the loop, from an arbitrary nesting level
virtual bool copyFrom ( HeadingNode &fromThis, bool linkWith )

true = try to make parallel link
DataLoopNode (const string &tflag)
DataLoopNode ( DataLoopNode& D)
Copy Constructor
DataLoopNode ( bool link, DataLoopNode& D)
Copy with parallel link
DataLoopNode ( DataLoopNameListNode* D, LoopTableNode L)

void setTabFlag ( bool setTo )
bool getTabFlag ( void )

Sets (or gets) the value of the tab flag for this loop

Inherited from DataNode:

Public Methods

virtual int myLongestStr( void ) const

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)
virtual bool removeChild( ASTnode *child )
virtual bool removeMe( void )
virtual List <ASTnode*> * searchByTag( string &searchFor)
virtual List <ASTnode*> * searchByTag( char *searchFor)
virtual List <ASTnode*> * searchForType( ASTtype type, int delim = -1)
virtual void setParent( ASTnode *p )
virtual bool unlinkChild( ASTnode *child )
virtual bool unlinkMe( void )

Inherited from ASTnodeWithPosBits:


Documentation

A DataLoopNode is a list of tagnames and a list of values for those names. It corresponds to a 'loop' in a STAR file.

DataLoopNode(DataLoopNameListNode *d, DataLoopValListNode *l, const string &tflag = string("tabulate"))

virtual int getLineNum(void) const
Get one value out of the loop, from an arbitrary nesting level. NOTE: The parameters are in row-major order. This might be reversed from how many scientific programmers think of things.
Returns:
s TODO DataLoopNameListNode &getNames( void ) { return *myDefList; }; DataLoopNameListNode *getNamesPtr( void ) { return myDefList; }; virtual List * searchByTag( string &searchFor ); virtual List * searchByTagValue( string &tag, string &value ); virtual List * searchForType( ASTtype type, int delim = -1 ); virtual bool unlinkChild( ASTnode *child ); private : StarFileNode::Status transform(DataLoopValListNode *l); StarFileNode::Status RemoveColumnName( const string name, int *nest, int *ele ); DataLoopNameListNode *myDefList; LoopTableNode myValList; public: virtual int myLongestStr( void ) const { myDefList->myLongestStr(); }; virtual int getMaxDepth( void ); private: virtual bool copyFrom( DataLoopNode &fromThis, bool linkWith ); }; class GlobalHeadingNode: public HeadingNode { public: virtual ASTnode::ASTtype myType(void); virtual bool isOfType( ASTtype T ); bool NotVirtualIsOfType( ASTtype T ); public: GlobalHeadingNode(const string & myHeading); GlobalHeadingNode( GlobalHeadingNode &N ); GlobalHeadingNode( bool link, GlobalHeadingNode &N ); }; class DataHeadingNode: public HeadingNode { public: virtual ASTnode::ASTtype myType(void); virtual bool isOfType( ASTtype T ); bool NotVirtualIsOfType( ASTtype T ); public: DataHeadingNode(const string & myHeading); DataHeadingNode( DataHeadingNode &N ); DataHeadingNode( bool link, DataHeadingNode &N ); }; class SaveHeadingNode: public HeadingNode { public: virtual ASTnode::ASTtype myType(void); virtual bool isOfType( ASTtype T ); bool NotVirtualIsOfType( ASTtype T ); public: SaveHeadingNode(const string & myHeading); SaveHeadingNode( SaveHeadingNode &N ); SaveHeadingNode( bool link, SaveHeadingNode &N ); }; class SaveFrameListNode: public ASTnode { public: SaveFrameListNode(ASTlist *L); SaveFrameListNode(); SaveFrameListNode(SaveFrameListNode &L); SaveFrameListNode( bool link, SaveFrameListNode &L); virtual ~SaveFrameListNode(); DataNode* ReturnSaveFrameDataNode(string dataItemName); ASTlist* GiveMyDataList(); virtual void Unparse(int indent); virtual ASTnode::ASTtype myType(void); virtual bool isOfType( ASTtype T ); bool NotVirtualIsOfType( ASTtype T ); public: StarFileNode::Status AddDataItem(const string & name, const string & value, DataValueNode::ValType type); StarFileNode::Status AddLoop(const string &tflag); StarFileNode::Status AddLoopDataName(const string & name); StarFileNode::Status AddLoopDataValue( const string & value, DataValueNode::ValType type ); void AddItemToSaveFrame(DataNode* S); DataNode* ReturnSaveFrameDeepLook( string dataItemName, int *nest, int *col ); virtual List * searchByTag( string &searchFor ); virtual List * searchForType( ASTtype type, int delim = -1 ); virtual List * searchByTagValue( string &tag, string &value ); virtual bool unlinkChild( ASTnode *child ); private: ASTlist *myKids; public: virtual int myLongestStr( void ); private: virtual bool copyFrom( SaveFrameListNode &fromThis, bool linkWith ); }; class SaveFrameNode: public DataNode { public: SaveFrameNode(const string & name); SaveFrameNode::SaveFrameNode( SaveFrameNode &S ); SaveFrameNode::SaveFrameNode( bool link, SaveFrameNode &S ); SaveFrameNode(SaveHeadingNode *h, SaveFrameListNode *l); virtual ~SaveFrameNode(); string myName() const {return myHeading->myName();}; void changeName(string &name); virtual const string &getPreComment( void ) { if( preCommentPtr == NULL ) return ASTemptyString; else return *preCommentPtr; }; virtual void setPreComment( const string &cmt ) { if( preCommentPtr != NULL ) delete preCommentPtr; if( cmt.length() == 0 ) preCommentPtr = NULL; else preCommentPtr = new string( cmt ); }; DataNode* ReturnSaveFrameDataNode(string dataItemName); ASTlist* GiveMyDataList(); virtual void Unparse(int indent) { Unparse( indent, 0 ); }; virtual void Unparse(int indent, int padsize ); virtual ASTnode::ASTtype myType(void); virtual bool isOfType( ASTtype T ); bool NotVirtualIsOfType( ASTtype T ); public: virtual ASTlist* returnLoopValues(const string & tagName); void AddItemToSaveFrame(DataNode* S); StarFileNode::Status AddDataItem(const string & name, const string & value, DataValueNode::ValType type ); StarFileNode::Status AddLoop(const string &tflag = string("tabulate")); StarFileNode::Status AddLoopDataName(const string & name); StarFileNode::Status AddLoopDataValue( const string & value, DataValueNode::ValType type ); DataNode* ReturnSaveFrameDeepLook( string dataItemName, int *nest, int *col ); virtual List * searchByTag( string &searchFor ); virtual List * searchForType( ASTtype type, int delim = -1 ); virtual List * searchByTagValue( string &tag, string &value ); virtual bool unlinkChild( ASTnode *child ); private: SaveHeadingNode *myHeading; SaveFrameListNode *mySaveFrameList; string *preCommentPtr; public: virtual int myLongestStr( void ) const { return myHeading->myLongestStr(); }; private: virtual bool copyFrom( SaveFrameNode &fromThis, bool linkWith ); }; void formatNMRSTAR( StarFileNode *inTree, StarFileNode *formatTree ); #endif #ifndef ASTGUARD #define ASTGUARD #ifdef IS_GCC # pragma interface #endif #include "portability.h" #include #include "astnode.h" #include "list.h" #include "astlist.h" #ifndef STAR_SYNTAX_PRINT_DEF #define STAR_SYNTAX_PRINT_DEF extern bool star_syntax_print; #endif #ifndef STAR_WARNING_CHECK_DEF #define STAR_WARNING_CHECK_DEF extern bool star_warning_check; #endif int strCmpInsensitive( const string &st1, const string &st2 ); class HeadingNode : public ASTnode, private ASTnodeWithPosBits { public: HeadingNode(HeadingNode & h); HeadingNode(bool link, HeadingNode & h); HeadingNode(const string & h); inline string myName() const {return myHeading;}; void changeName(string &name); virtual ASTnode::ASTtype myType(void); virtual bool isOfType( ASTtype T ); bool NotVirtualIsOfType( ASTtype T ); virtual void Unparse(int indent); protected: string myHeading; public: virtual int myLongestStr( void ) const { return myHeading.length(); };
Parameters:
row - - The row number to retreive from. Rows start numbering at zero.
col - - The column number to retreive from. Columns start numbering at zero.
nest - - The nesting level to retrieve for. Zero means the outermost level. Defaults to zero if left off.

DataLoopNode(const string &tflag)

DataLoopNode( DataLoopNode& D)
Copy Constructor

DataLoopNode( bool link, DataLoopNode& D)
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.

DataLoopNode( DataLoopNameListNode* D, LoopTableNode L)

virtual ~DataLoopNode()
Destructor:

void setIndentFlag( bool flg )

bool getIndentFlag( void ) const

sets or gets the indention flag for the loop. If it is true then the loop's values are indented normally, if it is false, then the values are not indented from the margin. This only affects how the loop will be printed when calling Unparse(). The default value made by the constructor 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. Here is an example of what it would look like if it were set to 3:
loop_
_foo
_bar

fooval1  barval1   fooval2  barval2   fooval3  barval3
fooval4  barval4   fooval5  barval5   fooval6  barval6
stop_

void setTabFlag( bool setTo )

bool getTabFlag( void )

Sets (or gets) the value of the tab flag for this loop. The tab flag determines if the loop prints out in tabular format or linear format (tabular = row all on one line, linear = one value per text line.) This only affects the unparsing of the loop and nothing else. (true = tabular, false = linear)

virtual ASTnode::ASTtype myType(void)

virtual bool isOfType( ASTtype T )

bool NotVirtualIsOfType( ASTtype T )

virtual string myName() const
Return the name of the loop (arbitrarily chosen to be the name of the first tag in the loop's names

void FlattenNestedLoop( List<DataNameNode*>* &L, List<DataValueNode*>* &M)
DEPRECIATED - instead use the STL vector-like methods outlined in the documentation for DataLoopNameListNode and LoopTableNode.

DataLoopValListNode::Status returnNextLoopElement(DataValueNode* & v)
DEPRECIATED - instead use the STL vector-like methods outlined in the documentation for DataLoopNameListNode and LoopTableNode.

virtual ASTlist <DataValueNode *> * returnLoopValues(const string & tagName)
DEPRECIATED - instead use the STL vector-like methods outlined in the documentation for DataLoopNameListNode and LoopTableNode.

void reset()
DEPRECIATED - instead use the STL vector-like methods outlined in the documentation for DataLoopNameListNode and LoopTableNode.

virtual void Unparse(int indent)

virtual void Unparse(int indent, int )

void tagPositionDeep( string tagName, int *nestLevel, int *column )
Get the integer indexes that tell where the given tagname is located. For example, the first tag in the outermost loop would be returned as nestLevel = 0, column = 0. The third tag in the second nesting level would be returned as nestLevel = 1, column = 2. (values start counting at zero, like array indeces). Negative values are returned if the tag was not found in this loop. The search is case-insensitive.

StarFileNode::Status RemoveColumn( const string name )
DEPRECIATED - instead use the STL vector-like methods outlined in the documentation for DataLoopNameListNode and LoopTableNode.

StarFileNode::Status AddDataName(const string & name)
DEPRECIATED - instead use the STL vector-like methods outlined in the documentation for DataLoopNameListNode and LoopTableNode.

StarFileNode::Status AddDataValue( const string & value, DataValueNode::ValType type )
DEPRECIATED - instead use the STL vector-like methods outlined in the documentation for DataLoopNameListNode and LoopTableNode.

StarFileNode::Status ChangeName(const string &oldName, const string &newName )
Find the old tag name in the loop and change it to the new name.

void setVals( LoopTableNode &L )
Although this method is public, you should not use it. It was made public merely because of a technical difficulty in the parser that prevented it from working any other way.

void setNames( DataLoopNameListNode &N )
Although this method is public, you should not use it. It was made public merely because of a technical difficulty in the parser that prevented it from working any other way.

LoopTableNode& getVals( void )

LoopTableNode* getValsPtr( void )

getVals returns a reference or pointer to the LoopTableNode inside this DataValueNode. The loopIter returned is the outermost loop in the node. The LoopTableNode returned can be manipulated directly. This is the intended way to add/modify/read/delete the data in the loop. If the layout of the loop needs to be changed, however, by adding or removing a tagname, then the getNames() method needs to be used instead to manipulate that information first. For more information, see the LoopTableNode class.


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