QMCPACK
IOTreeASCIIClass Class Reference

This is the ASCII specialization of IOTreeClass for ASCII text files. More...

+ Inheritance diagram for IOTreeASCIIClass:
+ Collaboration diagram for IOTreeASCIIClass:

Public Member Functions

void WriteSection (std::ofstream &outFile, int indent)
 
IOFileType GetFileType () override
 
void PrintTree (int level) override
 Print an indented tree of section variable names. More...
 
void PrintTree () override
 Same thing, just calls above with level 0;. More...
 
IOTreeClassNewSection (std::string name) override
 Write me! More...
 
void IncludeSection (IOTreeClass *) override
 Inserts a new Include directive in the present section. More...
 
bool OpenFile (std::string filename, std::string myName, IOTreeClass *parent) override
 Takes the name of a file to read, the name of my section and a pointer to my parent. More...
 
bool NewFile (std::string fileName, std::string mySectionName, IOTreeClass *parent) override
 
void CloseFile () override
 Do any file handling necessary and delete the whole tree of data. More...
 
void FlushFile () override
 
 IOTreeASCIIClass ()
 
- Public Member Functions inherited from IOTreeClass
void MarkModified ()
 
void InsertSection (IOTreeClass *newSec)
 
bool FindSection (std::string name, IOTreeClass *&sectionPtr, int num=0)
 FindSection locates a subsection with the given name within the section in contains and returns it in the pointer, sectionPtr, which is passed a reference. More...
 
int CountSections (std::string name)
 Returns the number of subsections with the given name within the present section. More...
 
int CountVars ()
 
template<class T >
bool ReadVar (std::string name, T &var)
 
IOVarBaseGetVarPtr (std::string name)
 
IOVarBaseGetVarPtr (int num)
 
template<typename T >
bool WriteVar (std::string name, T val)
 These create a new variable with the given name and value: More...
 
template<typename T , int LEN>
bool WriteVar (std::string name, const TinyVector< T, LEN > &val)
 
template<typename T , int RANK>
bool WriteVar (std::string name, const Array< T, RANK > &val)
 
template<typename T , int RANK, int LEN>
bool WriteVar (std::string name, const Array< TinyVector< T, LEN >, RANK > &val)
 
template<class T >
bool AppendVar (std::string name, T val)
 Append a value to a variable of dimension of 1 higher than val. More...
 
void SetUnderscores (bool use)
 
 IOTreeClass ()
 
virtual ~IOTreeClass ()
 
template<>
bool WriteVar (std::string name, const char *val)
 

Private Member Functions

bool ReadWithoutComments (std::string fileName, Array< char, 1 > &buffer)
 Reads a text file into a buffer eliminating c++ and c-style comments. More...
 
bool ReadSection (IOTreeClass *parent, std::string name, std::list< TokenClass >::iterator &iter, std::list< TokenClass > &tokenList, bool wantEndBrace)
 Reads a section from a list of TokenClass objects. More...
 

Additional Inherited Members

- Public Attributes inherited from IOTreeClass
std::list< IOVarBase * > VarList
 
std::list< IOTreeClass * > SectionList
 
int MyNumber
 This is used to ensure proper ordering of sections in the HDF version in which there is no guarantee that the sections will come out of the file in the same order you put them in. More...
 
int CurrSecNum
 
IOTreeClassParent
 
std::string FileName
 This is the empty std::string unless I'm the root node of some file. More...
 
std::string Name
 
- Protected Attributes inherited from IOTreeClass
bool IsModified
 
bool UseUnderscores
 

Detailed Description

This is the ASCII specialization of IOTreeClass for ASCII text files.

It's syntax is as follows: Section (SectionName) { double x = 3; blitz::Array<int,1> y(3) = [1, 2, 3]; blitz::Array<int,3> z(2,2,1) = [ 1, 2, 3, 4 ]; Section (Species, "species1.h5"); }

Definition at line 48 of file IOASCII.h.

Constructor & Destructor Documentation

◆ IOTreeASCIIClass()

IOTreeASCIIClass ( )
inline

Definition at line 83 of file IOASCII.h.

References IOTreeClass::IsModified.

83 { IsModified = false; }
bool IsModified
Definition: IOBase.h:37

Member Function Documentation

◆ CloseFile()

void CloseFile ( )
overridevirtual

Do any file handling necessary and delete the whole tree of data.

Implements IOTreeClass.

◆ FlushFile()

void FlushFile ( )
overridevirtual

Implements IOTreeClass.

◆ GetFileType()

IOFileType GetFileType ( )
overridevirtual

Implements IOTreeClass.

◆ IncludeSection()

void IncludeSection ( IOTreeClass )
overridevirtual

Inserts a new Include directive in the present section.

Implements IOTreeClass.

◆ NewFile()

bool NewFile ( std::string  fileName,
std::string  mySectionName,
IOTreeClass parent 
)
overridevirtual

Implements IOTreeClass.

◆ NewSection()

IOTreeClass* NewSection ( std::string  name)
overridevirtual

Write me!

Implements IOTreeClass.

◆ OpenFile()

bool OpenFile ( std::string  filename,
std::string  myName,
IOTreeClass parent 
)
overridevirtual

Takes the name of a file to read, the name of my section and a pointer to my parent.

Reads the file into a tree of IOTreeClass's.

Implements IOTreeClass.

◆ PrintTree() [1/2]

void PrintTree ( int  level)
overridevirtual

Print an indented tree of section variable names.

Implements IOTreeClass.

◆ PrintTree() [2/2]

void PrintTree ( )
overridevirtual

Same thing, just calls above with level 0;.

Implements IOTreeClass.

◆ ReadSection()

bool ReadSection ( IOTreeClass parent,
std::string  name,
std::list< TokenClass >::iterator &  iter,
std::list< TokenClass > &  tokenList,
bool  wantEndBrace 
)
private

Reads a section from a list of TokenClass objects.

iter should refer to the current place in the list that we should start reading at. iter should point to a place just after the '{'. If wantEndBrace is true, it will look for an ending '}'. Otherwise it will read until the list of Tokens runs out.

◆ ReadWithoutComments()

bool ReadWithoutComments ( std::string  fileName,
Array< char, 1 > &  buffer 
)
private

Reads a text file into a buffer eliminating c++ and c-style comments.

◆ WriteSection()

void WriteSection ( std::ofstream &  outFile,
int  indent 
)

The documentation for this class was generated from the following file: