Grid 0.7.0
Grid::TextReader Class Reference

#include <TextIO.h>

Inheritance diagram for Grid::TextReader:
Grid::Reader< TextReader >

Public Member Functions

 TextReader (const std::string &fileName)
virtual ~TextReader (void)=default
bool push (const std::string &s)
void pop (void)
template<typename U>
void readDefault (const std::string &s, U &output)
template<typename U>
void readDefault (const std::string &s, std::vector< U > &output)
template<typename U>
void readMultiDim (const std::string &s, std::vector< U > &buf, std::vector< size_t > &dim)
template<>
void readDefault (const std::string &s, std::string &output)
template<>
void readDefault (const std::string &s, std::string &output)
std::enable_if< std::is_base_of< Serializable, U >::value, void >::type read (const std::string &s, U &output)
std::enable_if< EigenIO::is_tensor_fixed< ETensor >::value, void >::type Reshape (ETensor &t, const std::array< typename ETensor::Index, ETensor::NumDimensions > &dims)
std::enable_if< EigenIO::is_scalar< S >::value, void >::type copyScalars (S &Dest, const S *&pSource)

Protected Member Functions

void fromString (U &output, const std::string &s)

Private Member Functions

void checkIndent (void)

Private Attributes

std::ifstream file_
int level_
TextReaderupcast

Detailed Description

Definition at line 63 of file TextIO.h.

Constructor & Destructor Documentation

◆ TextReader()

TextReader::TextReader ( const std::string & fileName)

Definition at line 58 of file TextIO.cc.

References file_, and GridLogMessage.

◆ ~TextReader()

virtual Grid::TextReader::~TextReader ( void )
virtualdefault

References U.

Member Function Documentation

◆ push()

bool TextReader::push ( const std::string & s)

Definition at line 67 of file TextIO.cc.

References level_.

◆ pop()

void TextReader::pop ( void )

Definition at line 73 of file TextIO.cc.

References level_.

◆ readDefault() [1/4]

template<typename U>
void Grid::TextReader::readDefault ( const std::string & s,
U & output )

Definition at line 119 of file TextIO.h.

References Grid::Reader< TextReader >::fromString(), readDefault(), and U.

Referenced by readDefault().

◆ readDefault() [2/4]

template<typename U>
void Grid::TextReader::readDefault ( const std::string & s,
std::vector< U > & output )

Definition at line 128 of file TextIO.h.

References Grid::Reader< TextReader >::read().

◆ readMultiDim()

template<typename U>
void Grid::TextReader::readMultiDim ( const std::string & s,
std::vector< U > & buf,
std::vector< size_t > & dim )

Definition at line 141 of file TextIO.h.

References Grid::Reader< TextReader >::read().

◆ checkIndent()

void TextReader::checkIndent ( void )
private

Definition at line 78 of file TextIO.cc.

References file_, GRID_TEXT_INDENT, and level_.

Referenced by readDefault().

◆ readDefault() [3/4]

template<>
void Grid::TextReader::readDefault ( const std::string & s,
std::string & output )

Definition at line 98 of file TextIO.cc.

References checkIndent(), and file_.

◆ readDefault() [4/4]

template<>
void Grid::TextReader::readDefault ( const std::string & s,
std::string & output )

◆ read()

std::enable_if<!std::is_base_of< Serializable, U >::value &&!EigenIO::is_tensor< U >::value, void >::type Reader::read ( const std::string & s,
U & output )
inherited

Definition at line 186 of file BaseIO.h.

Referenced by Grid::TextReader::readDefault(), and Grid::TextReader::readMultiDim().

◆ Reshape()

std::enable_if< EigenIO::is_tensor_variable< ETensor >::value, void >::type Reader::Reshape ( ETensor & t,
const std::array< typename ETensor::Index, ETensor::NumDimensions > & dims )
inherited

Definition at line 202 of file BaseIO.h.

◆ copyScalars()

std::enable_if< EigenIO::is_scalar< S >::value, void >::type Grid::Reader< TextReader >::copyScalars ( S & Dest,
const S *& pSource )
inlineinherited

Definition at line 210 of file BaseIO.h.

◆ fromString()

void Reader::fromString ( U & output,
const std::string & s )
protectedinherited

Definition at line 225 of file BaseIO.h.

Referenced by Grid::TextReader::readDefault().

Field Documentation

◆ file_

std::ifstream Grid::TextReader::file_
private

Definition at line 79 of file TextIO.h.

Referenced by checkIndent(), readDefault(), and TextReader().

◆ level_

int Grid::TextReader::level_
private

Definition at line 80 of file TextIO.h.

Referenced by checkIndent(), pop(), and push().

◆ upcast

TextReader* Grid::Reader< TextReader >::upcast
privateinherited

Definition at line 227 of file BaseIO.h.


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