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_Deployments is
54
55   -------------------
56   -- Enter_Element --
57   -------------------
58
59   overriding procedure Enter_Element
60    (Self    : not null access constant UML_Deployment_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_Deployment
67            (AMF.UML.Deployments.UML_Deployment_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_Deployment_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_Deployment
84            (AMF.UML.Deployments.UML_Deployment_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_Deployment_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_Deployment
102            (Visitor,
103             AMF.UML.Deployments.UML_Deployment_Access (Self),
104             Control);
105      end if;
106   end Visit_Element;
107
108   -----------------------
109   -- Get_Configuration --
110   -----------------------
111
112   overriding function Get_Configuration
113    (Self : not null access constant UML_Deployment_Proxy)
114       return AMF.UML.Deployment_Specifications.Collections.Set_Of_UML_Deployment_Specification is
115   begin
116      return
117        AMF.UML.Deployment_Specifications.Collections.Wrap
118         (AMF.Internals.Element_Collections.Wrap
119           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Configuration
120             (Self.Element)));
121   end Get_Configuration;
122
123   ---------------------------
124   -- Get_Deployed_Artifact --
125   ---------------------------
126
127   overriding function Get_Deployed_Artifact
128    (Self : not null access constant UML_Deployment_Proxy)
129       return AMF.UML.Deployed_Artifacts.Collections.Set_Of_UML_Deployed_Artifact is
130   begin
131      return
132        AMF.UML.Deployed_Artifacts.Collections.Wrap
133         (AMF.Internals.Element_Collections.Wrap
134           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Deployed_Artifact
135             (Self.Element)));
136   end Get_Deployed_Artifact;
137
138   ------------------
139   -- Get_Location --
140   ------------------
141
142   overriding function Get_Location
143    (Self : not null access constant UML_Deployment_Proxy)
144       return AMF.UML.Deployment_Targets.UML_Deployment_Target_Access is
145   begin
146      return
147        AMF.UML.Deployment_Targets.UML_Deployment_Target_Access
148         (AMF.Internals.Helpers.To_Element
149           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Location
150             (Self.Element)));
151   end Get_Location;
152
153   ------------------
154   -- Set_Location --
155   ------------------
156
157   overriding procedure Set_Location
158    (Self : not null access UML_Deployment_Proxy;
159     To   : AMF.UML.Deployment_Targets.UML_Deployment_Target_Access) is
160   begin
161      AMF.Internals.Tables.UML_Attributes.Internal_Set_Location
162       (Self.Element,
163        AMF.Internals.Helpers.To_Element
164         (AMF.Elements.Element_Access (To)));
165   end Set_Location;
166
167   ----------------
168   -- Get_Client --
169   ----------------
170
171   overriding function Get_Client
172    (Self : not null access constant UML_Deployment_Proxy)
173       return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
174   begin
175      return
176        AMF.UML.Named_Elements.Collections.Wrap
177         (AMF.Internals.Element_Collections.Wrap
178           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client
179             (Self.Element)));
180   end Get_Client;
181
182   ------------------
183   -- Get_Supplier --
184   ------------------
185
186   overriding function Get_Supplier
187    (Self : not null access constant UML_Deployment_Proxy)
188       return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
189   begin
190      return
191        AMF.UML.Named_Elements.Collections.Wrap
192         (AMF.Internals.Element_Collections.Wrap
193           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Supplier
194             (Self.Element)));
195   end Get_Supplier;
196
197   ----------------
198   -- Get_Source --
199   ----------------
200
201   overriding function Get_Source
202    (Self : not null access constant UML_Deployment_Proxy)
203       return AMF.UML.Elements.Collections.Set_Of_UML_Element is
204   begin
205      return
206        AMF.UML.Elements.Collections.Wrap
207         (AMF.Internals.Element_Collections.Wrap
208           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Source
209             (Self.Element)));
210   end Get_Source;
211
212   ----------------
213   -- Get_Target --
214   ----------------
215
216   overriding function Get_Target
217    (Self : not null access constant UML_Deployment_Proxy)
218       return AMF.UML.Elements.Collections.Set_Of_UML_Element is
219   begin
220      return
221        AMF.UML.Elements.Collections.Wrap
222         (AMF.Internals.Element_Collections.Wrap
223           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Target
224             (Self.Element)));
225   end Get_Target;
226
227   -------------------------
228   -- Get_Related_Element --
229   -------------------------
230
231   overriding function Get_Related_Element
232    (Self : not null access constant UML_Deployment_Proxy)
233       return AMF.UML.Elements.Collections.Set_Of_UML_Element is
234   begin
235      return
236        AMF.UML.Elements.Collections.Wrap
237         (AMF.Internals.Element_Collections.Wrap
238           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Related_Element
239             (Self.Element)));
240   end Get_Related_Element;
241
242   ---------------------------
243   -- Get_Client_Dependency --
244   ---------------------------
245
246   overriding function Get_Client_Dependency
247    (Self : not null access constant UML_Deployment_Proxy)
248       return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
249   begin
250      return
251        AMF.UML.Dependencies.Collections.Wrap
252         (AMF.Internals.Element_Collections.Wrap
253           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
254             (Self.Element)));
255   end Get_Client_Dependency;
256
257   -------------------------
258   -- Get_Name_Expression --
259   -------------------------
260
261   overriding function Get_Name_Expression
262    (Self : not null access constant UML_Deployment_Proxy)
263       return AMF.UML.String_Expressions.UML_String_Expression_Access is
264   begin
265      return
266        AMF.UML.String_Expressions.UML_String_Expression_Access
267         (AMF.Internals.Helpers.To_Element
268           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
269             (Self.Element)));
270   end Get_Name_Expression;
271
272   -------------------------
273   -- Set_Name_Expression --
274   -------------------------
275
276   overriding procedure Set_Name_Expression
277    (Self : not null access UML_Deployment_Proxy;
278     To   : AMF.UML.String_Expressions.UML_String_Expression_Access) is
279   begin
280      AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
281       (Self.Element,
282        AMF.Internals.Helpers.To_Element
283         (AMF.Elements.Element_Access (To)));
284   end Set_Name_Expression;
285
286   -------------------
287   -- Get_Namespace --
288   -------------------
289
290   overriding function Get_Namespace
291    (Self : not null access constant UML_Deployment_Proxy)
292       return AMF.UML.Namespaces.UML_Namespace_Access is
293   begin
294      return
295        AMF.UML.Namespaces.UML_Namespace_Access
296         (AMF.Internals.Helpers.To_Element
297           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
298             (Self.Element)));
299   end Get_Namespace;
300
301   ------------------------
302   -- Get_Qualified_Name --
303   ------------------------
304
305   overriding function Get_Qualified_Name
306    (Self : not null access constant UML_Deployment_Proxy)
307       return AMF.Optional_String is
308   begin
309      declare
310         use type Matreshka.Internals.Strings.Shared_String_Access;
311
312         Aux : constant Matreshka.Internals.Strings.Shared_String_Access
313           := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
314
315      begin
316         if Aux = null then
317            return (Is_Empty => True);
318
319         else
320            return (False, League.Strings.Internals.Create (Aux));
321         end if;
322      end;
323   end Get_Qualified_Name;
324
325   -----------------------------------
326   -- Get_Owning_Template_Parameter --
327   -----------------------------------
328
329   overriding function Get_Owning_Template_Parameter
330    (Self : not null access constant UML_Deployment_Proxy)
331       return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
332   begin
333      return
334        AMF.UML.Template_Parameters.UML_Template_Parameter_Access
335         (AMF.Internals.Helpers.To_Element
336           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter
337             (Self.Element)));
338   end Get_Owning_Template_Parameter;
339
340   -----------------------------------
341   -- Set_Owning_Template_Parameter --
342   -----------------------------------
343
344   overriding procedure Set_Owning_Template_Parameter
345    (Self : not null access UML_Deployment_Proxy;
346     To   : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
347   begin
348      AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter
349       (Self.Element,
350        AMF.Internals.Helpers.To_Element
351         (AMF.Elements.Element_Access (To)));
352   end Set_Owning_Template_Parameter;
353
354   ----------------------------
355   -- Get_Template_Parameter --
356   ----------------------------
357
358   overriding function Get_Template_Parameter
359    (Self : not null access constant UML_Deployment_Proxy)
360       return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
361   begin
362      return
363        AMF.UML.Template_Parameters.UML_Template_Parameter_Access
364         (AMF.Internals.Helpers.To_Element
365           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter
366             (Self.Element)));
367   end Get_Template_Parameter;
368
369   ----------------------------
370   -- Set_Template_Parameter --
371   ----------------------------
372
373   overriding procedure Set_Template_Parameter
374    (Self : not null access UML_Deployment_Proxy;
375     To   : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
376   begin
377      AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter
378       (Self.Element,
379        AMF.Internals.Helpers.To_Element
380         (AMF.Elements.Element_Access (To)));
381   end Set_Template_Parameter;
382
383   -------------------------
384   -- All_Owning_Packages --
385   -------------------------
386
387   overriding function All_Owning_Packages
388    (Self : not null access constant UML_Deployment_Proxy)
389       return AMF.UML.Packages.Collections.Set_Of_UML_Package is
390   begin
391      --  Generated stub: replace with real body!
392      pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
393      raise Program_Error with "Unimplemented procedure UML_Deployment_Proxy.All_Owning_Packages";
394      return All_Owning_Packages (Self);
395   end All_Owning_Packages;
396
397   -----------------------------
398   -- Is_Distinguishable_From --
399   -----------------------------
400
401   overriding function Is_Distinguishable_From
402    (Self : not null access constant UML_Deployment_Proxy;
403     N : AMF.UML.Named_Elements.UML_Named_Element_Access;
404     Ns : AMF.UML.Namespaces.UML_Namespace_Access)
405       return Boolean is
406   begin
407      --  Generated stub: replace with real body!
408      pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
409      raise Program_Error with "Unimplemented procedure UML_Deployment_Proxy.Is_Distinguishable_From";
410      return Is_Distinguishable_From (Self, N, Ns);
411   end Is_Distinguishable_From;
412
413   ---------------
414   -- Namespace --
415   ---------------
416
417   overriding function Namespace
418    (Self : not null access constant UML_Deployment_Proxy)
419       return AMF.UML.Namespaces.UML_Namespace_Access is
420   begin
421      --  Generated stub: replace with real body!
422      pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
423      raise Program_Error with "Unimplemented procedure UML_Deployment_Proxy.Namespace";
424      return Namespace (Self);
425   end Namespace;
426
427   ------------------------
428   -- Is_Compatible_With --
429   ------------------------
430
431   overriding function Is_Compatible_With
432    (Self : not null access constant UML_Deployment_Proxy;
433     P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
434       return Boolean is
435   begin
436      --  Generated stub: replace with real body!
437      pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented");
438      raise Program_Error with "Unimplemented procedure UML_Deployment_Proxy.Is_Compatible_With";
439      return Is_Compatible_With (Self, P);
440   end Is_Compatible_With;
441
442   ---------------------------
443   -- Is_Template_Parameter --
444   ---------------------------
445
446   overriding function Is_Template_Parameter
447    (Self : not null access constant UML_Deployment_Proxy)
448       return Boolean is
449   begin
450      --  Generated stub: replace with real body!
451      pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented");
452      raise Program_Error with "Unimplemented procedure UML_Deployment_Proxy.Is_Template_Parameter";
453      return Is_Template_Parameter (Self);
454   end Is_Template_Parameter;
455
456end AMF.Internals.UML_Deployments;
457