SNode.C
Loading...
Searching...
No Matches
FileReader.h
Go to the documentation of this file.
1
/*
2
* SNode.C - a slim toolkit for network communication
3
* Copyright (C) Volker Christian <me@vchrist.at>
4
* 2020, 2021, 2022, 2023, 2024, 2025
5
*
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published
8
* by the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#
ifndef
CORE_FILE_FILEREADER_H
21
#
define
CORE_FILE_FILEREADER_H
22
23
#
include
"core/EventReceiver.h"
24
#
include
"core/file/File.h"
25
#
include
"core/pipe/Source.h"
// IWYU pragma: export
26
27
#
ifndef
DOXYGEN_SHOULD_SKIP_THIS
28
29
#
include
<
cstddef
>
30
#
include
<
string
>
31
32
#
endif
/* DOXYGEN_SHOULD_SKIP_THIS */
33
34
namespace
core::file {
35
36
class
FileReader
37
:
public
core
::
EventReceiver
38
,
public
core::pipe::
Source
39
,
virtual
public
File
{
40
private
:
41
FileReader
(
int
fd,
const
std::string& name, std::size_t pufferSize,
int
openErrno);
42
43
public
:
44
static
FileReader
*
open
(
const
std::string& path);
45
46
bool
isOpen
()
override
;
47
48
void
start
()
final
;
49
void
suspend
()
final
;
50
void
resume
()
final
;
51
void
stop
()
final
;
52
53
private
:
54
void
onEvent
(
const
utils::
Timeval
& currentTime)
override
;
55
56
std
::
size_t
pufferSize
= 0;
57
58
bool
suspended
=
false
;
59
60
protected
:
61
int
openErrno
= 0;
62
bool
running
=
false
;
63
};
64
65
}
// namespace core::file
66
67
#
endif
// CORE_FILE_FILEREADER_H
MF_READSIZE
constexpr int MF_READSIZE
Definition
FileReader.cpp:33
core::file::FileReader
Definition
FileReader.h:39
core::file::FileReader::stop
void stop() final
Definition
FileReader.cpp:105
core::file::FileReader::pufferSize
std::size_t pufferSize
Definition
FileReader.h:56
core::file::FileReader::onEvent
void onEvent(const utils::Timeval ¤tTime) override
Definition
FileReader.cpp:56
core::file::FileReader::running
bool running
Definition
FileReader.h:62
core::file::FileReader::open
static FileReader * open(const std::string &path)
Definition
FileReader.cpp:44
core::file::FileReader::openErrno
int openErrno
Definition
FileReader.h:61
core::file::FileReader::start
void start() final
Definition
FileReader.cpp:85
core::file::FileReader::suspend
void suspend() final
Definition
FileReader.cpp:92
core::file::FileReader::FileReader
FileReader(int fd, const std::string &name, std::size_t pufferSize, int openErrno)
Definition
FileReader.cpp:37
core::file::FileReader::isOpen
bool isOpen() override
Definition
FileReader.cpp:52
core::file::FileReader::suspended
bool suspended
Definition
FileReader.h:58
core::file::FileReader::resume
void resume() final
Definition
FileReader.cpp:98
core::pipe::Source
Definition
Source.h:38
core::pipe::Source::error
void error(int errnum)
Definition
Source.cpp:87
core::pipe::Source::eof
void eof()
Definition
Source.cpp:81
utils::Timeval
Definition
Timeval.h:36
core
file
FileReader.h
Generated on Mon Feb 10 2025 20:20:46 for SNode.C by
1.11.0