1------------------------------------------------------------------------------
2--                                                                          --
3--                            Matreshka Project                             --
4--                                                                          --
5--                          Ada Modeling Framework                          --
6--                                                                          --
7--                        Runtime Library Component                         --
8--                                                                          --
9------------------------------------------------------------------------------
10--                                                                          --
11-- Copyright © 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: 3402 $ $Date: 2012-11-13 11:13:41 +0400 (Tue, 13 Nov 2012) $
43------------------------------------------------------------------------------
44with AMF.CMOF.Properties;
45with AMF.Holders.Reals;
46with AMF.Holders.Unlimited_Naturals;
47with AMF.Internals.Helpers;
48with AMF.Internals.Listener_Registry;
49with League.Holders.Booleans;
50with League.Holders.Integers;
51with League.Strings.Internals;
52
53package body AMF.Internals.Tables.Primitive_Types_Notification is
54
55   --------------------------
56   -- Notify_Attribute_Set --
57   --------------------------
58
59   procedure Notify_Attribute_Set
60    (Element   : AMF.Internals.AMF_Element;
61     Property  : AMF.Internals.CMOF_Element;
62     Old_Value : Boolean;
63     New_Value : Boolean) is
64   begin
65      AMF.Internals.Listener_Registry.Notify_Attribute_Set
66       (AMF.Internals.Helpers.To_Element (Element),
67        AMF.CMOF.Properties.CMOF_Property_Access
68         (AMF.Internals.Helpers.To_Element (Property)),
69        (Is_Empty => True),
70        League.Holders.Booleans.To_Holder (Old_Value),
71        League.Holders.Booleans.To_Holder (New_Value));
72   end Notify_Attribute_Set;
73
74   --------------------------
75   -- Notify_Attribute_Set --
76   --------------------------
77
78   procedure Notify_Attribute_Set
79    (Element   : AMF.Internals.AMF_Element;
80     Property  : AMF.Internals.CMOF_Element;
81     Old_Value : AMF.Optional_Boolean;
82     New_Value : AMF.Optional_Boolean) is
83   begin
84      AMF.Internals.Listener_Registry.Notify_Attribute_Set
85       (AMF.Internals.Helpers.To_Element (Element),
86        AMF.CMOF.Properties.CMOF_Property_Access
87         (AMF.Internals.Helpers.To_Element (Property)),
88        (Is_Empty => True),
89        AMF.Holders.To_Holder (Old_Value),
90        AMF.Holders.To_Holder (New_Value));
91   end Notify_Attribute_Set;
92
93   --------------------------
94   -- Notify_Attribute_Set --
95   --------------------------
96
97   procedure Notify_Attribute_Set
98    (Element   : AMF.Internals.AMF_Element;
99     Property  : AMF.Internals.CMOF_Element;
100     Old_Value : Matreshka.Internals.Strings.Shared_String_Access;
101     New_Value : Matreshka.Internals.Strings.Shared_String_Access)
102   is
103      use type Matreshka.Internals.Strings.Shared_String_Access;
104
105      OV : League.Holders.Holder;
106      NV : League.Holders.Holder;
107
108   begin
109      League.Holders.Set_Tag (OV, League.Holders.Universal_String_Tag);
110
111      if Old_Value /= null then
112         League.Holders.Replace_Element
113          (OV, League.Strings.Internals.Create (Old_Value));
114      end if;
115
116      League.Holders.Set_Tag (NV, League.Holders.Universal_String_Tag);
117
118      if New_Value /= null then
119         League.Holders.Replace_Element
120          (NV, League.Strings.Internals.Create (New_Value));
121      end if;
122
123      AMF.Internals.Listener_Registry.Notify_Attribute_Set
124       (AMF.Internals.Helpers.To_Element (Element),
125        AMF.CMOF.Properties.CMOF_Property_Access
126         (AMF.Internals.Helpers.To_Element (Property)),
127        (Is_Empty => True),
128        OV,
129        NV);
130   end Notify_Attribute_Set;
131
132   --------------------------
133   -- Notify_Attribute_Set --
134   --------------------------
135
136   procedure Notify_Attribute_Set
137    (Element   : AMF.Internals.AMF_Element;
138     Property  : AMF.Internals.CMOF_Element;
139     Old_Value : Integer;
140     New_Value : Integer) is
141   begin
142      AMF.Internals.Listener_Registry.Notify_Attribute_Set
143       (AMF.Internals.Helpers.To_Element (Element),
144        AMF.CMOF.Properties.CMOF_Property_Access
145         (AMF.Internals.Helpers.To_Element (Property)),
146        (Is_Empty => True),
147        League.Holders.Integers.To_Holder (Old_Value),
148        League.Holders.Integers.To_Holder (New_Value));
149   end Notify_Attribute_Set;
150
151   --------------------------
152   -- Notify_Attribute_Set --
153   --------------------------
154
155   procedure Notify_Attribute_Set
156    (Element   : AMF.Internals.AMF_Element;
157     Property  : AMF.Internals.CMOF_Element;
158     Old_Value : AMF.Optional_Integer;
159     New_Value : AMF.Optional_Integer) is
160   begin
161      AMF.Internals.Listener_Registry.Notify_Attribute_Set
162       (AMF.Internals.Helpers.To_Element (Element),
163        AMF.CMOF.Properties.CMOF_Property_Access
164         (AMF.Internals.Helpers.To_Element (Property)),
165        (Is_Empty => True),
166        AMF.Holders.To_Holder (Old_Value),
167        AMF.Holders.To_Holder (New_Value));
168   end Notify_Attribute_Set;
169
170   --------------------------
171   -- Notify_Attribute_Set --
172   --------------------------
173
174   procedure Notify_Attribute_Set
175    (Element   : AMF.Internals.AMF_Element;
176     Property  : AMF.Internals.CMOF_Element;
177     Old_Value : AMF.Unlimited_Natural;
178     New_Value : AMF.Unlimited_Natural) is
179   begin
180      AMF.Internals.Listener_Registry.Notify_Attribute_Set
181       (AMF.Internals.Helpers.To_Element (Element),
182        AMF.CMOF.Properties.CMOF_Property_Access
183         (AMF.Internals.Helpers.To_Element (Property)),
184        (Is_Empty => True),
185        AMF.Holders.Unlimited_Naturals.To_Holder (Old_Value),
186        AMF.Holders.Unlimited_Naturals.To_Holder (New_Value));
187   end Notify_Attribute_Set;
188
189   --------------------------
190   -- Notify_Attribute_Set --
191   --------------------------
192
193   procedure Notify_Attribute_Set
194    (Element   : AMF.Internals.AMF_Element;
195     Property  : AMF.Internals.CMOF_Element;
196     Old_Value : AMF.Optional_Unlimited_Natural;
197     New_Value : AMF.Optional_Unlimited_Natural) is
198   begin
199      AMF.Internals.Listener_Registry.Notify_Attribute_Set
200       (AMF.Internals.Helpers.To_Element (Element),
201        AMF.CMOF.Properties.CMOF_Property_Access
202         (AMF.Internals.Helpers.To_Element (Property)),
203        (Is_Empty => True),
204        AMF.Holders.To_Holder (Old_Value),
205        AMF.Holders.To_Holder (New_Value));
206   end Notify_Attribute_Set;
207
208   --------------------------
209   -- Notify_Attribute_Set --
210   --------------------------
211
212   procedure Notify_Attribute_Set
213    (Element   : AMF.Internals.AMF_Element;
214     Property  : AMF.Internals.CMOF_Element;
215     Old_Value : AMF.Real;
216     New_Value : AMF.Real) is
217   begin
218      AMF.Internals.Listener_Registry.Notify_Attribute_Set
219       (AMF.Internals.Helpers.To_Element (Element),
220        AMF.CMOF.Properties.CMOF_Property_Access
221         (AMF.Internals.Helpers.To_Element (Property)),
222        (Is_Empty => True),
223        AMF.Holders.Reals.To_Holder (Old_Value),
224        AMF.Holders.Reals.To_Holder (New_Value));
225   end Notify_Attribute_Set;
226
227   --------------------------
228   -- Notify_Attribute_Set --
229   --------------------------
230
231   procedure Notify_Attribute_Set
232    (Element   : AMF.Internals.AMF_Element;
233     Property  : AMF.Internals.CMOF_Element;
234     Old_Value : AMF.Optional_Real;
235     New_Value : AMF.Optional_Real) is
236   begin
237      AMF.Internals.Listener_Registry.Notify_Attribute_Set
238       (AMF.Internals.Helpers.To_Element (Element),
239        AMF.CMOF.Properties.CMOF_Property_Access
240         (AMF.Internals.Helpers.To_Element (Property)),
241        (Is_Empty => True),
242        AMF.Holders.To_Holder (Old_Value),
243        AMF.Holders.To_Holder (New_Value));
244   end Notify_Attribute_Set;
245
246end AMF.Internals.Tables.Primitive_Types_Notification;
247