Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-09-05 20:56:52


"Pavel Vozenilek" <pavel_vozenilek_at_[hidden]> wrote in message
news:chde69$sre$1_at_sea.gmane.org...
>
> "Jonathan Turkanis" wrote:
>
> > > I meant something like:
> > >
> > > repeater_stream(repeat(2, 'a', 'b', 'c', 'd', repeat('e', 4)), 'f',
> 'g');
> > >
> > > which would produce sequence:
> > >
> > > a, b, c, d, e, e, e, e,
> > > a, b, c, d, e, e, e, e,
> > > f, g
> > > and again
> > >
> > > The syntax is secondary, main point is that the generated data could
> > > be typed easily.
> >
> > Could you give an example application?
> >
> Generator of tests for compression engine.
>
> But it coule be worked around:
> vector<char> v;
> v += 'a, b', repeat(.....), .......
> stream_from_vector s(v);
>
> so its not really needed. Just be be able to repeat
> input collection N times or forever should be enough.

Okay.

> > > > Doable, but presents some problems with buffer synchronization. There
> is
> > > > currently no generic sync() function or Synchronizable concept.
> > > >
> > > Maybe this could be added (with Flush name)?
> >
> > I had this before, but ripped it out when I added close -- probably
> prematurely.
> >
> Would it make sense to have Discard concept which would discard
> whatever cached data the streams may hold?

I'm starting to think it would be very useful to have a Flushable concept, which
would allow components to advertise that they can send all buffered data
downstream at any time. I haven't given it much though yet, but I think it would
allow OuputFilters to be inserted and removed in the middle of processing a
character sequence, as Dietmar suggested.

Input and output are usually very similar, but in this case there doesn't seem
to be a suitable concept corresponding to Flushable for input sequences. True,
one could discard data that had been read in advance for efficiency, but is that
what users would really want? Ideally, one would want each component in the
chain to put back the buffered data. This sounds like it might be possible,
until you realize that some of the data would have to be 'unfiltered' before it
could be put back.

Any suggestions?

Jonathan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk