Version: 5.1.6

MEDMEM_ENSIGHT._ASCIIFileReader Class Reference

Reader of ASCII files. More...

#include <MEDMEM_EnsightUtils.hxx>

Public Member Functions

 _ASCIIFileReader (const string &fileName) throw (MEDEXCEPTION)
 Constructor of ASCIIFileReader.
 ~_ASCIIFileReader ()
 Destructor of ASCIIFileReader closes its file.
bool eof ()
 Return true if the whole file has been read.
string getWord ()
 never throws
int getInt () throw (MEDEXCEPTION)
float getReal () throw (MEDEXCEPTION)
 needed after getWord(), getInt() or getReal() to get a next line
void toNextLine ()
char * getLine () throw (MEDEXCEPTION)
 Read a next line from the file.
const char * getCurrentPtr () const
bool lookAt (const char *text)
bool isTimeStepBeginning ()
 Return true if TIME_STEP_BEG follows and skips TIME_STEP_BEG line.
bool isTimeStepEnd ()
 read out given data
void skip (int nbVals, int nbPerLine, int valWidth)
 read out width chars and nbLines line-ends
void skip (int width, int nbLines)
 read out width chars and nbLines line-ends
template<class T >
char * convertReals (const int nbValues, const char *undefValue=0, set< int > *undefIndices=0, const vector< int > *partialIndices=0, const int nbPartialComponents=0) throw (MEDEXCEPTION)

Static Public Member Functions

static int split (const string &str, string &part1, string &part2, const char separator=' ', const bool fromBack=false)
 < divide a string into two parts
static int split (const string &str, std::list< string > &parts, const char separator=' ', const bool fromBack=false)
 check if string contains only digits
static bool isDigit (const string &str, const bool real=false)
 check if a string contains only digits

Data Fields

int _file
char * _start
char * _ptr
char * _eptr
bool _isWin

Detailed Description

Reader of ASCII files.


Constructor & Destructor Documentation

MEDMEM_ENSIGHT._ASCIIFileReader::_ASCIIFileReader ( const string &  fileName  )  throw (MEDEXCEPTION)

Constructor of ASCIIFileReader.

References BUFFER_SIZE, Med_Gen_test.fileName, and MEDMEM_ENSIGHT.MAX_LINE_LENGTH.

MEDMEM_ENSIGHT._ASCIIFileReader::~_ASCIIFileReader (  ) 

Destructor of ASCIIFileReader closes its file.

References MEDMEM_ENSIGHT._ASCIIFileReader._file, and MEDMEM_ENSIGHT._ASCIIFileReader._start.


Member Function Documentation

bool MEDMEM_ENSIGHT._ASCIIFileReader::eof (  ) 
string MEDMEM_ENSIGHT._ASCIIFileReader::getWord (  ) 
int MEDMEM_ENSIGHT._ASCIIFileReader.getInt (  )  throw (MEDEXCEPTION)
float MEDMEM_ENSIGHT._ASCIIFileReader.getReal (  )  throw (MEDEXCEPTION)
void MEDMEM_ENSIGHT._ASCIIFileReader.toNextLine (  ) 
char * MEDMEM_ENSIGHT._ASCIIFileReader::getLine (  )  throw (MEDEXCEPTION)
const char* MEDMEM_ENSIGHT._ASCIIFileReader.getCurrentPtr (  )  const
bool MEDMEM_ENSIGHT._ASCIIFileReader::lookAt ( const char *  text  ) 
bool MEDMEM_ENSIGHT._ASCIIFileReader::isTimeStepBeginning (  ) 
bool MEDMEM_ENSIGHT._ASCIIFileReader::isTimeStepEnd (  ) 

read out given data

Return true if TIME_STEP_END follows and skips TIME_STEP_END line.

References MEDMEM_ENSIGHT._ASCIIFileReader._ptr, MEDMEM_ENSIGHT._ASCIIFileReader.eof(), MEDMEM_ENSIGHT.TIME_STEP_END, and MEDMEM_ENSIGHT.TIME_STEP_END_LEN.

void MEDMEM_ENSIGHT._ASCIIFileReader::skip ( int  nbVals,
int  nbPerLine,
int  valWidth 
)

read out width chars and nbLines line-ends

read out given data

void MEDMEM_ENSIGHT._ASCIIFileReader::skip ( int  width,
int  nbLines 
)
template<class T >
char* MEDMEM_ENSIGHT._ASCIIFileReader.convertReals ( const int  nbValues,
const char *  undefValue = 0,
set< int > *  undefIndices = 0,
const vector< int > *  partialIndices = 0,
const int  nbPartialComponents = 0 
) throw (MEDEXCEPTION)
int MEDMEM_ENSIGHT._ASCIIFileReader::split ( const string &  str,
string &  part1,
string &  part2,
const char  separator = ' ',
const bool  fromBack = false 
) [static]

< divide a string into two parts

divide a string into two parts

divide a string into parts, return nb of parts

int MEDMEM_ENSIGHT._ASCIIFileReader::split ( const string &  str,
std::list< string > &  parts,
const char  separator = ' ',
const bool  fromBack = false 
) [static]

check if string contains only digits

divide a string into parts, return nb of parts

References INTERP_KERNEL.swap().

bool MEDMEM_ENSIGHT._ASCIIFileReader::isDigit ( const string &  str,
const bool  real = false 
) [static]

check if a string contains only digits

References TestMedCorba7.s.


Field Documentation