Skip to content

Add basic memory buffer streams#11

Merged
BurningEnlightenment merged 7 commits intomasterfrom
dev/9-add-basic-memory-buffer-streams
Feb 15, 2023
Merged

Add basic memory buffer streams#11
BurningEnlightenment merged 7 commits intomasterfrom
dev/9-add-basic-memory-buffer-streams

Conversation

@BurningEnlightenment
Copy link
Copy Markdown
Contributor

Purpose

Resolves #9

Solution Sketch

See the commit log for detailed information.

The old filename is a left over from the coexistence with the legacy
streams.

Refactor all test code to use the test output streams instead the public
`memory_output_stream` API.

BREAKING CHANGE: Includes of `dplx/dp/streams/memory_output_stream2.hpp`
        must be updated to `dplx/dp/streams/memory_output_stream.hpp`
Add convenience overloads to `input_buffer` APIs taking a pointer to
a buffer and its size as arguments. These are convenience overloads due
to the fact that under the Windows x64 calling convention `std::span`
cannot be passed via registers (as opposed to the Itanium x64 calling
convention).
Add convenience overloads to `output_buffer` APIs taking a pointer to
a buffer and its size as arguments. These are convenience overloads due
to the fact that under the Windows x64 calling convention `std::span`
cannot be passed via registers (as opposed to the Itanium x64 calling
convention).

- Improve the parameter naming of related APIs.
Not marking the move special member functions as deleted lets non owning
streams implement them intuitively. However, this comes at the cost of
owning streams heaving to `reset()` the moved from buffer subobject.
in order to ease encoding to buffers.
rvalue output stream references are intentionally excluded from
satisfying `output_stream` due to the fact that one has no way of
retrieving information about the temporay stream object. However, prior
to this change it was possible for such rvalue references to be
considered for implicit conversions to any `get_*_buffer` tag_invoke
overload.
Add the most simple `input_buffer` implementation wrapping an existing
memory buffer. Allow rvalue references of byte spans to be converted to
said buffer in order to allow quick decoding of arbitrary buffers.
lvalue byte span references are explicitly forbidden, due to the fact
that there is no way to relay consumed byte information to the caller
in a ergonomic way. E.g. updating the span object to the remaining bytes
leaves the owner without a way to recover the original span and updating
const references is outright impossible.
@BurningEnlightenment BurningEnlightenment merged commit b868ea9 into master Feb 15, 2023
@BurningEnlightenment BurningEnlightenment deleted the dev/9-add-basic-memory-buffer-streams branch February 15, 2023 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add basic memory buffer streams

1 participant