1------------------------------------------------------------------------------
2--                                                                          --
3--                            Matreshka Project                             --
4--                                                                          --
5--                          Ada Modeling Framework                          --
6--                                                                          --
7--                        Runtime Library Component                         --
8--                                                                          --
9------------------------------------------------------------------------------
10--                                                                          --
11-- Copyright © 2010-2012, Vadim Godunko <vgodunko@gmail.com>                --
12-- All rights reserved.                                                     --
13--                                                                          --
14-- Redistribution and use in source and binary forms, with or without       --
15-- modification, are permitted provided that the following conditions       --
16-- are met:                                                                 --
17--                                                                          --
18--  * Redistributions of source code must retain the above copyright        --
19--    notice, this list of conditions and the following disclaimer.         --
20--                                                                          --
21--  * Redistributions in binary form must reproduce the above copyright     --
22--    notice, this list of conditions and the following disclaimer in the   --
23--    documentation and/or other materials provided with the distribution.  --
24--                                                                          --
25--  * Neither the name of the Vadim Godunko, IE nor the names of its        --
26--    contributors may be used to endorse or promote products derived from  --
27--    this software without specific prior written permission.              --
28--                                                                          --
29-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS      --
30-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT        --
31-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR    --
32-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT     --
33-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   --
34-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
35-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR   --
36-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF   --
37-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING     --
38-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS       --
39-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.             --
40--                                                                          --
41------------------------------------------------------------------------------
42--  $Revision: 2747 $ $Date: 2012-03-28 00:47:17 +0400 (Wed, 28 Mar 2012) $
43------------------------------------------------------------------------------
44--  Tables of AMF internals data structures.
45------------------------------------------------------------------------------
46with GNAT.Table;
47
48with Matreshka.Internals.Strings;
49
50with AMF.Internals.Collections.Elements.Proxies;
51with AMF.Internals.AMF_URI_Extents;
52
53package AMF.Internals.Tables.AMF_Tables is
54
55   -------------
56   -- Extents --
57   -------------
58
59   type Extent_Element_Identifier is new Natural;
60
61   type Extent_Record is record
62      Proxy       : AMF.Internals.AMF_URI_Extents.AMF_URI_Extent_Access;
63      Context_URI : Matreshka.Internals.Strings.Shared_String_Access;
64      Head        : Extent_Element_Identifier;
65      Tail        : Extent_Element_Identifier;
66   end record;
67
68   type Extent_Element_Record is record
69      Id       : Matreshka.Internals.Strings.Shared_String_Access;
70      Element  : AMF_Element;
71      Previous : Extent_Element_Identifier;
72      Next     : Extent_Element_Identifier;
73   end record;
74
75   package Extents is
76     new GNAT.Table (Extent_Record, AMF_Extent, 1, 10, 100);
77
78   package Extent_Elements is
79     new GNAT.Table
80          (Extent_Element_Record, Extent_Element_Identifier, 1, 10_000, 100);
81
82   -----------------------------
83   -- Collections of Elements --
84   -----------------------------
85
86   type Collection_Element_Identifier is new Natural;
87
88   type Collection_Kinds is (C_None, C_Set, C_Ordered_Set, C_Bag, C_Sequence);
89
90   type Collection_Record (Kind : Collection_Kinds := C_None) is record
91      Proxy     :
92        AMF.Internals.Collections.Elements.Proxies.Shared_Element_Collection_Proxy_Access;
93      Owner     : AMF_Element;
94      --  Owner of the collection.
95      Property  : CMOF_Element;
96      --  Property represented by collection.
97
98--      Read_Only : Boolean;
99      Head      : Collection_Element_Identifier;
100      Tail      : Collection_Element_Identifier;
101      --  First and Last elements in the collection.
102--      Size      : Natural;
103   end record;
104
105--   type Collection_Element_Kinds is (CE_None,
106
107   type Collection_Element_Record is record
108--      Collection : Collection_Of_Cmof_Element;
109      Element    : AMF_Element;
110      Link       : AMF_Link;
111      Previous   : Collection_Element_Identifier;
112      Next       : Collection_Element_Identifier;
113   end record;
114
115   package Collections is
116     new GNAT.Table
117          (Collection_Record,
118           AMF_Collection_Of_Element,
119           1,
120           50_000,
121           100);
122
123   package Collection_Elements is
124     new GNAT.Table
125          (Collection_Element_Record,
126           Collection_Element_Identifier,
127           1,
128           20_000,
129           100);
130
131end AMF.Internals.Tables.AMF_Tables;
132