Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::VtkFile Class Reference
Collaboration diagram for Arcane::VtkFile:

Public Member Functions

 VtkFile (std::istream *stream)
const char * getCurrentLine ()
 Allows returning the line present in the buffer.
bool isEmptyNextLine ()
 Allows checking if the next line is empty.
const char * getNextLine ()
 Allows retrieving the next line from the file.
void checkString (const String &current_value, const String &expected_value)
 Allows checking if expected_value == current_value.
void checkString (const String &current_value, const String &expected_value1, const String &expected_value2)
 Allows checking if expected_value1 or expected_value2 == current_value.
void reReadSameLine ()
bool isEof ()
template<class T>
void getBinary (T &type)
 Allows retrieving the next binary number.
float getFloat ()
 Allows retrieving the following float.
double getDouble ()
 Allows retrieving the next double.
int getInt ()
 Allows retrieving the next integer.
void setIsBinaryFile (bool new_val)

Static Public Member Functions

static bool isEqualString (const String &current_value, const String &expected_value)
 Allows checking if expected_value == current_value.

Static Public Attributes

static const int BUFSIZE = 10000

Private Attributes

std::istream * m_stream = nullptr
 The stream.
bool m_is_init
 Has at least one line been read.
bool m_need_reread_current_line
 Should the same line be reread.
bool m_is_eof
 Is the end of the file reached.
bool m_is_binary_file
 Is this a file containing binary data.
char m_buf [BUFSIZE]
 The buffer containing the read line.

Detailed Description

Definition at line 169 of file VtkMeshIOService.cc.

Constructor & Destructor Documentation

◆ VtkFile()

Arcane::VtkFile::VtkFile ( std::istream * stream)
inlineexplicit

Definition at line 177 of file VtkMeshIOService.cc.

Member Function Documentation

◆ checkString() [1/2]

void Arcane::VtkFile::checkString ( const String & current_value,
const String & expected_value )

Allows checking if expected_value == current_value.

Allows checking if expected_value matches current_value. An exception is thrown otherwise.

Parameters
current_valuethe reference value
expected_valuethe value to compare

Definition at line 517 of file VtkMeshIOService.cc.

References ARCANE_THROW, and Arcane::String::lower().

Referenced by Arcane::VtkMeshIOService::_readCellsUnstructuredGrid(), Arcane::VtkMeshIOService::_readFacesMesh(), Arcane::VtkMeshIOService::_readNodesUnstructuredGrid(), Arcane::VtkMeshIOService::_readStructuredGrid(), and Arcane::VtkMeshIOService::readMesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkString() [2/2]

void Arcane::VtkFile::checkString ( const String & current_value,
const String & expected_value1,
const String & expected_value2 )

Allows checking if expected_value1 or expected_value2 == current_value.

Allows checking if expected_value1 or expected_value2 matches current_value. An exception is thrown otherwise.

Parameters
current_valuethe reference value
expected_value1the first value to compare
expected_value2the second value to compare

Definition at line 541 of file VtkMeshIOService.cc.

References ARCANE_THROW, and Arcane::String::lower().

Here is the call graph for this function:

◆ getBinary()

template<class T>
void Arcane::VtkFile::getBinary ( T & value)

Allows retrieving the next binary number.

Parameters
valueThe reference to the variable to be filled (the type of value tells us the number of bytes to read).

Definition at line 483 of file VtkMeshIOService.cc.

References m_stream.

Referenced by getDouble(), getFloat(), and getInt().

Here is the caller graph for this function:

◆ getCurrentLine()

const char * Arcane::VtkFile::getCurrentLine ( )

Allows returning the line present in the buffer.

Returns
the buffer containing the last line read

Definition at line 238 of file VtkMeshIOService.cc.

References getNextLine(), m_buf, and m_is_init.

Referenced by getNextLine().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDouble()

double Arcane::VtkFile::getDouble ( )

Allows retrieving the next double.

Returns
the retrieved double

Definition at line 434 of file VtkMeshIOService.cc.

References ARCANE_THROW, getBinary(), m_is_binary_file, and m_stream.

Referenced by Arcane::VtkMeshIOService::_readCellVariable(), Arcane::VtkMeshIOService::_readNodesUnstructuredGrid(), and Arcane::VtkMeshIOService::_readStructuredGrid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFloat()

float Arcane::VtkFile::getFloat ( )

Allows retrieving the following float.

Returns
the retrieved float

Definition at line 410 of file VtkMeshIOService.cc.

References ARCANE_THROW, getBinary(), m_is_binary_file, and m_stream.

Referenced by Arcane::VtkMeshIOService::_readNodesUnstructuredGrid(), and Arcane::VtkMeshIOService::_readStructuredGrid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInt()

int Arcane::VtkFile::getInt ( )

Allows retrieving the next integer.

Returns
the retrieved integer

Definition at line 458 of file VtkMeshIOService.cc.

References ARCANE_THROW, getBinary(), m_is_binary_file, and m_stream.

Referenced by Arcane::VtkMeshIOService::_readCellsUnstructuredGrid(), Arcane::VtkMeshIOService::_readItemGroup(), Arcane::VtkMeshIOService::_readNodeGroup(), Arcane::VtkMeshIOService::_readNodesUnstructuredGrid(), and Arcane::VtkMeshIOService::_readStructuredGrid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNextLine()

const char * Arcane::VtkFile::getNextLine ( )

Allows retrieving the next line from the file.

Returns
the buffer containing the last line read

Definition at line 340 of file VtkMeshIOService.cc.

References ARCANE_THROW, getCurrentLine(), m_buf, m_is_eof, m_is_init, m_need_reread_current_line, and m_stream.

Referenced by Arcane::VtkMeshIOService::_readCellsUnstructuredGrid(), Arcane::VtkMeshIOService::_readData(), Arcane::VtkMeshIOService::_readFacesMesh(), Arcane::VtkMeshIOService::_readMetadata(), Arcane::VtkMeshIOService::_readNodesUnstructuredGrid(), Arcane::VtkMeshIOService::_readStructuredGrid(), getCurrentLine(), isEmptyNextLine(), and Arcane::VtkMeshIOService::readMesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEmptyNextLine()

bool Arcane::VtkFile::isEmptyNextLine ( )

Allows checking if the next line is empty.

At the end of this method, the buffer will contain the next non-empty line. The boolean m_need_reread_current_line will allow getNextLine to return this line which has not been read.

Returns
true if there is an empty line, false otherwise

Definition at line 257 of file VtkMeshIOService.cc.

References ARCANE_THROW, getNextLine(), m_buf, m_is_eof, m_is_init, m_need_reread_current_line, and m_stream.

Referenced by Arcane::VtkMeshIOService::_readMetadata().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEof()

bool Arcane::VtkFile::isEof ( )
inline

Definition at line 199 of file VtkMeshIOService.cc.

◆ isEqualString()

bool Arcane::VtkFile::isEqualString ( const String & current_value,
const String & expected_value )
static

Allows checking if expected_value == current_value.

Allows checking if expected_value matches current_value.

Parameters
current_valuethe reference value
expected_valuethe value to compare
Returns
true if the values are equal, false otherwise

Definition at line 565 of file VtkMeshIOService.cc.

References Arcane::String::lower().

Referenced by Arcane::VtkMeshIOService::_readData(), Arcane::VtkMeshIOService::_readFacesMesh(), Arcane::VtkMeshIOService::_readMetadata(), Arcane::VtkMeshIOService::_readNodesUnstructuredGrid(), Arcane::VtkMeshIOService::_readStructuredGrid(), and Arcane::VtkMeshIOService::readMesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reReadSameLine()

void Arcane::VtkFile::reReadSameLine ( )
inline

Definition at line 197 of file VtkMeshIOService.cc.

◆ setIsBinaryFile()

void Arcane::VtkFile::setIsBinaryFile ( bool new_val)
inline

Definition at line 207 of file VtkMeshIOService.cc.

Member Data Documentation

◆ BUFSIZE

const int Arcane::VtkFile::BUFSIZE = 10000
static

Definition at line 173 of file VtkMeshIOService.cc.

◆ m_buf

char Arcane::VtkFile::m_buf[BUFSIZE]
private

The buffer containing the read line.

Definition at line 227 of file VtkMeshIOService.cc.

Referenced by getCurrentLine(), getNextLine(), and isEmptyNextLine().

◆ m_is_binary_file

bool Arcane::VtkFile::m_is_binary_file
private

Is this a file containing binary data.

Definition at line 224 of file VtkMeshIOService.cc.

Referenced by getDouble(), getFloat(), and getInt().

◆ m_is_eof

bool Arcane::VtkFile::m_is_eof
private

Is the end of the file reached.

Definition at line 221 of file VtkMeshIOService.cc.

Referenced by getNextLine(), and isEmptyNextLine().

◆ m_is_init

bool Arcane::VtkFile::m_is_init
private

Has at least one line been read.

Definition at line 215 of file VtkMeshIOService.cc.

Referenced by getCurrentLine(), getNextLine(), and isEmptyNextLine().

◆ m_need_reread_current_line

bool Arcane::VtkFile::m_need_reread_current_line
private

Should the same line be reread.

Definition at line 218 of file VtkMeshIOService.cc.

Referenced by getNextLine(), and isEmptyNextLine().

◆ m_stream

std::istream* Arcane::VtkFile::m_stream = nullptr
private

The stream.

Definition at line 212 of file VtkMeshIOService.cc.

Referenced by getBinary(), getDouble(), getFloat(), getInt(), getNextLine(), and isEmptyNextLine().


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