bitrl & cuberl Documentation
Simulation engine for reinforcement learning agents
Loading...
Searching...
No Matches
bitrl::utils::io::CSVFileReader Class Reference

The CSVFileReader class. More...

#include <csv_file_reader.h>

Inheritance diagram for bitrl::utils::io::CSVFileReader:
Collaboration diagram for bitrl::utils::io::CSVFileReader:

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. It attempts to open the file if the file is not already open.
 
std::vector< uint_tread_line_as_uint ()
 read_line_as_uint. Read the line as uint
 
- Public Member Functions inherited from bitrl::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 bitrl::utils::io::FileHandlerBase< std::ifstream >
virtual ~FileHandlerBase ()
 Constructor.
 
FileFormats::Type get_type () const noexcept
 Returns the type of the file.
 
handler_typeget_file_stream () noexcept
 Returns the underlying file stream.
 
const handler_typeget_file_stream () const noexcept
 Returns the underlying file stream.
 
std::string get_filename () const noexcept
 Returns the filename that is used to write.
 
bool is_open () const noexcept
 Return true if and only if the file is open.
 
virtual void close ()
 Close the file. Return true if and only if the file was closed successfully false otherwise.
 

Static Public Member Functions

static std::string default_delimeter ()
 The default column delimiter.
 

Additional Inherited Members

- Public Types inherited from bitrl::utils::io::FileHandlerBase< std::ifstream >
typedef std::ifstream handler_type
 
- Protected Member Functions inherited from bitrl::utils::io::FileReaderBase
 FileReaderBase (const std::string &file_name, FileFormats::Type t)
 Constructor.
 
- Protected Member Functions inherited from bitrl::utils::io::FileHandlerBase< std::ifstream >
 FileHandlerBase (const std::string &file_name, FileFormats::Type t)
 protected Constructor so that explicit instantiation of the class fails
 
- Protected Attributes inherited from bitrl::utils::io::FileHandlerBase< std::ifstream >
std::string file_name_
 The name of the file to write.
 
const FileFormats::Type t_
 The format of the file.
 
handler_type f_
 The low level file handler.
 

Detailed Description

The CSVFileReader class.

Constructor & Destructor Documentation

◆ CSVFileReader()

bitrl::utils::io::CSVFileReader::CSVFileReader ( const std::string &  file_path,
const std::string  delimeter = CSVFileReader::default_delimeter() 
)

Constructor.

◆ ~CSVFileReader()

bitrl::utils::io::CSVFileReader::~CSVFileReader ( )

Destructor. Close the file if it is empty.

Member Function Documentation

◆ default_delimeter()

static std::string bitrl::utils::io::CSVFileReader::default_delimeter ( )
inlinestatic

The default column delimiter.

◆ read_line()

std::vector< std::string > bitrl::utils::io::CSVFileReader::read_line ( )

Read a line from the file. It attempts to open the file if the file is not already open.

◆ read_line_as_uint()

std::vector< uint_t > bitrl::utils::io::CSVFileReader::read_line_as_uint ( )

read_line_as_uint. Read the line as uint


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