-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtree-htree_iter.ads
56 lines (44 loc) · 1.83 KB
/
tree-htree_iter.ads
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
with Ada.Streams; -- Stream_Element_Array
use Ada.Streams;
with Bupstash_Types;
use Bupstash_Types;
with Ada.Iterator_Interfaces;
with Tree.HTree_LL;
-- High-Level and Iterator API
package Tree.HTree_Iter is
IO_Error: exception;
type Tree_Cursor(N: Integer) is private;
function Cursor_Has_Element(C: in Tree_Cursor) return Boolean;
package It is new Ada.Iterator_Interfaces(Cursor => Tree_Cursor,
Has_Element => Cursor_Has_Element);
type Tree_Iterator(N: Integer; Last: Ada.Streams.Stream_Element_Offset)
is new It.Forward_ITerator with private;
overriding function First(Object: in Tree_Iterator) return Tree_Cursor;
overriding function Next(Object: in Tree_Iterator;
Position: in Tree_Cursor) return Tree_Cursor;
function Get_Address(Position: in Tree_Cursor) return Address;
function Element(Position: in Tree_Cursor) return Stream_Element_Array;
function Init(Ctx: in out Tree.HTree_LL.Tree_Reader;
Data_Directory: in String) return Tree_Iterator;
private
type Tree_Cursor(N: Integer) is record
Data_Dir: String(1 .. N);
Addr: Address;
Pos: Stream_Element_Offset;
Last: Stream_Element_Offset;
end record;
type Tree_Iterator(N: Integer; Last: Ada.Streams.Stream_Element_Offset)
is new It.Forward_Iterator with record
Data_Dir: String(1 .. N);
Address_Buf: Stream_Element_Array(0 .. Last);
end record;
function Cursor_For_Index(Ctx: in Tree_Iterator;
I: in Ada.Streams.Stream_Element_Offset) return Tree_Cursor;
procedure Check_Push_Level(Ctx: in out Tree.HTree_LL.Tree_Reader;
Height: in U64; Addr: in Address;
Value: in Stream_Element_Array);
function Get_Tree_Block_Address(Data: in Stream_Element_Array) return
Bupstash_Types.Address;
function Get_Chunk(Data_Directory: in String;
Addr: in Bupstash_Types.Address) return Stream_Element_Array;
end Tree.HTree_Iter;