comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <mheaney@on2.com>
Subject: Re: Q: Hiding the structure of a tagged type using containers
Date: 9 May 2006 07:47:10 -0700
Date: 2006-05-09T07:47:10-07:00	[thread overview]
Message-ID: <1147186030.145802.222440@v46g2000cwv.googlegroups.com> (raw)
In-Reply-To: <1147139575.425825.290860@u72g2000cwu.googlegroups.com>


brian.b.mcguinness@lmco.com wrote:
> I am trying to create a tree of object classes to represent arrays.  I
> want to hide the internal representation of the arrays in the private
> sections of the packages for the tagged types.

Yes, that's a good idea.


> However, I am having
> trouble figuring out how to do this.
> I tried this:
>
> 1
> 6  with Ada.Containers.Vectors;
> 7
> 8  package APL.Arrays.Dimensioned is
> 9
> 10    type APL_Shape is private;
> 11
> 26  private
> 27
> 28    package APL_Dimension_List is new Ada.Containers.Vectors (
> 29      Index_Type   => Dimension_Index,
> 30      Element_Type => Dimension
> 31    );
> 32
> 33    type APL_Shape is new APL_Dimension_List.Vector with null record;

Why is this a derivation?  Just say:

  type APL_Shape is record
     V : APL_Dimension_List.Vector;
  end record;



> 35    type APL_Array_Dimensioned is new APL_Array with record
> 36      Dimensions : APL_Shape;
> 37    end record;
> 38
> 39  end APL.Arrays.Dimensioned;
>
>
> Using APL_Dimension_List.Vector might work, but I am trying to
> rename this to APL_Shape in order to hide the ".Vector" part
> and make the dimension list look like a simple data type.

Fine, just implement APL_Shape as a non-tagged record with a vector
component.




  parent reply	other threads:[~2006-05-09 14:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-09  1:52 Q: Hiding the structure of a tagged type using containers brian.b.mcguinness
2006-05-09  6:43 ` Stephen Leake
2006-05-09 14:52   ` Matthew Heaney
2006-05-10 11:50     ` Craig Carey
2006-05-09 14:47 ` Matthew Heaney [this message]
2006-05-09 14:55   ` brian.b.mcguinness
replies disabled

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