Package: AdaID

Dependencies

with Ada.Finalization;
with Interfaces; use Interfaces;
for Unsigned_n

Description

File: adaid.ads Description: A UUID type for Ada Author: Anthony Arnold License: http://www.gnu.org/licenses/gpl.txt

Header

package AdaID is
 

Type Summary

Byte
ByteArray
UUID derived from Controlled
New Operations:  "=", Get_Hash_Value, Get_Variant, Get_Version, Is_Nil, To_String
Inherited Operations:  Adjust, Finalize, Initialize
VariantType
VersionType

Constants and Named Numbers

uuid_size: constant Integer := 16;
This many bytes in a UUID

Other Items:

subtype HashType is Unsigned_32;
Represents a "Hash Code" of a UUID

type Byte is mod 2 ** 8;
Byte Type (2^8)

type ByteArray is array (0 .. uuid_size-1) of Byte;
Byte Array for UUID data storage

type VersionType is (
	Unknown,
	Time_Based,
	DCE_Security,
	Name_Based_MD5,
	Random_Number_Based,
	Name_Based_SHA1
);
The Version of the UUID

type VariantType is (
	NCS,
	RFC_4122,
	Microsoft,
	Future
);
The UUID Variant

type UUID is new Ada.Finalization.Controlled with 
record
	data: ByteArray;
end record;
The main type for the package

function Is_Nil(This: in UUID) return Boolean;
Determine if UUID is NIL (All Zeros)

function Get_Version(This: in UUID) return VersionType;
Get the UUID Version

function Get_Variant(This: in UUID) return VariantType;
Get the UUID Variant

function "="(Left, Right: in UUID) return Boolean;
Test for equality between Left and Right

function Get_Hash_Value(This: in UUID) return HashType;
Get the hash code for the UUID

function To_String(This: in UUID) return String;
Convert the UUID to a common string representation

private

   --  Implementation-defined ...
end AdaID;