[ 
https://issues.apache.org/jira/browse/MINIFICPP-1955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17613500#comment-17613500
 ] 

Marton Szasz edited comment on MINIFICPP-1955 at 10/6/22 12:54 PM:
-------------------------------------------------------------------

Not all streams are able to seek. Some can only seek forward, some only 
backward. Some are even random access, like BufferStream. Some streams can be 
written to, some can be read from, some can do both. And these are all 
orthogonal properties.

I believe we should drop the class hierarchy in favor of a concept hierarchy, 
where we specify requirements for each use case, and streams may implement one 
or more of them. ForwardSeekable and Stream can be new concepts. We can write 
type erasure wrapper types for the use cases where dynamic polymorphism is 
required, or it's not desirable to move the code to the headers.


was (Author: szaszm):
Not all streams are able to seek. Some can only seek forward, some only 
backward. Some are even random access, like BufferStream.

I believe we should drop the class hierarchy in favor of a concept hierarchy, 
where we specify requirements for each use case, and streams may implement one 
or more of them. ForwardSeekable and Stream can be new concepts. We can write 
type erasure wrapper types for the use cases where dynamic polymorphism is 
required, or it's not desirable to move the code to the headers.

> Revisit Stream::seek
> --------------------
>
>                 Key: MINIFICPP-1955
>                 URL: https://issues.apache.org/jira/browse/MINIFICPP-1955
>             Project: Apache NiFi MiNiFi C++
>          Issue Type: Bug
>            Reporter: Adam Debreceni
>            Priority: Major
>
> Currently Stream::seek aims to set both the read and write offsets into the 
> stream, we should talk this through, possibly mimic seekg/seekp (also 
> BufferStream::seek is noop when writing)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to