[haiku-development] Re: Peek function in BPositionIO or BDataIO?

  • From: Rene Gollent <anevilyak@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 21 Jun 2016 20:24:46 -0400

On Jun 21, 2016 6:45 PM, "Dario Casalinuovo" <b.vitruvio@xxxxxxxxx> wrote:


From the BDataIO point of view there's not a way to do that. But, yes, it's 
not something to care about as it seems in the end we are always forced to 
use something derived from BPositionIO.

That's the whole point of the separation of the two. BDataIO is a
simple interface that isn't position aware, while BPositionIO adds
that extra level of sophistication. Ergo, if the application code
that's consuming the interface doesn't require position awareness, it
can simply take a BDataIO pointer/reference. Since any BPositionIO is
implicitly a BDataIO, those can simply be used without any extra
effort. On the other hand, if positional awareness is required, then
the minimum that should be accepted is BPositionIO, since BDataIO
doesn't guarantee that level of capability. If code is taking a
BDataIO as input, but expecting positional capabilities, then that
code is simply designed incorrectly, and hacking the interfaces to
remove that separation is the wrong way to solve that.

Regards,

Rene

Other related posts: