|
bitsim
Model, simulate, estimate and control robots in C++
|
The CSVFileReader class. More...
#include <csv_file_reader.h>


Public Member Functions | |
| CSVFileReader (const std::string &file_path, const std::string delimeter=CSVFileReader::default_delimeter()) | |
| Constructor. | |
| ~CSVFileReader () | |
| Destructor. Close the file if it is empty. | |
| std::vector< std::string > | read_line () |
| Read a line from the file, split at the delimiter. The file must be open. Lines that start with # are comments and are skipped, such as the header and the column names that CSVWriter writes. At the end of the file the result is empty. | |
| std::vector< uint_t > | read_line_as_uint () |
| read_line_as_uint. Read the line as uint | |
| Public Member Functions inherited from bitsim::utils::io::FileReaderBase | |
| virtual | ~FileReaderBase ()=default |
| virtual void | open () override |
| Attempts to open the file for reading. | |
| bool | eof () const |
| Returns true if the underlying stream handler has reached the EOF. | |
| Public Member Functions inherited from bitsim::utils::io::FileHandlerBase< std::ifstream > | |
| virtual | ~FileHandlerBase () |
| Destructor. Ensures that the file is properly closed. | |
| FileFormats::Type | get_type () const noexcept |
| Returns the type/format of the file. | |
| handler_type & | get_file_stream () noexcept |
| Provides mutable access to the underlying file stream. | |
| std::string | get_filename () const noexcept |
| Returns the file name associated with this handler. | |
| std::filesystem::path | get_file_path () const noexcept |
| Returns the file path associated with this handler. | |
| bool | is_open () const noexcept |
| Checks whether the file is currently open. | |
| virtual void | close () |
| Closes the file if it is currently open. | |
Static Public Member Functions | |
| static std::string | default_delimeter () |
| The default column delimiter. | |
Additional Inherited Members | |
| Public Types inherited from bitsim::utils::io::FileHandlerBase< std::ifstream > | |
| using | handler_type |
| Protected Member Functions inherited from bitsim::utils::io::FileReaderBase | |
| FileReaderBase (const std::string &file_name, FileFormats::Type t) | |
| Constructor. | |
| Protected Member Functions inherited from bitsim::utils::io::FileHandlerBase< std::ifstream > | |
| FileHandlerBase (const std::string &file_name, FileFormats::Type t) | |
| Protected constructor. | |
| Protected Attributes inherited from bitsim::utils::io::FileHandlerBase< std::ifstream > | |
| std::string | file_name_ |
| The name of the file to read from or write to. | |
| const FileFormats::Type | t_ |
| The format/type of the file. | |
| handler_type | f_ |
| The underlying file stream/handler. | |
The CSVFileReader class.
| bitsim::utils::io::CSVFileReader::CSVFileReader | ( | const std::string & | file_path, |
| const std::string | delimeter = CSVFileReader::default_delimeter() ) |
Constructor.
| bitsim::utils::io::CSVFileReader::~CSVFileReader | ( | ) |
Destructor. Close the file if it is empty.
|
inlinestatic |
The default column delimiter.
| std::vector< std::string > bitsim::utils::io::CSVFileReader::read_line | ( | ) |
Read a line from the file, split at the delimiter. The file must be open. Lines that start with # are comments and are skipped, such as the header and the column names that CSVWriter writes. At the end of the file the result is empty.
| std::vector< uint_t > bitsim::utils::io::CSVFileReader::read_line_as_uint | ( | ) |
read_line_as_uint. Read the line as uint