2#ifndef BmnIFileReader_h
3#define BmnIFileReader_h
10#include <fairlogger/Logger.h>
78 const
std::
string& fileName,
88 std::
string&& fileName,
99 const
std::filesystem::path& filePath,
110 std::filesystem::path&& filePath,
126 virtual int64_t
Read(
void* dataPointer, int64_t numberOfBytesToRead) = 0;
131 [[nodiscard]] virtual int64_t
Tell() const noexcept = 0;
139 virtual
void Seek(int64_t aNewReadingPosition) = 0;
144 [[nodiscard]] virtual
bool IsGood() const noexcept = 0;
149 [[nodiscard]] virtual
bool IsEOF() const noexcept = 0;
160 [[nodiscard]] virtual
bool IsOpen() const noexcept = 0;
215 LOG(error) <<
"You may not change file name of BmnIFileReader when it's already open!\n";
224 LOG(error) <<
"You may not change file name of BmnIFileReader when it's already open!\n";
233 LOG(error) <<
"You may not change file path of BmnIFileReader when it's already open!\n";
242 LOG(error) <<
"You may not change file path of BmnIFileReader when it's already open!\n";
262 return std::filesystem::file_size(
fFilePath);
268 LOG(error) <<
"You may not modify flags of BmnIFileReader when a file is already open!\n";
277 LOG(error) <<
"You may not modify flags of BmnIFileReader when a file is already open!\n";
286 LOG(error) <<
"You may not modify flags of BmnIFileReader when a file is already open!\n";
virtual ~BmnIFileReader()=default
BmnIFileReader(const BmnFileType fileType, const std::string &fileName="")
virtual void Close() noexcept=0
std::filesystem::path fFilePath
bool PerformStandardChecksBeforeOpening(const BmnBinaryFileProcessingOptions processingFlags)
void SetFilePath(const std::string &fileName)
void RemoveProcessingFlags(const BmnBinaryFileProcessingOptions) noexcept
BmnBinaryFileProcessingOptions fProcessingFlags
BmnIFileReader(const BmnFileType fileType, const std::filesystem::path &filePath)
BmnIFileReader(BmnIFileReader &&) noexcept=delete
BmnIFileReader & operator=(const BmnIFileReader &)=delete
std::filesystem::path & GetFilePath() noexcept
BmnBinaryFileProcessingOptions GetProcessingFlags() const noexcept
virtual bool IsOpen() const noexcept=0
virtual void Open(const BmnBinaryFileProcessingOptions processingFlags=BmnBinaryFileProcessingOptions::ReadBinary)=0
virtual void Seek(int64_t aNewReadingPosition)=0
BmnFileType GetFileType() const noexcept
virtual int64_t Tell() const noexcept=0
virtual bool IsEOF() const noexcept=0
BmnIFileReader(const BmnFileType fileType, std::string &&fileName) noexcept
BmnIFileReader(const BmnFileType fileType, std::filesystem::path &&filePath) noexcept
int64_t GetInputFileSize() const
BmnIFileReader(const BmnIFileReader &)=delete
void SetProcessingFlags(const BmnBinaryFileProcessingOptions) noexcept
void AddProcessingFlags(const BmnBinaryFileProcessingOptions) noexcept
virtual int64_t Read(void *dataPointer, int64_t numberOfBytesToRead)=0
virtual bool IsGood() const noexcept=0
virtual void ClearStateFlags()=0
BmnBinaryFileProcessingOptions