comp.lang.ada
 help / color / mirror / Atom feed
* generic package with configuration paramenter
@ 2001-11-13  9:05 Tilman Glotzner
  2001-11-13  9:47 ` Petter Fryklund
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tilman Glotzner @ 2001-11-13  9:05 UTC (permalink / raw)


Hello,

I am writting a generic package and I would like to add to add a
configuring
parameter when instanciating the package that is defined within the
generic package.

generic
type T_ITEM is private;
MODE: T_MODE; -- type T_MODE is (FIFO,FILO);
package LIST is
...
end LIST;

Where can I define T_MODE ? Do I need to define T_MODE in a package
wrapped around the generic package:

package L is
type T_MODE is (FIFO,FILO); 
generic
type T_ITEM is private;
MODE: T_MODE;
pacakge LIST is
..
end LIST;

Or can I define it with the generic package ?


Thanks,

Tilman



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: generic package with configuration paramenter
  2001-11-13  9:05 generic package with configuration paramenter Tilman Glotzner
@ 2001-11-13  9:47 ` Petter Fryklund
  2001-11-13 16:45 ` Matthew Heaney
  2001-11-13 22:25 ` Stephen Leake
  2 siblings, 0 replies; 5+ messages in thread
From: Petter Fryklund @ 2001-11-13  9:47 UTC (permalink / raw)


Why not try:

generic
    type T_ITEM is private;
    Mode_Fifi : Boolean;
package LIST is
   .......
end LIST

then you wont need to declare type Mode_T at all :-)






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: generic package with configuration paramenter
  2001-11-13  9:05 generic package with configuration paramenter Tilman Glotzner
  2001-11-13  9:47 ` Petter Fryklund
@ 2001-11-13 16:45 ` Matthew Heaney
  2001-11-13 22:25 ` Stephen Leake
  2 siblings, 0 replies; 5+ messages in thread
From: Matthew Heaney @ 2001-11-13 16:45 UTC (permalink / raw)



"Tilman Glotzner" <tilmanglotzner@hotmail.com> wrote in message
news:8cffca5.0111130105.366e0491@posting.google.com...
> Where can I define T_MODE ? Do I need to define T_MODE in a package
> wrapped around the generic package:

This should be adequate.

> Or can I define it with the generic package ?

Another way is to declare the type in a "root package," and then make the
generic package a (public) child:

package P is
   type Mode_Type is (FIFO, LIFO);
end P;

generic
   Mode : in Mode_Type;
package P.GQ is
   type List_Type is private;
...
end P.GQ;


This way you can share this type among instantiations and other children of
P.







^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: generic package with configuration paramenter
  2001-11-13  9:05 generic package with configuration paramenter Tilman Glotzner
  2001-11-13  9:47 ` Petter Fryklund
  2001-11-13 16:45 ` Matthew Heaney
@ 2001-11-13 22:25 ` Stephen Leake
  2001-11-16  0:59   ` Nick Roberts
  2 siblings, 1 reply; 5+ messages in thread
From: Stephen Leake @ 2001-11-13 22:25 UTC (permalink / raw)


tilmanglotzner@hotmail.com (Tilman Glotzner) writes:

> Hello,
> 
> I am writting a generic package and I would like to add to add a
> configuring
> parameter when instanciating the package that is defined within the
> generic package.
> 
> generic
> type T_ITEM is private;
> MODE: T_MODE; -- type T_MODE is (FIFO,FILO);
> package LIST is
> ...
> end LIST;
> 
> Where can I define T_MODE ? 

Put it in a different package, made visible by 'with':
package L is 
   type T_MODE is (FIFO, FILO);
end L;

with L;
generic 
   type T_ITEM is private;
   MODE : T_MODE;
package LIST is
...
end LIST

-- Stephe



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: generic package with configuration paramenter
  2001-11-13 22:25 ` Stephen Leake
@ 2001-11-16  0:59   ` Nick Roberts
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Roberts @ 2001-11-16  0:59 UTC (permalink / raw)


package L is
   type T_MODE is (FIFO, LIFO);
end L;

with L;
generic
   type T_ITEM is private;
   MODE : L.T_MODE;
package LIST is
...
end LIST;







^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-11-16  0:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-13  9:05 generic package with configuration paramenter Tilman Glotzner
2001-11-13  9:47 ` Petter Fryklund
2001-11-13 16:45 ` Matthew Heaney
2001-11-13 22:25 ` Stephen Leake
2001-11-16  0:59   ` Nick Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox