Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > Re: using put p...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 5 Topic 5688 of 5922
Post > Topic >>

Re: using put procedure with a generic package

by "Dmitry A. Kazakov" <mailbox@[EMAIL PROTECTED] > May 8, 2008 at 09:24 AM

On Wed, 7 May 2008 21:48:47 -0700 (PDT), ophir.geffen@[EMAIL PROTECTED]
 wrote:

> The problem is that the package needs to know how to handle most non-
> limited types like Integer, String, Client, Plane, Book, Do***ent, ...

String is an indefinite type.

> Is there a better way to write the package and/or a more correct way
> to declare it when using it?

That depends on what your queue package is. If it is a queue of items with

1. no requirements of the representation of in the queue

2. value copy semantics of insertion and retrieval

then I would use one of the following three variants:

1. Queue internally implemented by an array of elements

2. Queue implemented as a user-defined storage pool

3. Queue implemented as a user-defined stream

For any of these variants you just don't need any Put procedure. Copying
is
predefined private type (cases 1 and 2). Stream attributes are also
predefined. The choice between 1 and 2 depends on whether Item is
definite:

   type Item is private;  -- 1 would be OK
   type Item (<>) is private;  -- This is for the variant 2

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
 




 5 Posts in Topic:
using put procedure with a generic package
"ophir.geffen@[EMAIL  2008-05-07 20:27:19 
Re: using put procedure with a generic package
"Jeffrey R. Carter&q  2008-05-08 04:09:25 
Re: using put procedure with a generic package
"ophir.geffen@[EMAIL  2008-05-07 21:48:47 
Re: using put procedure with a generic package
"Dmitry A. Kazakov&q  2008-05-08 09:24:53 
Re: using put procedure with a generic package
Adam Beneschan <adam@[  2008-05-08 08:54:56 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 6 14:57:59 CDT 2008.