1. -- 
  2. -- Copyright (c) 2012-2013 Kevin Wellwood 
  3. -- All rights reserved. 
  4. -- 
  5. -- This source code is distributed under the Modified BSD License. For terms and 
  6. -- conditions, see license.txt. 
  7. -- 
  8.  
  9. package Values.Ids is 
  10.  
  11.     type Id_Value is new Value with private; 
  12.     type Id_Ptr is new Value_Ptr with private; 
  13.  
  14.     function Create( val : Unsigned_64 ) return Id_Ptr; 
  15.  
  16.     overriding 
  17.     function Clone( this : access Id_Value ) return Value_Ptr'Class; 
  18.  
  19.     overriding 
  20.     function Compare( this : Id_Value; other : Value'Class ) return Integer; 
  21.  
  22.     overriding 
  23.     function Get_Type( this : Id_Value ) return Value_Type; 
  24.  
  25.     overriding 
  26.     function Image( this : Id_Value ) return String; 
  27.  
  28.     -- Access the internal value 
  29.     function To_Unsigned_64( this : Id_Value ) return Unsigned_64; 
  30.  
  31.     ---------------------------------------------------------------------------- 
  32.  
  33.     -- Casts a Value_Ptr down to a Id_Ptr. Returns Nul on failure. 
  34.     function As_Id( ptr : Value_Ptr'Class ) return Id_Ptr; 
  35.  
  36.     -- Casts a Id_Ptr up to a Value_Ptr. 
  37.     function As_Value( this : Id_Ptr ) return Value_Ptr; 
  38.  
  39.     -- Returns an access to the Id_Ptr, or null if no target. 
  40.     function Get( this : Id_Ptr ) return access Id_Value'Class; pragma Inline( Get ); 
  41.  
  42.     Nul : constant Id_Ptr; 
  43.  
  44. private 
  45.  
  46.     type Id_Value is new Value with 
  47.         record 
  48.             val : Unsigned_64 := 0; 
  49.         end record; 
  50.     type A_Naked_Id is access all Id_Value'Class; 
  51.  
  52.     overriding 
  53.     function Value_Input( stream : access Root_Stream_Type'Class ) return Id_Value; 
  54.     for Id_Value'Input use Value_Input; 
  55.  
  56.     overriding 
  57.     procedure Value_Read( stream : access Root_Stream_Type'Class; this : out Id_Value ); 
  58.     for Id_Value'Read use Value_Read; 
  59.  
  60.     procedure Value_Write( stream : access Root_Stream_Type'Class; this : Id_Value ); 
  61.     for Id_Value'Write use Value_Write; 
  62.  
  63.     -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  64.  
  65.     type Id_Ptr is new Value_Ptr with null record; 
  66.  
  67.     Nul : constant Id_Ptr := (Value_Ptr with others => <>); 
  68.  
  69. end Values.Ids;