Base class from which all file readers must inherit.
More...
#include <Mesh/FileIO/Readers/basereader.h>
◆ BaseReader()
- Parameters
-
fName | Defines the base file name for the reader. The file name extension can be omitted if it matches the return value of GetFormatExtension(). |
The constructor initially sets the baseNameSuffix data member to an empty string. This suffix is easily changed through a call to SetBaseNameSuffix(). The final file name is constructed as the base file name (fName), followed by the base filename suffix (set with SetBaseNameSuffix()) and then the filename extension if necessary.
◆ ~BaseReader()
◆ Close()
Close the file, if it is open. The user would not normally need to do this, as it is handled automatically by the read functions.
◆ ExtractBaseName()
std::string ExtractBaseName |
( |
const std::string & |
fileName | ) |
|
- Returns
- The name of the file fileName without the path, the filename suffix and the extension.
◆ FileLength()
- Returns
- The total file size of the current file being read.
◆ FilePosition()
- Returns
- The current position within the file being read.
◆ Flush()
Flush the file's contents. Not usually called directly by the user and questionable whether it should ever be used at all for reading a file.
◆ GetBaseName()
std::string GetBaseName |
( |
| ) |
const |
|
inline |
- Returns
- The name of the file without path. The filename extension will also typically be omitted.
◆ GetBaseNameSuffix()
std::string GetBaseNameSuffix |
( |
| ) |
const |
|
inline |
◆ GetFileName()
std::string GetFileName |
( |
| ) |
const |
- Returns
- The name of the file without path. The filename suffix and extension will be included.
◆ GetFormatExtension()
virtual std::string GetFormatExtension |
( |
| ) |
const |
|
pure virtual |
◆ GetFormatName()
virtual std::string GetFormatName |
( |
| ) |
const |
|
pure virtual |
◆ GetNextNonBlankLine()
bool GetNextNonBlankLine |
( |
std::string & |
inputLine | ) |
|
|
protected |
◆ GetTerminateExecution()
bool GetTerminateExecution |
( |
| ) |
const |
|
inline |
◆ IsOpen()
- Returns
- True if the file is currently open.
◆ IsReady()
- Returns
- True if the file is open and ready for writing.
◆ Open()
Open the input file with the current name settings. The user would not normally need to do this, as it is handled automatically by the various Read() functions.
- Returns
- The name of the input file, including any filename extension used. If a file could not be opened, an empty string is returned.
◆ postFileNameChanged()
virtual void postFileNameChanged |
( |
| ) |
|
|
inlineprotectedvirtual |
◆ SetBaseName()
void SetBaseName |
( |
const std::string & |
base | ) |
|
|
inline |
- Parameters
-
base | The name of the file to read, typically without the filename extension. |
If the reader currently has a file open, it will be closed by this call.
Additionally, postFileNameChanged is called; by default, it does nothing; however, since it is a virtual function, derived classes may wish to reimplement it whenever the base file has changed.
◆ SetBaseNameSuffix() [1/4]
void SetBaseNameSuffix |
( |
const std::string & |
suffix | ) |
|
|
inline |
◆ SetBaseNameSuffix() [2/4]
void SetBaseNameSuffix |
( |
double |
caseNum, |
|
|
const std::string & |
caseLabel = "_" |
|
) |
| |
|
inline |
◆ SetBaseNameSuffix() [3/4]
void SetBaseNameSuffix |
( |
int |
caseNum, |
|
|
const std::string & |
caseLabel = "_" |
|
) |
| |
|
inline |
◆ SetBaseNameSuffix() [4/4]
void SetBaseNameSuffix |
( |
T |
caseNum, |
|
|
const std::string & |
caseLabel = "_" |
|
) |
| |
|
inline |
◆ SetFileName()
void SetFileName |
( |
const std::string & |
fileName | ) |
|
- Parameters
-
fileName | The name of the file to read. The extension is optional, but if both compressed and uncompressed files exist, the extension should be explicitly included to ensure the right one is selected. |
If the reader currently has a file open, it will be closed by this call. Note that this also checks for .gz as part of the file name extension to support reading from compressed files.
- Note
- Any base name suffix will be included as part of the base name by this call, so if you really want to use the suffix functionality, don't use this function. The suffix functionality will be removed in a future version anyway.
◆ SetProgress()
void SetProgress |
( |
int |
progress | ) |
|
|
virtual |
◆ SetTerminateExecution()
void SetTerminateExecution |
( |
bool |
b | ) |
|
|
inline |
◆ baseName
◆ baseNameSuffix
std::string baseNameSuffix |
|
protected |
◆ inFile
◆ progress_
◆ terminateExecution_