b311480e |
1 | -- Created on: 1992-12-24 |
2 | -- Created by: Denis PASCAL |
3 | -- Copyright (c) 1992-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
8 | -- This library is free software; you can redistribute it and/or modify it under |
9 | -- the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | -- by the Free Software Foundation, with special exception defined in the file |
11 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | -- distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | generic class TopologicalSortIterator from GraphTools |
18 | (Graph as any; |
19 | Vertex as any; |
20 | GIterator as any; |
21 | TSIterator as any) |
22 | |
23 | --generic class TopologicalSorIterator from GraphTools |
24 | -- (Graph as any; |
25 | -- Vertex as any; |
26 | -- GIterator as GraphIterator (Graph,Vertex)) |
27 | -- TSIterator as TopologicalSortFromIterator |
28 | |
29 | ---Purpose: This generic class defines an iterator to visit |
30 | -- each vertex of the underlying graph, in such an |
31 | -- order that noone vertex is reach before any vertex |
32 | -- that point to it. In general the order produced by |
33 | -- topological sort is not unique. Usefull for DAG |
34 | -- Topological Sort. |
35 | |
36 | raises NoSuchObject from Standard, |
37 | NoMoreObject from Standard |
38 | |
39 | |
40 | is |
41 | |
42 | Create |
43 | ---Purpose: Create an empty algorithm. |
44 | returns TopologicalSortIterator from GraphTools; |
45 | |
46 | Create (G : Graph) |
47 | ---Purpose: Create the algorithm setting each vertex of <G> |
48 | -- reached by GIterator tool, as initial conditions. |
49 | -- Use Perform method before visting the result of |
50 | -- the algorithm. |
51 | returns TopologicalSortIterator from GraphTools; |
52 | |
53 | FromGraph (me : in out; G : Graph); |
54 | ---Purpose: Add each vertex of <G> reached by GIterator tool |
55 | -- as initial conditions. Use Perform method |
56 | -- before visiting the result of the algorithm. |
57 | ---Level: Public |
58 | |
59 | FromVertex (me : in out; V : Vertex); |
60 | ---Purpose: Add <V> as initial condition. This method is |
61 | -- cumulative. Use Perform method before visting the |
62 | -- result of the algorithm. |
63 | ---Level: Public |
64 | |
65 | Reset (me : in out); |
66 | ---Purpose: Reset the algorithm. It may be reused with new |
67 | -- initial conditions. |
68 | ---Level: Public |
69 | |
70 | Perform (me : in out; G : Graph ; |
71 | ignoreSelfLoop : Boolean from Standard; |
72 | processCycle : Boolean from Standard); |
73 | ---Purpose: Peform the algorithm in <G> from initial setted |
74 | -- conditions according to the two following flags. |
75 | -- * <ignoreSelfLoop> allows the user to ignore (or |
76 | -- not) any vertex wich contains a self loop. |
77 | -- * <processCycle> allows the user to visit (or not> |
78 | -- vertex which is in a cycle. |
79 | ---Level: Public |
80 | |
81 | More (me) |
82 | returns Boolean from Standard; |
83 | ---Level: Public |
84 | |
85 | Next (me : in out) |
86 | raises NoMoreObject from Standard; |
87 | ---Level: Public |
88 | |
89 | Value (me) returns any Vertex |
90 | ---Level: Public |
91 | ---C++: return const & |
92 | raises NoSuchObject from Standard; |
93 | |
94 | IsInCycle (me) returns Boolean from Standard |
95 | ---Purpose: Returns TRUE if the current vertex is in a cycle. |
96 | ---Level: Public |
97 | raises NoSuchObject from Standard; |
98 | |
99 | fields |
100 | |
101 | myIterator : TSIterator; |
102 | |
103 | end TopologicalSortIterator; |
104 | |
105 | |
106 | |
107 | |