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_Classifier_Template_Parameters is
52
53   -------------------
54   -- Enter_Element --
55   -------------------
56
57   overriding procedure Enter_Element
58    (Self    : not null access constant UML_Classifier_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_Classifier_Template_Parameter
65            (AMF.UML.Classifier_Template_Parameters.UML_Classifier_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_Classifier_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_Classifier_Template_Parameter
82            (AMF.UML.Classifier_Template_Parameters.UML_Classifier_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_Classifier_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_Classifier_Template_Parameter
100            (Visitor,
101             AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access (Self),
102             Control);
103      end if;
104   end Visit_Element;
105
106   -----------------------------
107   -- Get_Allow_Substitutable --
108   -----------------------------
109
110   overriding function Get_Allow_Substitutable
111    (Self : not null access constant UML_Classifier_Template_Parameter_Proxy)
112       return Boolean is
113   begin
114      return
115        AMF.Internals.Tables.UML_Attributes.Internal_Get_Allow_Substitutable
116         (Self.Element);
117   end Get_Allow_Substitutable;
118
119   -----------------------------
120   -- Set_Allow_Substitutable --
121   -----------------------------
122
123   overriding procedure Set_Allow_Substitutable
124    (Self : not null access UML_Classifier_Template_Parameter_Proxy;
125     To   : Boolean) is
126   begin
127      AMF.Internals.Tables.UML_Attributes.Internal_Set_Allow_Substitutable
128       (Self.Element, To);
129   end Set_Allow_Substitutable;
130
131   ---------------------------------
132   -- Get_Constraining_Classifier --
133   ---------------------------------
134
135   overriding function Get_Constraining_Classifier
136    (Self : not null access constant UML_Classifier_Template_Parameter_Proxy)
137       return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
138   begin
139      return
140        AMF.UML.Classifiers.Collections.Wrap
141         (AMF.Internals.Element_Collections.Wrap
142           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Constraining_Classifier
143             (Self.Element)));
144   end Get_Constraining_Classifier;
145
146   -----------------------------
147   -- Get_Parametered_Element --
148   -----------------------------
149
150   overriding function Get_Parametered_Element
151    (Self : not null access constant UML_Classifier_Template_Parameter_Proxy)
152       return AMF.UML.Classifiers.UML_Classifier_Access is
153   begin
154      return
155        AMF.UML.Classifiers.UML_Classifier_Access
156         (AMF.Internals.Helpers.To_Element
157           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Parametered_Element
158             (Self.Element)));
159   end Get_Parametered_Element;
160
161   -----------------------------
162   -- Set_Parametered_Element --
163   -----------------------------
164
165   overriding procedure Set_Parametered_Element
166    (Self : not null access UML_Classifier_Template_Parameter_Proxy;
167     To   : AMF.UML.Classifiers.UML_Classifier_Access) is
168   begin
169      AMF.Internals.Tables.UML_Attributes.Internal_Set_Parametered_Element
170       (Self.Element,
171        AMF.Internals.Helpers.To_Element
172         (AMF.Elements.Element_Access (To)));
173   end Set_Parametered_Element;
174
175   -----------------
176   -- Get_Default --
177   -----------------
178
179   overriding function Get_Default
180    (Self : not null access constant UML_Classifier_Template_Parameter_Proxy)
181       return AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access is
182   begin
183      return
184        AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access
185         (AMF.Internals.Helpers.To_Element
186           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Default
187             (Self.Element)));
188   end Get_Default;
189
190   -----------------
191   -- Set_Default --
192   -----------------
193
194   overriding procedure Set_Default
195    (Self : not null access UML_Classifier_Template_Parameter_Proxy;
196     To   : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) is
197   begin
198      AMF.Internals.Tables.UML_Attributes.Internal_Set_Default
199       (Self.Element,
200        AMF.Internals.Helpers.To_Element
201         (AMF.Elements.Element_Access (To)));
202   end Set_Default;
203
204   -----------------------
205   -- Get_Owned_Default --
206   -----------------------
207
208   overriding function Get_Owned_Default
209    (Self : not null access constant UML_Classifier_Template_Parameter_Proxy)
210       return AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access is
211   begin
212      return
213        AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access
214         (AMF.Internals.Helpers.To_Element
215           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Default
216             (Self.Element)));
217   end Get_Owned_Default;
218
219   -----------------------
220   -- Set_Owned_Default --
221   -----------------------
222
223   overriding procedure Set_Owned_Default
224    (Self : not null access UML_Classifier_Template_Parameter_Proxy;
225     To   : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) is
226   begin
227      AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Default
228       (Self.Element,
229        AMF.Internals.Helpers.To_Element
230         (AMF.Elements.Element_Access (To)));
231   end Set_Owned_Default;
232
233   -----------------------------------
234   -- Get_Owned_Parametered_Element --
235   -----------------------------------
236
237   overriding function Get_Owned_Parametered_Element
238    (Self : not null access constant UML_Classifier_Template_Parameter_Proxy)
239       return AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access is
240   begin
241      return
242        AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access
243         (AMF.Internals.Helpers.To_Element
244           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Parametered_Element
245             (Self.Element)));
246   end Get_Owned_Parametered_Element;
247
248   -----------------------------------
249   -- Set_Owned_Parametered_Element --
250   -----------------------------------
251
252   overriding procedure Set_Owned_Parametered_Element
253    (Self : not null access UML_Classifier_Template_Parameter_Proxy;
254     To   : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) is
255   begin
256      AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Parametered_Element
257       (Self.Element,
258        AMF.Internals.Helpers.To_Element
259         (AMF.Elements.Element_Access (To)));
260   end Set_Owned_Parametered_Element;
261
262   -----------------------------
263   -- Get_Parametered_Element --
264   -----------------------------
265
266   overriding function Get_Parametered_Element
267    (Self : not null access constant UML_Classifier_Template_Parameter_Proxy)
268       return AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access is
269   begin
270      return
271        AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access
272         (AMF.Internals.Helpers.To_Element
273           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Parametered_Element
274             (Self.Element)));
275   end Get_Parametered_Element;
276
277   -----------------------------
278   -- Set_Parametered_Element --
279   -----------------------------
280
281   overriding procedure Set_Parametered_Element
282    (Self : not null access UML_Classifier_Template_Parameter_Proxy;
283     To   : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) is
284   begin
285      AMF.Internals.Tables.UML_Attributes.Internal_Set_Parametered_Element
286       (Self.Element,
287        AMF.Internals.Helpers.To_Element
288         (AMF.Elements.Element_Access (To)));
289   end Set_Parametered_Element;
290
291   -------------------
292   -- Get_Signature --
293   -------------------
294
295   overriding function Get_Signature
296    (Self : not null access constant UML_Classifier_Template_Parameter_Proxy)
297       return AMF.UML.Template_Signatures.UML_Template_Signature_Access is
298   begin
299      return
300        AMF.UML.Template_Signatures.UML_Template_Signature_Access
301         (AMF.Internals.Helpers.To_Element
302           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Signature
303             (Self.Element)));
304   end Get_Signature;
305
306   -------------------
307   -- Set_Signature --
308   -------------------
309
310   overriding procedure Set_Signature
311    (Self : not null access UML_Classifier_Template_Parameter_Proxy;
312     To   : AMF.UML.Template_Signatures.UML_Template_Signature_Access) is
313   begin
314      AMF.Internals.Tables.UML_Attributes.Internal_Set_Signature
315       (Self.Element,
316        AMF.Internals.Helpers.To_Element
317         (AMF.Elements.Element_Access (To)));
318   end Set_Signature;
319
320end AMF.Internals.UML_Classifier_Template_Parameters;
321