Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::ISimpleTableReaderWriter Class Referenceabstract

Class interface allowing reading a file and writing a file with or from a SimpleTableInternal. More...

#include <arcane/core/ISimpleTableReaderWriter.h>

Public Member Functions

virtual bool writeTable (const Directory &dst, const String &file_name)=0
 Method allowing writing a simple table to a file.
virtual bool readTable (const Directory &src, const String &file_name)=0
 Method allowing reading a file containing a simple table.
virtual void clearInternal ()=0
 Method allowing clearing the content of the SimpleTableInternal object.
virtual void print ()=0
 Method allowing writing the table to the standard output.
virtual Integer precision ()=0
 Method allowing retrieval of the precision currently used for writing values.
virtual void setPrecision (Integer precision)=0
 Method allowing modification of the print precision.
virtual bool isFixed ()=0
 Method allowing checking if the 'std::fixed' flag is active or not for writing values.
virtual void setFixed (bool fixed)=0
 Method allowing setting or unsetting the 'std::fixed' flag.
virtual bool isForcedToUseScientificNotation ()=0
 Method allowing checking if the 'std::scientific' flag is active or not for writing values.
virtual void setForcedToUseScientificNotation (bool use_scientific)=0
 Method allowing setting or unsetting the 'std::scientific' flag.
virtual String fileType ()=0
 Method allowing retrieval of the file type that will be written by the implementation. ("csv" will be returned for the csv implementation).
virtual Ref< SimpleTableInternalinternal ()=0
 Method allowing retrieval of a reference to the SimpleTableInternal object used.
virtual void setInternal (const Ref< SimpleTableInternal > &simple_table_internal)=0
 Method allowing setting a reference to a SimpleTableInternal.

Detailed Description

Class interface allowing reading a file and writing a file with or from a SimpleTableInternal.

The file read must preferably have been written by an implementation of this same interface.

Imperatively, a file written by an implementation of this interface must be readable by this same implementation.

The implementation must not destroy the SimpleTableInternal object pointed to by the pointer used. The caller is responsible for managing this.

Definition at line 98 of file ISimpleTableReaderWriter.h.

Member Function Documentation

◆ fileType()

virtual String Arcane::ISimpleTableReaderWriter::fileType ( )
pure virtual

Method allowing retrieval of the file type that will be written by the implementation. ("csv" will be returned for the csv implementation).

Returns
String The file type/extension used.

◆ internal()

virtual Ref< SimpleTableInternal > Arcane::ISimpleTableReaderWriter::internal ( )
pure virtual

Method allowing retrieval of a reference to the SimpleTableInternal object used.

Returns
Ref<SimpleTableInternal> A copy of the reference.

◆ isFixed()

virtual bool Arcane::ISimpleTableReaderWriter::isFixed ( )
pure virtual

Method allowing checking if the 'std::fixed' flag is active or not for writing values.

Returns
true If yes.
false If no.

◆ isForcedToUseScientificNotation()

virtual bool Arcane::ISimpleTableReaderWriter::isForcedToUseScientificNotation ( )
pure virtual

Method allowing checking if the 'std::scientific' flag is active or not for writing values.

Returns
true If yes.
false If no.

◆ precision()

virtual Integer Arcane::ISimpleTableReaderWriter::precision ( )
pure virtual

Method allowing retrieval of the precision currently used for writing values.

Returns
Integer The precision.

Referenced by setPrecision().

◆ print()

virtual void Arcane::ISimpleTableReaderWriter::print ( )
pure virtual

Method allowing writing the table to the standard output.

The writing format is free (for the csv implementation, the writing is done the same way as in a csv file).

◆ readTable()

virtual bool Arcane::ISimpleTableReaderWriter::readTable ( const Directory & src,
const String & file_name )
pure virtual

Method allowing reading a file containing a simple table.

The extension will be added by the implementation.

A call to SimpleTableInternal::clear() must be performed before reading.

The elements that must be retrieved are:

  • row names (m_row_names),
  • column names (m_column_names),
  • table name (m_table_name),
  • table values (m_values).

The elements that must be deduced if not retrieved are:

  • row sizes (m_row_sizes),
  • column sizes (m_column_sizes).

Default deduction for m_row_sizes:

  • len(m_row_sizes) = len(m_row_names)
  • m_row_sizes[*] = m_values.dim2Size()

Default deduction for m_column_sizes:

  • len(m_column_sizes) = len(m_column_names)
  • m_column_sizes[*] = m_values.dim1Size()
Parameters
srcThe source directory.
file_nameThe file name (without extension).
Returns
true If the file was successfully read.
false If the file could not be read.

◆ setFixed()

virtual void Arcane::ISimpleTableReaderWriter::setFixed ( bool fixed)
pure virtual

Method allowing setting or unsetting the 'std::fixed' flag.

For both the 'print()' method and the 'writetable()' method.

This flag allows 'forcing' the number of digits after the comma to the desired precision. For example, if 'setPrecision(4)' was called, and 'setFixed(true)' is called, the print of '6.1' will yield '6.1000'.

Warning
The "std::fixed" flag modifies the behavior of "setPrecision()"; if the "std::fixed" flag is disabled, the precision defines the total number of digits (before and after the comma); if the "std::fixed" flag is enabled, the precision defines the number of digits after the comma. Therefore, attention must be paid when using "std::numeric_limits<Real>::max_digits10" (for writing) or "std::numeric_limits<Real>::digits10" (for reading), which should be used without the "std::fixed" flag.
Parameters
fixedWhether the 'std::fixed' flag should be set or not.

◆ setForcedToUseScientificNotation()

virtual void Arcane::ISimpleTableReaderWriter::setForcedToUseScientificNotation ( bool use_scientific)
pure virtual

Method allowing setting or unsetting the 'std::scientific' flag.

For both the 'print()' method and the 'writetable()' method.

This flag allows 'forcing' the display of values in scientific notation during writing.

Parameters
use_scientificWhether the 'std::scientific' flag should be set or not.

◆ setInternal()

virtual void Arcane::ISimpleTableReaderWriter::setInternal ( const Ref< SimpleTableInternal > & simple_table_internal)
pure virtual

Method allowing setting a reference to a SimpleTableInternal.

Parameters
simple_table_internalThe reference to a SimpleTableInternal.

◆ setPrecision()

virtual void Arcane::ISimpleTableReaderWriter::setPrecision ( Integer precision)
pure virtual

Method allowing modification of the print precision.

For both the 'print()' method and the 'writetable()' method.

Warning
The "std::fixed" flag modifies the behavior of "setPrecision()"; if the "std::fixed" flag is disabled, the precision defines the total number of digits (before and after the comma); if the "std::fixed" flag is enabled, the precision defines the number of digits after the comma. Therefore, attention must be paid when using "std::numeric_limits<Real>::max_digits10" (for writing) or "std::numeric_limits<Real>::digits10" (for reading), which should be used without the "std::fixed" flag.
Parameters
precisionThe new precision.

References precision().

◆ writeTable()

virtual bool Arcane::ISimpleTableReaderWriter::writeTable ( const Directory & dst,
const String & file_name )
pure virtual

Method allowing writing a simple table to a file.

The extension will be added by the implementation.

The destination directory will be created by the implementation if it does not exist.

The SimpleTableInternal elements that must be written are:

  • row names (m_row_names),
  • column names (m_column_names),
  • table name (m_table_name),
  • table values (m_values).

Other SimpleTableInternal elements are not mandatory.

Parameters
dstThe destination directory.
file_nameThe file name (without extension).
Returns
true If the file was successfully written.
false If the file could not be written.

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