Skip to content

Commit

Permalink
M agpl-generic_handle.adb
Browse files Browse the repository at this point in the history
M    agpl-generic_handle.ads
  • Loading branch information
mosteo committed Jul 4, 2006
1 parent b1b6908 commit 3307e57
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
9 changes: 9 additions & 0 deletions agpl-generic_handle.adb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ package body Agpl.Generic_Handle is
end if;
end Get;

-----------------
-- Null_Object --
-----------------

function Null_Object return Object is
begin
return (Ada.Finalization.Controlled with null);
end Null_Object;

---------
-- Ref --
---------
Expand Down
12 changes: 7 additions & 5 deletions agpl-generic_handle.ads
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
-- A container for indefinite objects allowing an easier storage for them.
-- 'Read and 'Write are implemented, so this type can be safely serialized.

with Ada.Finalization;
private with Ada.Finalization;
with Ada.Streams;

generic
Expand All @@ -42,26 +42,31 @@ package Agpl.Generic_Handle is

type Object is tagged private;

Null_Object : constant Object;
function Null_Object return Object;
pragma Inline (Null_Object);

function Set (This : in Item) return Object;
function "+" (This : in Item) return Object renames Set;
pragma Inline (Set);
-- Creation

procedure Set (This : in out Object; X : in Item);
-- Creation

function Get (This : in Object) return Item;
function "+" (This : in Object) return Item renames Get;
pragma Inline (Get);
-- Extraction. May raise No_Data if uninitialized.

function Ref (This : in Object) return Item_Access;
pragma Inline (Ref);
-- Reference to the held item.

procedure Clear (This : in out Object);
-- Make it uninitialized.

function Is_Valid (This : in Object) return Boolean;
pragma Inline (Is_Valid);
-- Says if it contains some value.

procedure Read (Stream : access Ada.Streams.Root_Stream_Type'Class;
Expand All @@ -81,7 +86,4 @@ private
procedure Adjust (This : in out Object);
procedure Finalize (This : in out Object);

Null_Object : constant Object :=
(Ada.Finalization.Controlled with Data => null);

end Agpl.Generic_Handle;

0 comments on commit 3307e57

Please sign in to comment.