BmnRoot
26.10.0-233-gb9bbe585
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
BmnFileReaderRaw.cxx
Go to the documentation of this file.
1
// headers from this target
2
#include "
BmnFileReaderRaw.h
"
3
4
// o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
5
// ================== BmnFileReaderZstd public methods ==================
6
// o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
7
8
BmnFileReaderRaw::BmnFileReaderRaw
(
const
std::filesystem::path& aFilePath)
9
:
BmnIFileReader
()
10
,
fInputStream
()
11
,
fNextByteToRead
(0ll)
12
{
13
if
(aFilePath.empty())
14
return
;
15
Open
(aFilePath);
16
}
17
18
// ========== BmnIFileReaderInterface ==========
19
20
void
BmnFileReaderRaw::Open
(
const
std::filesystem::path& aFilePath)
21
{
22
if
(
fInputStream
.is_open()) {
23
LOG(error) <<
"Before opening a new stream with `BmnFileReaderRaw::Open`, close the old one!\n"
;
24
return
;
25
}
26
if
(!
PerformStandardChecksBeforeOpening
(aFilePath))
27
return
;
28
fInputStream
.open(aFilePath, std::ios::in | std::ios::binary);
29
}
30
31
void
BmnFileReaderRaw::Close
() noexcept
32
{
33
fInputStream
.close();
34
fNextByteToRead
= 0ll;
35
}
36
37
int64_t
BmnFileReaderRaw::Read
(
void
* dataToFill,
const
int64_t sizeToFill)
38
{
39
fInputStream
.read((
char
*)dataToFill, sizeToFill);
40
int64_t noOfReadBytes =
fInputStream
.gcount();
41
fNextByteToRead
+= noOfReadBytes;
42
return
noOfReadBytes;
43
}
44
45
int64_t
BmnFileReaderRaw::Tell
() const noexcept
46
{
47
return
fNextByteToRead
;
48
}
49
50
void
BmnFileReaderRaw::Seek
(int64_t value)
51
{
52
if
(
fInputStream
.bad())
53
return
;
54
fInputStream
.seekg(value);
55
if
(
fInputStream
.good())
56
fNextByteToRead
= value;
57
}
58
59
bool
BmnFileReaderRaw::IsGood
() const noexcept
60
{
61
return
fInputStream
.good();
62
}
63
64
bool
BmnFileReaderRaw::IsEOF
() const noexcept
65
{
66
return
fInputStream
.eof();
67
}
68
69
void
BmnFileReaderRaw::ClearStateFlags
()
70
{
71
fInputStream
.clear();
72
}
73
74
bool
BmnFileReaderRaw::IsOpen
() const noexcept
75
{
76
return
fInputStream
.is_open();
77
}
78
79
BmnFileType
BmnFileReaderRaw::GetFileType
() const noexcept
80
{
81
return
BmnFileType::Raw
;
82
}
BmnFileType
BmnFileType
Definition
BmnFileProcessingFlags.h:16
BmnFileType::Raw
@ Raw
Definition
BmnFileProcessingFlags.h:18
BmnFileReaderRaw.h
BmnFileReaderRaw::IsOpen
virtual bool IsOpen() const noexcept override
Definition
BmnFileReaderRaw.cxx:74
BmnFileReaderRaw::GetFileType
virtual BmnFileType GetFileType() const noexcept override
Definition
BmnFileReaderRaw.cxx:79
BmnFileReaderRaw::fInputStream
std::ifstream fInputStream
Definition
BmnFileReaderRaw.h:99
BmnFileReaderRaw::ClearStateFlags
virtual void ClearStateFlags() override
Definition
BmnFileReaderRaw.cxx:69
BmnFileReaderRaw::Close
virtual void Close() noexcept override
Definition
BmnFileReaderRaw.cxx:31
BmnFileReaderRaw::fNextByteToRead
int64_t fNextByteToRead
Definition
BmnFileReaderRaw.h:100
BmnFileReaderRaw::Tell
virtual int64_t Tell() const noexcept override
Definition
BmnFileReaderRaw.cxx:45
BmnFileReaderRaw::Open
virtual void Open(const std::filesystem::path &aFilePath) override
Definition
BmnFileReaderRaw.cxx:20
BmnFileReaderRaw::Seek
virtual void Seek(int64_t value) override
Definition
BmnFileReaderRaw.cxx:50
BmnFileReaderRaw::BmnFileReaderRaw
BmnFileReaderRaw(const std::filesystem::path &aFilePath)
Definition
BmnFileReaderRaw.cxx:8
BmnFileReaderRaw::IsEOF
virtual bool IsEOF() const noexcept override
Definition
BmnFileReaderRaw.cxx:64
BmnFileReaderRaw::IsGood
virtual bool IsGood() const noexcept override
Definition
BmnFileReaderRaw.cxx:59
BmnFileReaderRaw::Read
virtual int64_t Read(void *dataToFill, const int64_t sizeToFill) override
Definition
BmnFileReaderRaw.cxx:37
BmnIFileReader::BmnIFileReader
BmnIFileReader()=default
BmnIFileReader::PerformStandardChecksBeforeOpening
bool PerformStandardChecksBeforeOpening(const std::filesystem::path &aFilePath) const noexcept
Definition
BmnIFileReader.cxx:8
compression
sources
BmnFileReaderRaw.cxx
Generated on
for BmnRoot by
1.17.0