bitrl & cuberl Documentation
Simulation engine for reinforcement learning agents
Loading...
Searching...
No Matches
file_reader_base.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2024 <copyright holder> <email>
2// SPDX-License-Identifier: Apache-2.0
3
4#ifndef FILE_READER_BASE_H
5#define FILE_READER_BASE_H
6
7#include "bitrl/bitrl_types.h"
10#include "boost/noncopyable.hpp"
11
12#include <fstream>
13#include <string>
14
15namespace bitrl
16{
17namespace utils
18{
19namespace io
20{
24class FileReaderBase : public FileHandlerBase<std::ifstream>
25{
26 public:
27 virtual ~FileReaderBase() = default;
28
32 virtual void open() override;
33
38 bool eof() const { return this->get_file_stream().eof(); }
39
40 protected:
44 FileReaderBase(const std::string &file_name, FileFormats::Type t);
45};
46
47} // namespace io
48} // namespace utils
49} // namespace bitrl
50#endif // FILE_READER_BASE_H
Definition file_handler_base.h:22
handler_type & get_file_stream() noexcept
Returns the underlying file stream.
Definition file_handler_base.h:39
Definition file_reader_base.h:25
virtual void open() override
Attempts to open the file for reading.
Definition file_reader_base.cpp:14
bool eof() const
Returns true if the underlying stream handler has reached the EOF.
Definition file_reader_base.h:38
virtual ~FileReaderBase()=default
OutT resolve(const std::string &name, const std::map< std::string, std::any > &input)
Definition std_map_utils.h:25
Definition bitrl_consts.h:14
Type
Definition file_formats.h:24