![]() |
0.5.1
|
Abstract File Reader class. More...
Public Types | |
| enum | FileType : uint8_t { NONE , BINARY , ASCII } |
| File Type Enumeration. More... | |
| enum | GuiResult : uint8_t { PATH_UNCHANGED , PATH_CHANGED , PATH_CHANGED_INVALID } |
| Results enum for the gui config. More... | |
Public Member Functions | |
| FileReader (const FileReader &)=delete | |
| Copy constructor. | |
| FileReader (FileReader &&)=delete | |
| Move constructor. | |
| FileReader & | operator= (const FileReader &)=delete |
| Copy assignment operator. | |
| FileReader & | operator= (FileReader &&)=delete |
| Move assignment operator. | |
| virtual | ~FileReader ()=default |
| Destructor. | |
Protected Member Functions | |
| void | deinitialize () |
| Deinitialize the file reader. | |
| virtual FileType | determineFileType () |
| Virtual Function to determine the File Type. | |
| auto | eof () const |
| Check whether the end of file is reached. | |
| FileReader ()=default | |
| Default constructor. | |
| size_t | getCurrentLineNumber () const |
| Get the current line number. | |
| std::filesystem::path | getFilepath () |
| Returns the path of the file. | |
| auto & | getline (std::string &str) |
| Reads a line from the filestream. | |
| bool | good () const |
| Fast error checking. | |
| GuiResult | guiConfig (const char *vFilters, const std::vector< std::string > &extensions, size_t id, const std::string &nameId) |
| ImGui config. | |
| auto & | ignore (std::streamsize count, int delim) |
| Extracts and discards characters from the input stream until and including delim. | |
| bool | initialize () |
| Initialize the file reader. | |
| auto | peek () |
| Looking ahead in the stream. | |
| auto & | read (char *__s, std::streamsize __n) |
| Extraction without delimiters. | |
| virtual void | readHeader () |
| Virtual Function to read the Header of a file. | |
| auto | readsome (char *s, std::streamsize count) |
| Extracts up to count immediately available characters from the input stream. The extracted characters are stored into the character array pointed to by s. | |
| void | resetReader () |
| Moves the read cursor to the start. | |
| void | restore (const json &j) |
| Restores the node from a json object. | |
| json | save () const |
| Saves the node into a json object. | |
| auto & | seekg (std::streamoff pos, std::ios_base::seekdir dir) |
| Changing the current read position. | |
| std::streampos | tellg () |
| Getting the current read position. | |
Protected Attributes | |
| FileType | _fileType |
| File Type. | |
| std::vector< std::string > | _headerColumns |
| Header Columns of a CSV file. | |
| std::string | _path |
| Path to the file. | |
Private Attributes | |
| std::streampos | _dataStart |
| Start of the data in the file. | |
| std::ifstream | _filestream |
| File stream to read the file. | |
| size_t | _lineCnt |
| Line counter. | |
| size_t | _lineCntDataStart |
| Line counter data start. | |
Abstract File Reader class.
Definition at line 30 of file FileReader.hpp.
| enum NAV::FileReader::FileType : uint8_t |
File Type Enumeration.
| Enumerator | |
|---|---|
| NONE | Not specified. |
| BINARY | Binary data. |
| ASCII | Ascii text data. |
Definition at line 34 of file FileReader.hpp.
| enum NAV::FileReader::GuiResult : uint8_t |
Results enum for the gui config.
| Enumerator | |
|---|---|
| PATH_UNCHANGED | No changes made. |
| PATH_CHANGED | The path changed and exists. |
| PATH_CHANGED_INVALID | The path changed but does not exist or is invalid. |
Definition at line 53 of file FileReader.hpp.
|
virtualdefault |
Destructor.
|
delete |
Copy constructor.
|
delete |
Move constructor.
|
protecteddefault |
Default constructor.
|
protected |
Deinitialize the file reader.
Definition at line 136 of file FileReader.cpp.
|
nodiscardprotectedvirtual |
Virtual Function to determine the File Type.
Reimplemented in NAV::CsvFile, NAV::EmlidFile, NAV::KvhFile, NAV::MultiImuFile, NAV::NmeaFile, NAV::RinexNavFile, NAV::RinexObsFile, NAV::RtklibPosFile, NAV::UbloxFile, NAV::UlogFile, and NAV::VectorNavFile.
Definition at line 150 of file FileReader.cpp.
|
inlinenodiscardprotected |
Check whether the end of file is reached.
Definition at line 141 of file FileReader.hpp.
|
inlinenodiscardprotected |
Get the current line number.
Definition at line 152 of file FileReader.hpp.
|
protected |
Returns the path of the file.
Definition at line 44 of file FileReader.cpp.
|
inlineprotected |
Reads a line from the filestream.
| str | String to read the line into |
Definition at line 103 of file FileReader.hpp.
|
inlinenodiscardprotected |
Fast error checking.
Definition at line 145 of file FileReader.hpp.
|
protected |
ImGui config.
| [in] | vFilters | Filter to apply for file names |
| [in] | extensions | Extensions to filter |
| [in] | id | Unique id for creating the dialog uid |
| [in] | nameId | Name of the node triggering the window used for logging |
Definition at line 23 of file FileReader.cpp.
|
inlineprotected |
Extracts and discards characters from the input stream until and including delim.
| count | number of characters to extract |
| delim | delimiting character to stop the extraction at. It is also extracted. |
Definition at line 126 of file FileReader.hpp.
|
protected |
Initialize the file reader.
Definition at line 76 of file FileReader.cpp.
|
delete |
Copy assignment operator.
|
delete |
Move assignment operator.
|
inlinenodiscardprotected |
Looking ahead in the stream.
Definition at line 149 of file FileReader.hpp.
|
inlineprotected |
Extraction without delimiters.
| __s | A character array. |
| __n | Maximum number of characters to store. |
Definition at line 120 of file FileReader.hpp.
|
protectedvirtual |
Virtual Function to read the Header of a file.
The base implementation reads a CSV file header
Reimplemented in NAV::CsvFile, NAV::MultiImuFile, NAV::NmeaFile, NAV::RinexNavFile, NAV::RinexObsFile, NAV::RtklibPosFile, NAV::UlogFile, and NAV::VectorNavFile.
Definition at line 177 of file FileReader.cpp.
|
inlineprotected |
Extracts up to count immediately available characters from the input stream. The extracted characters are stored into the character array pointed to by s.
| [out] | s | pointer to the character array to store the characters to |
| [in] | count | maximum number of characters to read |
Definition at line 113 of file FileReader.hpp.
|
protected |
Moves the read cursor to the start.
Definition at line 203 of file FileReader.cpp.
|
protected |
Restores the node from a json object.
| [in] | j | Json object with the node state |
Definition at line 66 of file FileReader.cpp.
|
nodiscardprotected |
Saves the node into a json object.
Definition at line 55 of file FileReader.cpp.
|
inlineprotected |
Changing the current read position.
| pos | A file offset object. |
| dir | The direction in which to seek. |
Definition at line 133 of file FileReader.hpp.
|
inlinenodiscardprotected |
Getting the current read position.
Definition at line 138 of file FileReader.hpp.
|
private |
Start of the data in the file.
Definition at line 166 of file FileReader.hpp.
|
private |
File stream to read the file.
Definition at line 164 of file FileReader.hpp.
|
protected |
File Type.
Definition at line 157 of file FileReader.hpp.
|
protected |
Header Columns of a CSV file.
Definition at line 160 of file FileReader.hpp.
|
private |
Line counter.
Definition at line 168 of file FileReader.hpp.
|
private |
Line counter data start.
Definition at line 170 of file FileReader.hpp.
|
protected |
Path to the file.
Definition at line 155 of file FileReader.hpp.