Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
43fe513d
Commit
43fe513d
authored
May 22, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/buffering: add API documentation
parent
c1b853ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
BufferingInputStream.hxx
src/input/BufferingInputStream.hxx
+35
-0
No files found.
src/input/BufferingInputStream.hxx
View file @
43fe513d
...
...
@@ -64,9 +64,21 @@ class BufferingInputStream : InputStreamHandler {
static
constexpr
size_t
INVALID_OFFSET
=
~
size_t
(
0
);
public
:
/**
* Allocate a buffer which fits the given #InputStream and
* start a thread reading into the buffer.
*
* Throws on error.
*
* @param _input a seekable #InputStream with a known size
*/
explicit
BufferingInputStream
(
InputStreamPtr
_input
);
~
BufferingInputStream
()
noexcept
;
/**
* Caller must lock the mutex.
*/
const
auto
&
GetInput
()
const
noexcept
{
return
*
input
;
}
...
...
@@ -75,12 +87,35 @@ public:
return
buffer
.
size
();
}
/**
* Wrapper for InputStream::Check().
*
* Throws on error.
*
* Caller must lock the mutex.
*/
void
Check
();
/**
* Check whether data is available in the buffer at the given
* offset..
*/
bool
IsAvailable
(
size_t
offset
)
noexcept
;
/**
* Copy data from the buffer into the given pointer.
*
* @return the number of bytes copied into the given pointer.
*/
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
size_t
offset
,
void
*
ptr
,
size_t
size
);
protected
:
/**
* This virtual method gets called each time data has been
* added to the buffer. During this method call, the mutex is
* locked.
*/
virtual
void
OnBufferAvailable
()
noexcept
{}
private
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment