1------------------------------------------------------------------------------
2--                                                                          --
3--                            Matreshka Project                             --
4--                                                                          --
5--                          Ada Modeling Framework                          --
6--                                                                          --
7--                        Runtime Library Component                         --
8--                                                                          --
9------------------------------------------------------------------------------
10--                                                                          --
11-- Copyright © 2011-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: 2864 $ $Date: 2012-04-13 14:08:07 +0400 (Fri, 13 Apr 2012) $
43------------------------------------------------------------------------------
44with AMF.Elements;
45with AMF.Internals.Element_Collections;
46with AMF.Internals.Helpers;
47with AMF.Internals.Tables.UML_Attributes;
48with AMF.Visitors.UML_Iterators;
49with AMF.Visitors.UML_Visitors;
50
51package body AMF.Internals.UML_Template_Parameters is
52
53   -------------------
54   -- Enter_Element --
55   -------------------
56
57   overriding procedure Enter_Element
58    (Self    : not null access constant UML_Template_Parameter_Proxy;
59     Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
60     Control : in out AMF.Visitors.Traverse_Control) is
61   begin
62      if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
63         AMF.Visitors.UML_Visitors.UML_Visitor'Class
64          (Visitor).Enter_Template_Parameter
65            (AMF.UML.Template_Parameters.UML_Template_Parameter_Access (Self),
66           Control);
67      end if;
68   end Enter_Element;
69
70   -------------------
71   -- Leave_Element --
72   -------------------
73
74   overriding procedure Leave_Element
75    (Self    : not null access constant UML_Template_Parameter_Proxy;
76     Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
77     Control : in out AMF.Visitors.Traverse_Control) is
78   begin
79      if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
80         AMF.Visitors.UML_Visitors.UML_Visitor'Class
81          (Visitor).Leave_Template_Parameter
82            (AMF.UML.Template_Parameters.UML_Template_Parameter_Access (Self),
83           Control);
84      end if;
85   end Leave_Element;
86
87   -------------------
88   -- Visit_Element --
89   -------------------
90
91   overriding procedure Visit_Element
92    (Self     : not null access constant UML_Template_Parameter_Proxy;
93     Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
94     Visitor  : in out AMF.Visitors.Abstract_Visitor'Class;
95     Control  : in out AMF.Visitors.Traverse_Control) is
96   begin
97      if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
98         AMF.Visitors.UML_Iterators.UML_Iterator'Class
99          (Iterator).Visit_Template_Parameter
100            (Visitor,
101             AMF.UML.Template_Parameters.UML_Template_Parameter_Access (Self),
102             Control);
103      end if;
104   end Visit_Element;
105
106   -----------------
107   -- Get_Default --
108   -----------------
109
110   overriding function Get_Default
111    (Self : not null access constant UML_Template_Parameter_Proxy)
112       return AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access is
113   begin
114      return
115        AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access
116         (AMF.Internals.Helpers.To_Element
117           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Default
118             (Self.Element)));
119   end Get_Default;
120
121   -----------------
122   -- Set_Default --
123   -----------------
124
125   overriding procedure Set_Default
126    (Self : not null access UML_Template_Parameter_Proxy;
127     To   : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) is
128   begin
129      AMF.Internals.Tables.UML_Attributes.Internal_Set_Default
130       (Self.Element,
131        AMF.Internals.Helpers.To_Element
132         (AMF.Elements.Element_Access (To)));
133   end Set_Default;
134
135   -----------------------
136   -- Get_Owned_Default --
137   -----------------------
138
139   overriding function Get_Owned_Default
140    (Self : not null access constant UML_Template_Parameter_Proxy)
141       return AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access is
142   begin
143      return
144        AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access
145         (AMF.Internals.Helpers.To_Element
146           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Default
147             (Self.Element)));
148   end Get_Owned_Default;
149
150   -----------------------
151   -- Set_Owned_Default --
152   -----------------------
153
154   overriding procedure Set_Owned_Default
155    (Self : not null access UML_Template_Parameter_Proxy;
156     To   : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) is
157   begin
158      AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Default
159       (Self.Element,
160        AMF.Internals.Helpers.To_Element
161         (AMF.Elements.Element_Access (To)));
162   end Set_Owned_Default;
163
164   -----------------------------------
165   -- Get_Owned_Parametered_Element --
166   -----------------------------------
167
168   overriding function Get_Owned_Parametered_Element
169    (Self : not null access constant UML_Template_Parameter_Proxy)
170       return AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access is
171   begin
172      return
173        AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access
174         (AMF.Internals.Helpers.To_Element
175           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Parametered_Element
176             (Self.Element)));
177   end Get_Owned_Parametered_Element;
178
179   -----------------------------------
180   -- Set_Owned_Parametered_Element --
181   -----------------------------------
182
183   overriding procedure Set_Owned_Parametered_Element
184    (Self : not null access UML_Template_Parameter_Proxy;
185     To   : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) is
186   begin
187      AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Parametered_Element
188       (Self.Element,
189        AMF.Internals.Helpers.To_Element
190         (AMF.Elements.Element_Access (To)));
191   end Set_Owned_Parametered_Element;
192
193   -----------------------------
194   -- Get_Parametered_Element --
195   -----------------------------
196
197   overriding function Get_Parametered_Element
198    (Self : not null access constant UML_Template_Parameter_Proxy)
199       return AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access is
200   begin
201      return
202        AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access
203         (AMF.Internals.Helpers.To_Element
204           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Parametered_Element
205             (Self.Element)));
206   end Get_Parametered_Element;
207
208   -----------------------------
209   -- Set_Parametered_Element --
210   -----------------------------
211
212   overriding procedure Set_Parametered_Element
213    (Self : not null access UML_Template_Parameter_Proxy;
214     To   : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) is
215   begin
216      AMF.Internals.Tables.UML_Attributes.Internal_Set_Parametered_Element
217       (Self.Element,
218        AMF.Internals.Helpers.To_Element
219         (AMF.Elements.Element_Access (To)));
220   end Set_Parametered_Element;
221
222   -------------------
223   -- Get_Signature --
224   -------------------
225
226   overriding function Get_Signature
227    (Self : not null access constant UML_Template_Parameter_Proxy)
228       return AMF.UML.Template_Signatures.UML_Template_Signature_Access is
229   begin
230      return
231        AMF.UML.Template_Signatures.UML_Template_Signature_Access
232         (AMF.Internals.Helpers.To_Element
233           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Signature
234             (Self.Element)));
235   end Get_Signature;
236
237   -------------------
238   -- Set_Signature --
239   -------------------
240
241   overriding procedure Set_Signature
242    (Self : not null access UML_Template_Parameter_Proxy;
243     To   : AMF.UML.Template_Signatures.UML_Template_Signature_Access) is
244   begin
245      AMF.Internals.Tables.UML_Attributes.Internal_Set_Signature
246       (Self.Element,
247        AMF.Internals.Helpers.To_Element
248         (AMF.Elements.Element_Access (To)));
249   end Set_Signature;
250
251end AMF.Internals.UML_Template_Parameters;
252