From: Mark Lorenzen <mark.lorenzen@ofir.dk>
Subject: Re: Converting access values
Date: 07 Jan 2005 20:49:32 +0100
Date: 2005-01-07T20:49:32+01:00 [thread overview]
Message-ID: <m31xcxdnoz.fsf@0x53586c58.boanxx18.adsl-dhcp.tele.dk> (raw)
In-Reply-To: gemini.i9yho1003y2gn02as.nick.roberts@acm.org
Nick Roberts <nick.roberts@acm.org> writes:
> Mark Lorenzen <mark.lorenzen@ofir.dk> wrote:
>
> > ...
> > My problem is not passing a slice as an actual parameter to a subprogram.
> > I have a task which receives Buf, slices it up and then passes the slices
> > to other tasks using queues implemented as protected types. When passing
> > the slice to a queue, it will probably not be done by copy, but the queue
> > puts the slice into a data structure (list, array etc.) and there we
> > definately have a real assignment and copy.
>
> Mark, you are a silly sausage! All you do is pass the /bounds/ to the tasks.
> When a task finally comes to actually process a slice, it uses the bounds
> passed to it to obtain the actual slice of the buffer. Since there is only
> one buffer, it can be a global, and parts of it do not need to be passed as
> a parameter anywhere. Would this not work for you?
As I said in another posting, I am going for a design like this:
type Buffer_Slice is
record
Data : Buffer_Ptr;
First : Ada.Streams.Stream_element_Offset;
Last : Ada.Streams.Stream_element_Offset;
end record;
There will be several buffers allocated/deallocated from a pool, so
the reference is a part of the Buffer_Slice type.
[cut]
>
>
> Does this actually solve your problem, or am I missing something?
It solves the problem, but exposes a bit more information to the
clients than necessary. It is very easy for a client to address a
slice outside the bounds:
Buffer.Data (Buffer.First - 10 .. Buffer.Last + 15)
But there is of course also the risk of over-engineering the buffer,
so I will settle with the above design.
>
> --
> Nick Roberts
- Mark Lorenzen
next prev parent reply other threads:[~2005-01-07 19:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-05 22:31 Converting access values Mark Lorenzen
2005-01-05 23:32 ` Stephen Leake
2005-01-05 23:51 ` Mark Lorenzen
2005-01-06 0:18 ` Jeffrey Carter
2005-01-06 0:28 ` Mark Lorenzen
2005-01-07 16:55 ` Nick Roberts
2005-01-07 19:49 ` Mark Lorenzen [this message]
2005-01-07 20:23 ` Nick Roberts
2005-01-07 21:23 ` Robert A Duff
2005-01-11 17:02 ` Upkeep
2005-01-11 21:37 ` Robert A Duff
2005-01-12 4:56 ` Alexander E. Kopilovich
2005-01-12 10:48 ` Dmitry A. Kazakov
2005-01-07 21:17 ` Randy Brukardt
2005-01-07 22:15 ` Robert A Duff
2005-01-06 10:52 ` Dmitry A. Kazakov
2005-01-06 11:02 ` Duncan Sands
2005-01-06 12:17 ` Martin Dowie
2005-01-06 19:30 ` Mark Lorenzen
2005-01-06 20:40 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox