Hosted by
|
with Interfaces; use Interfaces;
with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;
package Bit_Buffers is
type Bit_Buffer(Byte_Count : Positive) is limited private;
type Bit_Buffer_Access is access Bit_Buffer;
function Create
(Byte_Count : in Positive)
return Bit_Buffer_Access;
procedure Deallocate
(This : in out Bit_Buffer_Access);
procedure Reset
(This : access Bit_Buffer);
procedure Clear
(This : access Bit_Buffer);
procedure Read_Row
(From : in Stream_Access;
This : access Bit_Buffer);
function Read_Bit
(This : access Bit_Buffer)
return Boolean;
private
subtype Byte is Unsigned_8;
type Byte_Array is array (Positive range <>) of Byte;
type Bit_Buffer(Byte_Count : Positive) is record
Bytes : Byte_Array(1 .. Byte_Count);
Temp : Byte;
Temp_Bits : Natural;
Temp_Index : Natural;
end record;
end Bit_Buffers;
|