comp.lang.ada
 help / color / mirror / Atom feed
From: Freejack <user@nospam.net>
Subject: Re: Type declared in record?
Date: Tue, 11 Nov 2003 22:43:15 GMT
Date: 2003-11-11T22:43:15+00:00	[thread overview]
Message-ID: <pan.2003.11.11.22.49.29.921243.936@nospam.net> (raw)
In-Reply-To: mailman.327.1068588560.25614.comp.lang.ada@ada-france.org

On Tue, 11 Nov 2003 17:08:56 -0500, Marius Amado Alves wrote:

> On Tue, 2003-11-11 at 20:19, Freejack wrote:
> 
> This is not representative of any problem I can think of. Maybe you want
> an array component, maybe a generic type, maybe something else. Please
> rethink your problem and restate it.
 
Right now I'm working on Variant Records. For example...

generic

	type Item is private;

package storage is

	type Data_Structure is (Tree, Stack, List);
	type Store(DatConf : Data_Structure) is private;
private

	type Node_Pointer is access Store;
	
	subtype BlockSize is Positive range 1..1024;

	type Item_Array is array(BlockSize) of Item; 

	type STree is record
		Value 		: Item;
		LPointer	: Node_Pointer;
		RPointer	: Node_Pointer;
		TPointer	: Node_Pointer;	-- Could be used for Threading, or NULL. --
	end record;

	type DLinkedList is record
		Element		: Item;
		Next		: Node_Pointer;
		Prev		: Node_Pointer;
	end record; 


	type Store (DatConf : Data_Structure) is record
		
		case DatConf is 
			when Tree =>
				TreeConf : STree;
					 
			when Stack =>
				StackConf : Item_Array;
			
			when List =>
				ListConf : DLinkedList;
		end case;

	end record;


end storage;


This is all swell...but working with it would be a bit of a pain, so I'm
toying around with other ideas that might give me better results.

Freejack.



  reply	other threads:[~2003-11-11 22:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-11 20:19 Type declared in record? Freejack
2003-11-11 22:08 ` Marius Amado Alves
2003-11-11 22:43   ` Freejack [this message]
2003-11-12  8:49     ` Dmitry A. Kazakov
2003-11-12  4:17 ` James Rogers
replies disabled

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