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: 2937 $ $Date: 2012-05-01 21:07:27 +0400 (Tue, 01 May 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;
50with League.Strings.Internals;
51with Matreshka.Internals.Strings;
52
53package body AMF.Internals.UML_Redefinable_Template_Signatures is
54
55   -------------------
56   -- Enter_Element --
57   -------------------
58
59   overriding procedure Enter_Element
60    (Self    : not null access constant UML_Redefinable_Template_Signature_Proxy;
61     Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
62     Control : in out AMF.Visitors.Traverse_Control) is
63   begin
64      if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
65         AMF.Visitors.UML_Visitors.UML_Visitor'Class
66          (Visitor).Enter_Redefinable_Template_Signature
67            (AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access (Self),
68           Control);
69      end if;
70   end Enter_Element;
71
72   -------------------
73   -- Leave_Element --
74   -------------------
75
76   overriding procedure Leave_Element
77    (Self    : not null access constant UML_Redefinable_Template_Signature_Proxy;
78     Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
79     Control : in out AMF.Visitors.Traverse_Control) is
80   begin
81      if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
82         AMF.Visitors.UML_Visitors.UML_Visitor'Class
83          (Visitor).Leave_Redefinable_Template_Signature
84            (AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access (Self),
85           Control);
86      end if;
87   end Leave_Element;
88
89   -------------------
90   -- Visit_Element --
91   -------------------
92
93   overriding procedure Visit_Element
94    (Self     : not null access constant UML_Redefinable_Template_Signature_Proxy;
95     Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
96     Visitor  : in out AMF.Visitors.Abstract_Visitor'Class;
97     Control  : in out AMF.Visitors.Traverse_Control) is
98   begin
99      if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
100         AMF.Visitors.UML_Iterators.UML_Iterator'Class
101          (Iterator).Visit_Redefinable_Template_Signature
102            (Visitor,
103             AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access (Self),
104             Control);
105      end if;
106   end Visit_Element;
107
108   --------------------
109   -- Get_Classifier --
110   --------------------
111
112   overriding function Get_Classifier
113    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
114       return AMF.UML.Classifiers.UML_Classifier_Access is
115   begin
116      return
117        AMF.UML.Classifiers.UML_Classifier_Access
118         (AMF.Internals.Helpers.To_Element
119           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Classifier
120             (Self.Element)));
121   end Get_Classifier;
122
123   --------------------
124   -- Set_Classifier --
125   --------------------
126
127   overriding procedure Set_Classifier
128    (Self : not null access UML_Redefinable_Template_Signature_Proxy;
129     To   : AMF.UML.Classifiers.UML_Classifier_Access) is
130   begin
131      AMF.Internals.Tables.UML_Attributes.Internal_Set_Classifier
132       (Self.Element,
133        AMF.Internals.Helpers.To_Element
134         (AMF.Elements.Element_Access (To)));
135   end Set_Classifier;
136
137   ----------------------------
138   -- Get_Extended_Signature --
139   ----------------------------
140
141   overriding function Get_Extended_Signature
142    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
143       return AMF.UML.Redefinable_Template_Signatures.Collections.Set_Of_UML_Redefinable_Template_Signature is
144   begin
145      return
146        AMF.UML.Redefinable_Template_Signatures.Collections.Wrap
147         (AMF.Internals.Element_Collections.Wrap
148           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Extended_Signature
149             (Self.Element)));
150   end Get_Extended_Signature;
151
152   -----------------------------
153   -- Get_Inherited_Parameter --
154   -----------------------------
155
156   overriding function Get_Inherited_Parameter
157    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
158       return AMF.UML.Template_Parameters.Collections.Set_Of_UML_Template_Parameter is
159   begin
160      return
161        AMF.UML.Template_Parameters.Collections.Wrap
162         (AMF.Internals.Element_Collections.Wrap
163           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Inherited_Parameter
164             (Self.Element)));
165   end Get_Inherited_Parameter;
166
167   -----------------
168   -- Get_Is_Leaf --
169   -----------------
170
171   overriding function Get_Is_Leaf
172    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
173       return Boolean is
174   begin
175      return
176        AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf
177         (Self.Element);
178   end Get_Is_Leaf;
179
180   -----------------
181   -- Set_Is_Leaf --
182   -----------------
183
184   overriding procedure Set_Is_Leaf
185    (Self : not null access UML_Redefinable_Template_Signature_Proxy;
186     To   : Boolean) is
187   begin
188      AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf
189       (Self.Element, To);
190   end Set_Is_Leaf;
191
192   ---------------------------
193   -- Get_Redefined_Element --
194   ---------------------------
195
196   overriding function Get_Redefined_Element
197    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
198       return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is
199   begin
200      return
201        AMF.UML.Redefinable_Elements.Collections.Wrap
202         (AMF.Internals.Element_Collections.Wrap
203           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element
204             (Self.Element)));
205   end Get_Redefined_Element;
206
207   ------------------------------
208   -- Get_Redefinition_Context --
209   ------------------------------
210
211   overriding function Get_Redefinition_Context
212    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
213       return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
214   begin
215      return
216        AMF.UML.Classifiers.Collections.Wrap
217         (AMF.Internals.Element_Collections.Wrap
218           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context
219             (Self.Element)));
220   end Get_Redefinition_Context;
221
222   ---------------------------
223   -- Get_Client_Dependency --
224   ---------------------------
225
226   overriding function Get_Client_Dependency
227    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
228       return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
229   begin
230      return
231        AMF.UML.Dependencies.Collections.Wrap
232         (AMF.Internals.Element_Collections.Wrap
233           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
234             (Self.Element)));
235   end Get_Client_Dependency;
236
237   -------------------------
238   -- Get_Name_Expression --
239   -------------------------
240
241   overriding function Get_Name_Expression
242    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
243       return AMF.UML.String_Expressions.UML_String_Expression_Access is
244   begin
245      return
246        AMF.UML.String_Expressions.UML_String_Expression_Access
247         (AMF.Internals.Helpers.To_Element
248           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
249             (Self.Element)));
250   end Get_Name_Expression;
251
252   -------------------------
253   -- Set_Name_Expression --
254   -------------------------
255
256   overriding procedure Set_Name_Expression
257    (Self : not null access UML_Redefinable_Template_Signature_Proxy;
258     To   : AMF.UML.String_Expressions.UML_String_Expression_Access) is
259   begin
260      AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
261       (Self.Element,
262        AMF.Internals.Helpers.To_Element
263         (AMF.Elements.Element_Access (To)));
264   end Set_Name_Expression;
265
266   -------------------
267   -- Get_Namespace --
268   -------------------
269
270   overriding function Get_Namespace
271    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
272       return AMF.UML.Namespaces.UML_Namespace_Access is
273   begin
274      return
275        AMF.UML.Namespaces.UML_Namespace_Access
276         (AMF.Internals.Helpers.To_Element
277           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
278             (Self.Element)));
279   end Get_Namespace;
280
281   ------------------------
282   -- Get_Qualified_Name --
283   ------------------------
284
285   overriding function Get_Qualified_Name
286    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
287       return AMF.Optional_String is
288   begin
289      declare
290         use type Matreshka.Internals.Strings.Shared_String_Access;
291
292         Aux : constant Matreshka.Internals.Strings.Shared_String_Access
293           := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
294
295      begin
296         if Aux = null then
297            return (Is_Empty => True);
298
299         else
300            return (False, League.Strings.Internals.Create (Aux));
301         end if;
302      end;
303   end Get_Qualified_Name;
304
305   -------------------------
306   -- Get_Owned_Parameter --
307   -------------------------
308
309   overriding function Get_Owned_Parameter
310    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
311       return AMF.UML.Template_Parameters.Collections.Ordered_Set_Of_UML_Template_Parameter is
312   begin
313      return
314        AMF.UML.Template_Parameters.Collections.Wrap
315         (AMF.Internals.Element_Collections.Wrap
316           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Parameter
317             (Self.Element)));
318   end Get_Owned_Parameter;
319
320   -------------------
321   -- Get_Parameter --
322   -------------------
323
324   overriding function Get_Parameter
325    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
326       return AMF.UML.Template_Parameters.Collections.Ordered_Set_Of_UML_Template_Parameter is
327   begin
328      return
329        AMF.UML.Template_Parameters.Collections.Wrap
330         (AMF.Internals.Element_Collections.Wrap
331           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Parameter
332             (Self.Element)));
333   end Get_Parameter;
334
335   ------------------
336   -- Get_Template --
337   ------------------
338
339   overriding function Get_Template
340    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
341       return AMF.UML.Templateable_Elements.UML_Templateable_Element_Access is
342   begin
343      return
344        AMF.UML.Templateable_Elements.UML_Templateable_Element_Access
345         (AMF.Internals.Helpers.To_Element
346           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template
347             (Self.Element)));
348   end Get_Template;
349
350   ------------------
351   -- Set_Template --
352   ------------------
353
354   overriding procedure Set_Template
355    (Self : not null access UML_Redefinable_Template_Signature_Proxy;
356     To   : AMF.UML.Templateable_Elements.UML_Templateable_Element_Access) is
357   begin
358      AMF.Internals.Tables.UML_Attributes.Internal_Set_Template
359       (Self.Element,
360        AMF.Internals.Helpers.To_Element
361         (AMF.Elements.Element_Access (To)));
362   end Set_Template;
363
364   -------------------------
365   -- Inherited_Parameter --
366   -------------------------
367
368   overriding function Inherited_Parameter
369    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
370       return AMF.UML.Template_Parameters.Collections.Set_Of_UML_Template_Parameter is
371   begin
372      --  Generated stub: replace with real body!
373      pragma Compile_Time_Warning (Standard.True, "Inherited_Parameter unimplemented");
374      raise Program_Error with "Unimplemented procedure UML_Redefinable_Template_Signature_Proxy.Inherited_Parameter";
375      return Inherited_Parameter (Self);
376   end Inherited_Parameter;
377
378   ------------------------
379   -- Is_Consistent_With --
380   ------------------------
381
382   overriding function Is_Consistent_With
383    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy;
384     Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
385       return Boolean is
386   begin
387      --  Generated stub: replace with real body!
388      pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented");
389      raise Program_Error with "Unimplemented procedure UML_Redefinable_Template_Signature_Proxy.Is_Consistent_With";
390      return Is_Consistent_With (Self, Redefinee);
391   end Is_Consistent_With;
392
393   -----------------------------------
394   -- Is_Redefinition_Context_Valid --
395   -----------------------------------
396
397   overriding function Is_Redefinition_Context_Valid
398    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy;
399     Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
400       return Boolean is
401   begin
402      --  Generated stub: replace with real body!
403      pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented");
404      raise Program_Error with "Unimplemented procedure UML_Redefinable_Template_Signature_Proxy.Is_Redefinition_Context_Valid";
405      return Is_Redefinition_Context_Valid (Self, Redefined);
406   end Is_Redefinition_Context_Valid;
407
408   -------------------------
409   -- All_Owning_Packages --
410   -------------------------
411
412   overriding function All_Owning_Packages
413    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
414       return AMF.UML.Packages.Collections.Set_Of_UML_Package is
415   begin
416      --  Generated stub: replace with real body!
417      pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
418      raise Program_Error with "Unimplemented procedure UML_Redefinable_Template_Signature_Proxy.All_Owning_Packages";
419      return All_Owning_Packages (Self);
420   end All_Owning_Packages;
421
422   -----------------------------
423   -- Is_Distinguishable_From --
424   -----------------------------
425
426   overriding function Is_Distinguishable_From
427    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy;
428     N : AMF.UML.Named_Elements.UML_Named_Element_Access;
429     Ns : AMF.UML.Namespaces.UML_Namespace_Access)
430       return Boolean is
431   begin
432      --  Generated stub: replace with real body!
433      pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
434      raise Program_Error with "Unimplemented procedure UML_Redefinable_Template_Signature_Proxy.Is_Distinguishable_From";
435      return Is_Distinguishable_From (Self, N, Ns);
436   end Is_Distinguishable_From;
437
438   ---------------
439   -- Namespace --
440   ---------------
441
442   overriding function Namespace
443    (Self : not null access constant UML_Redefinable_Template_Signature_Proxy)
444       return AMF.UML.Namespaces.UML_Namespace_Access is
445   begin
446      --  Generated stub: replace with real body!
447      pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
448      raise Program_Error with "Unimplemented procedure UML_Redefinable_Template_Signature_Proxy.Namespace";
449      return Namespace (Self);
450   end Namespace;
451
452end AMF.Internals.UML_Redefinable_Template_Signatures;
453