![]() |
QMCPACK
|
Wrapper class for IOTreeClass that gives a nearly identical interface as the OutputSectionClass. More...
Public Member Functions | |
bool | OpenFile (std::string fileName) |
Opens the file reference by fileName and reads the contents into the tree in CurrentSection. More... | |
std::string | GetName () |
std::string | GetFileName () |
std::string | GetVarName (int num) |
bool | NewFile (std::string fileName) |
Creates a file at the top level, choosing the appropriate type based on the file extension. More... | |
void | CloseFile () |
Calls CurrentSections close file and then deletes the CurrentSection. More... | |
void | FlushFile () |
Flush all buffers to disk for safety. More... | |
bool | OpenSection (std::string name, int num=0) |
Opens the num'th section with the given name. More... | |
bool | OpenSection (int num) |
Opens the num'th section below CurrentSection. More... | |
bool | IncludeSection (std::string name, std::string fileName) |
This mounts a file in the current tree under CurrentSection at the end of CurrentsSection's SectionList. More... | |
void | NewSection (std::string name) |
Creates a new section of the same type as currentSection under currentSection. More... | |
bool | NewSection (std::string name, std::string fileName) |
This function creates a new file of the appropriate type as determined by the extension of fileName and mounts it at the end of the list under CurrentSection. More... | |
void | CloseSection () |
Closes the current section. More... | |
template<class T > | |
bool | ReadVar (std::string name, T &var) |
Template function which reads a variable in the present section into the passed-by-reference T variable. More... | |
template<class T > | |
bool | ReadVar (std::string name, T &var, T Default) |
template<typename T > | |
bool | WriteVar (std::string name, T val) |
Writes a variable under the current section. More... | |
template<typename T , int RANK> | |
bool | WriteVar (std::string name, const Array< T, RANK > &val) |
template<class T > | |
bool | AppendVar (std::string name, T val) |
template<typename T , int RANK> | |
bool | AppendVar (std::string name, const Array< T, RANK > &val) |
IOVarBase * | GetVarPtr (std::string name) |
IOVarBase * | GetVarPtr (int num) |
void | SetUnderscores (bool use) |
int | CountSections (std::string name="") |
Returns the number of subsections within the present section which have the name name. More... | |
int | CountVars () |
void | PrintTree () |
Calls CurrentSections virtual PrintTree() function. More... | |
IOSectionClass (IOSectionClass &io) | |
IOSectionClass () | |
Private Attributes | |
IOTreeClass * | CurrentSection |
Wrapper class for IOTreeClass that gives a nearly identical interface as the OutputSectionClass.
|
inline |
|
inline |
|
inline |
Definition at line 196 of file IO.h.
References IOTreeClass::AppendVar(), and IOSectionClass::CurrentSection.
|
inline |
Definition at line 202 of file IO.h.
References IOTreeClass::AppendVar(), and IOSectionClass::CurrentSection.
void CloseFile | ( | ) |
Calls CurrentSections close file and then deletes the CurrentSection.
void CloseSection | ( | ) |
Closes the current section.
That is, CurrentSection becomes CurrentSection's parent.
Referenced by CubicSplineCommon::Read(), and CubicSplineCommon::Write().
|
inline |
Returns the number of subsections within the present section which have the name name.
If called without a name, it returns the total number of sections.
Definition at line 216 of file IO.h.
References IOTreeClass::CountSections(), and IOSectionClass::CurrentSection.
|
inline |
Definition at line 217 of file IO.h.
References IOTreeClass::CountVars(), and IOSectionClass::CurrentSection.
void FlushFile | ( | ) |
Flush all buffers to disk for safety.
std::string GetFileName | ( | ) |
|
inline |
Definition at line 123 of file IO.h.
References IOSectionClass::CurrentSection, and IOTreeClass::Name.
|
inline |
Definition at line 125 of file IO.h.
References IOVarBase::GetName(), and IOSectionClass::GetVarPtr().
|
inline |
Definition at line 207 of file IO.h.
References IOSectionClass::CurrentSection, and IOTreeClass::GetVarPtr().
Referenced by IOSectionClass::GetVarName().
|
inline |
Definition at line 209 of file IO.h.
References IOSectionClass::CurrentSection, and IOTreeClass::GetVarPtr().
bool IncludeSection | ( | std::string | name, |
std::string | fileName | ||
) |
This mounts a file in the current tree under CurrentSection at the end of CurrentsSection's SectionList.
It does not change what CurrentSection points to, ie. it does not descend to the newly-opened section.
bool NewFile | ( | std::string | fileName | ) |
Creates a file at the top level, choosing the appropriate type based on the file extension.
|
inline |
Creates a new section of the same type as currentSection under currentSection.
Pushes the new section to the end of the section list.
Definition at line 153 of file IO.h.
References IOSectionClass::CurrentSection, and IOTreeClass::NewSection().
Referenced by CubicSplineCommon::Write().
bool NewSection | ( | std::string | name, |
std::string | fileName | ||
) |
This function creates a new file of the appropriate type as determined by the extension of fileName and mounts it at the end of the list under CurrentSection.
Returns false if the file couldn't be created.
bool OpenFile | ( | std::string | fileName | ) |
Opens the file reference by fileName and reads the contents into the tree in CurrentSection.
Creates a new object based on the extnesion of the filename. For ".h5", it creates an IOTreeHDF5Class. For ".xml" it creaes an IOTreeXMLClass. After creating the object, it calls the objects virtual OpenFile function, reading the contents of the file into the tree.
bool OpenSection | ( | std::string | name, |
int | num = 0 |
||
) |
Opens the num'th section with the given name.
The default value for num is 0.
Referenced by CubicSplineCommon::Read().
bool OpenSection | ( | int | num | ) |
Opens the num'th section below CurrentSection.
|
inline |
Calls CurrentSections virtual PrintTree() function.
This is for debugging purposes. It spits out a hierarchy of the sections and variable names.
Definition at line 221 of file IO.h.
References IOSectionClass::CurrentSection, and IOTreeClass::PrintTree().
|
inline |
Template function which reads a variable in the present section into the passed-by-reference T variable.
Definition at line 168 of file IO.h.
References IOSectionClass::CurrentSection, and IOTreeClass::ReadVar().
Referenced by LinearGrid::Read(), CubicSplineCommon::Read(), GeneralGrid::Read(), OptimalGrid::Read(), OptimalGrid2::Read(), LogGrid::Read(), ClusterGrid::Read(), ReadGrid(), and IOSectionClass::ReadVar().
|
inline |
Definition at line 174 of file IO.h.
References IOSectionClass::ReadVar().
|
inline |
Definition at line 211 of file IO.h.
References IOSectionClass::CurrentSection, and IOTreeClass::SetUnderscores().
|
inline |
Writes a variable under the current section.
Definition at line 184 of file IO.h.
References IOSectionClass::CurrentSection, and IOTreeClass::WriteVar().
Referenced by LinearGrid::Write(), CubicSplineCommon::Write(), GeneralGrid::Write(), OptimalGrid::Write(), OptimalGrid2::Write(), LogGrid::Write(), and ClusterGrid::Write().
|
inline |
Definition at line 190 of file IO.h.
References IOSectionClass::CurrentSection, and IOTreeClass::WriteVar().
|
private |
Definition at line 113 of file IO.h.
Referenced by IOSectionClass::AppendVar(), IOSectionClass::CountSections(), IOSectionClass::CountVars(), IOSectionClass::GetName(), IOSectionClass::GetVarPtr(), IOSectionClass::IOSectionClass(), IOSectionClass::NewSection(), IOSectionClass::PrintTree(), IOSectionClass::ReadVar(), IOSectionClass::SetUnderscores(), and IOSectionClass::WriteVar().