Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,10 @@
package Global_Singleton is
procedure Set_Data (Value : Integer);
function Get_Data return Integer;
private
type Instance_Type is record
-- Define instance data elements
Data : Integer := 0;
end record;
Instance : Instance_Type;
end Global_Singleton;

View file

@ -0,0 +1,21 @@
package body Global_Singleton is
--------------
-- Set_Data --
--------------
procedure Set_Data (Value : Integer) is
begin
Instance.Data := Value;
end Set_Data;
--------------
-- Get_Data --
--------------
function Get_Data return Integer is
begin
return Instance.Data;
end Get_Data;
end Global_Singleton;

View file

@ -0,0 +1,11 @@
package Protected_Singleton is
procedure Set_Data (Value : Integer);
function Get_Data return Integer;
private
protected Instance is
procedure Set(Value : Integer);
function Get return Integer;
private
Data : Integer := 0;
end Instance_Type;
end Protected_Singleton;

View file

@ -0,0 +1,47 @@
package body Protected_Singleton is
--------------
-- Set_Data --
--------------
procedure Set_Data (Value : Integer) is
begin
Instance.Set(Value);
end Set_Data;
--------------
-- Get_Data --
--------------
function Get_Data return Integer is
begin
return Instance.Get;
end Get_Data;
--------------
-- Instance --
--------------
protected body Instance is
---------
-- Set --
---------
procedure Set (Value : Integer) is
begin
Data := Value;
end Set;
---------
-- Get --
---------
function Get return Integer is
begin
return Data;
end Get;
end Instance;
end Protected_Singleton;