From d8337f648d6b81157008143c9dfb0d35d496f5e8 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Fri, 24 Apr 2020 13:54:52 +1000 Subject: Iterator portion of spec --- src/ada-containers-directed_graphs.ads | 54 +++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/src/ada-containers-directed_graphs.ads b/src/ada-containers-directed_graphs.ads index cc1c39c..83ab249 100644 --- a/src/ada-containers-directed_graphs.ads +++ b/src/ada-containers-directed_graphs.ads @@ -733,7 +733,59 @@ private - -- Define Iterators for general iteration and subgraph iteration here + type Iterator is new Ada.Finalization.Limited_Controlled and + Graph_Iterator_Interfaces.Reversible_Iterator with + record + Container : Graph_Access; + Node : Extended_Node_Type; + end record + with Disable_Controlled => not Impl.T_Check; + + overriding procedure Finalize + (Object : in out Iterator); + + overriding function First + (Object : in Iterator) + return Cursor; + + overriding function Last + (Object : in Iterator) + return Cursor; + + overriding function Next + (Object : in Iterator; + Position : in Cursor) + return Cursor; + + overriding function Previous + (Object : in Iterator; + Position : in Cursor) + return Cursor; + + + + + type Subgraph_Iterator is new Ada.Finalization.Limited_Controlled and + Graph_Iterator_Interfaces.Forward_Iterator with + record + Container : Graph_Access; + Root_Node : Node_Type; + Visited : Node_Vectors.Vector; + Current : Extended_Node_Type; + end record + with Disable_Controlled => not Impl.T_Check; + + overriding procedure Finalize + (Object : in out Subgraph_Iterator); + + overriding function First + (Object : in Subgraph_Iterator) + return Cursor; + + overriding function Next + (Object : in Subgraph_Iterator; + Position : in Subgraph_Iterator) + return Cursor; end Ada.Containers.Directed_Graphs; -- cgit