+
+
diff --git a/include/adaid-generate.ads b/include/adaid-generate.ads
index 2438a26..cc742da 100644
--- a/include/adaid-generate.ads
+++ b/include/adaid-generate.ads
@@ -1,25 +1,31 @@
+-------------------------------------------------------------------------------
-- File: adaid-generate.ads
-- Description: UUID Generation
-- Author: Anthony Arnold
-- License: http://www.gnu.org/licenses/gpl.txt
+-------------------------------------------------------------------------------
+-- AdaID.Generate defines the functions required to generate UUIDs using
+-- different standard methods.
package AdaID.Generate is
-
- -- Exception for string parsing
+
Invalid_String : exception;
+ -- Thrown when invalid strings are passed to From_String
+
- -- Set a UUID to Nil
procedure Nil(id : in out UUID);
+ -- Set a UUID to Nil
+
- -- Generate a random UUID
procedure Random(id : in out UUID);
+ -- Generate a random UUID
- -- Generate a UUID based on a name
procedure From_Name(namespace: in UUID; name: in String; id: in out UUID);
+ -- Generate a UUID based on a name
+ procedure From_String(str : in String; id : in out UUID);
-- Generate a UUID from a string.
-- This is not so much generation, but reconstruction
- procedure From_String(str : in String; id : in out UUID);
end AdaID.Generate;
diff --git a/include/adaid.ads b/include/adaid.ads
index 4d31ac5..2667a0e 100644
--- a/include/adaid.ads
+++ b/include/adaid.ads
@@ -1,26 +1,29 @@
+-------------------------------------------------------------------------------
-- File: adaid.ads
-- Description: A UUID type for Ada
-- Author: Anthony Arnold
-- License: http://www.gnu.org/licenses/gpl.txt
+-------------------------------------------------------------------------------
with Ada.Finalization;
with Interfaces; use Interfaces; -- for Unsigned_n
+
+-- AdaID defines the types and accessor/miscellaneous functions for
+-- the UUID type.
package AdaID is
- -- Size type is unsigned
- subtype SizeType is Unsigned_32;
- uuid_size: constant Integer := 16; -- This many bytes in a UUID
+ uuid_size: constant Integer := 16;
+ -- This many bytes in a UUID
- --Hash Type
- subtype HashType is SizeType; -- The 'hash' of a UUID
+ subtype HashType is Unsigned_32;
+ -- Represents a "Hash Code" of a UUID
+ type Byte is mod 2 ** 8;
-- Byte Type (2^8)
- type Byte is mod 2 ** 8; -- 8-bit bytes
- -- Byte Array for UUID data storage
type ByteArray is array (0 .. uuid_size-1) of Byte;
+ -- Byte Array for UUID data storage
- -- Some UUID Enums
type VersionType is (
Unknown,
Time_Based,
@@ -29,6 +32,7 @@ package AdaID is
Random_Number_Based,
Name_Based_SHA1
);
+ -- The Version of the UUID
type VariantType is (
NCS,
@@ -36,33 +40,34 @@ package AdaID is
Microsoft,
Future
);
-
+ -- The UUID Variant
+
- -- The main type for the package
type UUID is new Ada.Finalization.Controlled with
record
data: ByteArray;
end record;
+ -- The main type for the package
- --Determine if UUID is NIL
function Is_Nil(This: in UUID) return Boolean;
+ --Determine if UUID is NIL (All Zeros)
- --Get the UUID Version
function Get_Version(This: in UUID) return VersionType;
+ --Get the UUID Version
- --Get the UUID Variant
function Get_Variant(This: in UUID) return VariantType;
+ --Get the UUID Variant
- --Test for equality
function "="(Left, Right: in UUID) return Boolean;
+ --Test for equality between Left and Right
- --Get the hash value for the UUID
function Get_Hash_Value(This: in UUID) return HashType;
+ --Get the hash code for the UUID
- --Convert the UUID to a string
function To_String(This: in UUID) return String;
+ --Convert the UUID to a common string representation
private
- --Default "constructor", initializes to NIL
overriding procedure Initialize (This: in out UUID);
+ --Default "constructor", initializes to NIL
end AdaID;
diff --git a/lib/.gitignore b/lib/.gitignore
index 10301e2..4c55d73 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -1 +1,2 @@
*.a
+*.so*