Integration of OCCT 6.5.0 from SVN
[occt.git] / src / GraphDS / GraphDS_RelationGraph.cdl
1 -- File:        GraphDS_RelationGraph.cdl
2 -- Created:     Fri Sep  6 11:00:25 1991
3 -- Author:      Denis PASCAL
4 --              <dp@topsn2>
5 ---Copyright:    Matra Datavision 1991
6
7
8 generic class RelationGraph from GraphDS 
9              (GraphDS_Item      as any;
10               GraphDS_Attribute as any)
11                      
12     ---Purpose: This  generic class describe  a  network (or graph) of
13     --          Relations between Entities.  an Item can be associated
14     --          to the  Entity and respectively  an  Attribute  to the
15     --          Relation.   This  class can     be compared   to   the
16     --          DirectedGraph of this package.   But here the Relation
17     --          (compared to the Edge) can describe links between more
18     --          than two  Entities.   Each  link can  be described  as
19     --          oriented or  not.  Nested  classes permit to  edit and
20     --          visit that structure.  Interface of visiting tools are
21     --          done as iterators.
22
23
24 uses  TShared        from MMgt,
25       MapOfTransient from TColStd,
26       EntityRole     from GraphDS
27
28 raises NoSuchObject from Standard, 
29        NoMoreObject from Standard,
30        DomainError  from Standard
31
32     class Entity from GraphDS inherits TShared from MMgt
33     
34     uses RelationRole   from GraphDS,
35          MapOfTransient from TColStd
36     
37     is
38     
39         Create (value : GraphDS_Item) 
40         returns mutable Entity from GraphDS;
41
42         GetItem (me)            
43         ---Level: Internal
44         ---C++ : return const& 
45         returns any GraphDS_Item;
46
47         Contains (me; R : Relation from GraphDS)  
48         ---Level: Internal
49         returns Boolean from Standard;
50
51         HasRelation (me)  
52         ---Level: Internal 
53         returns Boolean from Standard;
54         
55         GetRole (me; R : Relation from GraphDS)  
56         ---Level: Internal
57         returns RelationRole from GraphDS;
58         
59         IsFront (me; R : Relation from GraphDS)  
60         ---Level: Internal 
61         returns Boolean from Standard;
62   
63         IsBack (me; R : Relation from GraphDS)  
64         ---Level: Internal 
65         returns Boolean from Standard;
66
67         Add (me : mutable; R : Relation from GraphDS)
68         is private;
69
70         Remove (me : mutable; R : Relation from GraphDS)
71         is private;
72         
73         GetRelations (me)
74         ---C++: return const&
75         returns MapOfTransient from TColStd
76         is private;
77
78     fields
79
80         myItem      : GraphDS_Item;  
81         myRelations : MapOfTransient from TColStd;
82
83     friends
84
85         class RelationGraph from GraphDS,
86         class EntitiesIterator          from GraphDS,
87         class IncidentEntitiesIterator  from GraphDS,
88         class RelationsIterator         from GraphDS,   
89         class IncidentRelationsIterator from GraphDS
90
91     end Entity from GraphDS;
92
93                 
94     class Relation inherits TShared from MMgt
95
96     uses EntityRole    from GraphDS,
97          EntityRoleMap from GraphDS
98     
99     is
100
101         Create (value : GraphDS_Attribute) 
102         returns mutable Relation;
103
104         GetAttribute (me)             
105         ---Level: Internal
106         ---C++: return const&
107         returns any GraphDS_Attribute;
108
109         Contains (me; E : Entity from GraphDS)   
110         ---Level: Internal
111         returns Boolean from Standard;
112
113         IsEmpty (me) 
114         ---Level: Internal
115         returns Boolean from Standard;
116         
117         GetRole (me; E : Entity from GraphDS)  
118         ---Level: Internal
119         returns EntityRole from GraphDS;
120
121         IsInput (me; E : Entity from GraphDS) 
122          ---Level: Internal
123         returns Boolean from Standard;
124         
125         IsOutput (me; E : Entity from GraphDS)
126         ---Level: Internal
127         returns Boolean from Standard;
128         
129         Remove   (me : mutable; E : Entity from GraphDS)
130         is private;
131         
132         Add      (me : mutable; E : Entity from GraphDS; 
133                                 R : EntityRole from GraphDS)
134         is private;                     
135         
136         SetRole  (me : mutable; E : Entity from GraphDS;
137                                 R : EntityRole from GraphDS)
138         is private;                     
139         
140         GetEntities (me) 
141         ---C++: return const&
142         returns EntityRoleMap from GraphDS
143         is private;
144         
145     fields
146
147         myAttribute : GraphDS_Attribute;  
148         myEntities  : EntityRoleMap from GraphDS;
149
150     friends     
151
152         class RelationGraph             from GraphDS,
153         class EntitiesIterator          from GraphDS,
154         class IncidentEntitiesIterator  from GraphDS,
155         class RelationsIterator         from GraphDS,   
156         class IncidentRelationsIterator from GraphDS
157         
158     end Relation;
159
160
161     class EntitiesIterator from GraphDS 
162
163         ---Purpose: Public nested class which  defines an  iterator to
164         --          visit each Entity member of a given RelationGraph.
165
166     uses MapOfTransient from TColStd,
167          MapIteratorOfMapOfTransient from TColStd
168     
169     raises NoMoreObject from Standard,
170            NoSuchObject from Standard
171     is
172
173         Create 
174         returns EntitiesIterator from GraphDS;
175         
176         Create (G : RelationGraph from GraphDS)
177         returns EntitiesIterator from GraphDS;
178         
179         Create (G : RelationGraph from GraphDS;
180                 E : Entity        from GraphDS)
181         returns EntitiesIterator from GraphDS;
182         
183         Create (G : RelationGraph from GraphDS;
184                 E : Relation      from GraphDS)
185         returns EntitiesIterator from GraphDS;
186         
187         Initialize (me : in out; G : RelationGraph from GraphDS);
188             ---Level: Public
189
190         Initialize (me : in out; G : RelationGraph from GraphDS;
191                                  E : Entity        from GraphDS);
192             ---Level: Public
193         
194         Initialize (me : in out; G : RelationGraph from GraphDS; 
195                                  R : Relation      from GraphDS);
196             ---Level: Public
197
198         More (me)   
199         ---Level: Public
200         returns Boolean from Standard;
201
202         Next (me : in out)   
203         ---Level: Public 
204         raises NoMoreObject from Standard;
205
206         Value (me) 
207         ---C++: return const&
208         ---Level: Public 
209         returns Entity from GraphDS
210         raises NoSuchObject from Standard;
211
212     fields
213
214         myMap      : MapOfTransient from TColStd;
215         myEntities : MapIteratorOfMapOfTransient from TColStd;
216
217     end EntitiesIterator;
218
219
220     class RelationsIterator from GraphDS 
221
222         ---Purpose: Public nested  class which defines  an iterator to
223         --          visit   each  Relation    member   of  a     given
224         --          RelationGraph.
225
226     uses MapOfTransient from TColStd,
227          MapIteratorOfMapOfTransient from TColStd
228
229     raises NoMoreObject from Standard,
230            NoSuchObject from Standard
231     is 
232     
233         Create
234         returns RelationsIterator from GraphDS;
235         
236         Create (G : RelationGraph from GraphDS)
237         returns RelationsIterator from GraphDS;
238         
239         Create (G : RelationGraph from GraphDS;
240                 R : Relation      from GraphDS)
241         returns RelationsIterator from GraphDS;
242         
243         Create (G : RelationGraph from GraphDS;
244                 E : Entity        from GraphDS)
245         returns RelationsIterator from GraphDS; 
246         
247         Initialize (me : in out; G : RelationGraph from GraphDS);
248             ---Level: Public
249
250         Initialize (me : in out; G : RelationGraph from GraphDS; 
251                                  R : Relation      from GraphDS);
252             ---Level: Public
253         
254         Initialize (me : in out; G : RelationGraph from GraphDS; 
255                                  E : Entity        from GraphDS);
256             ---Level: Public
257         
258         More (me) 
259         returns Boolean from Standard;
260             ---Level: Public
261         
262         Next (me : in out) 
263         raises NoMoreObject from Standard;
264             ---Level: Public
265         
266         Value (me) 
267         ---C++: return const&
268         returns Relation from GraphDS
269         raises NoSuchObject from Standard;
270             ---Level: Public
271         
272     fields
273     
274         myMap       : MapOfTransient from TColStd;
275         myRelations : MapIteratorOfMapOfTransient from TColStd;
276         
277     end RelationsIterator;
278
279
280     class IncidentEntitiesIterator from GraphDS
281     
282     uses MapOfTransient from TColStd,
283          MapIteratorOfMapOfTransient from TColStd
284     
285     raises NoMoreObject from Standard,
286            NoSuchObject from Standard
287
288     is 
289
290         Create 
291         returns IncidentEntitiesIterator from GraphDS;
292         
293         Create (G : RelationGraph from GraphDS; 
294                 E : Entity        from GraphDS) 
295         returns IncidentEntitiesIterator from GraphDS;
296
297         Initialize (me : in out; G : RelationGraph from GraphDS; 
298                                  E : Entity        from GraphDS); 
299         ---Level: Public
300         
301         More (me)  
302         ---Level: Public
303         returns Boolean from Standard;
304         
305         Next (me : in out)
306         ---Level: Public 
307         raises NoMoreObject from Standard;
308         
309         Value (me) 
310         ---C++: return const&  
311         ---Level: Public
312         returns Entity from GraphDS 
313         raises NoSuchObject from Standard;
314         
315     fields
316     
317         myMap      : MapOfTransient from TColStd;
318         myEntities : MapIteratorOfMapOfTransient from TColStd;
319         
320     end IncidentEntitiesIterator;    
321
322
323     class IncidentRelationsIterator  from GraphDS
324     
325     uses MapOfTransient from TColStd,
326          MapIteratorOfMapOfTransient from TColStd
327     
328     raises NoMoreObject from Standard,
329            NoSuchObject from Standard
330     is
331         Create 
332         returns IncidentRelationsIterator from GraphDS;
333         
334         Create (G : RelationGraph from GraphDS; 
335                 R : Relation      from GraphDS) 
336         returns IncidentRelationsIterator from GraphDS;
337         
338         Initialize (me : in out; G : RelationGraph from GraphDS; 
339                                  R : Relation      from GraphDS); 
340             ---Level: Public
341         
342         More (me)  
343         ---Level: Public 
344         returns Boolean from Standard;
345         
346         Next (me : in out) 
347         ---Level: Public 
348         raises NoMoreObject from Standard;
349         
350         Value (me) 
351         ---C++: return const&
352         ---Level: Public 
353         returns Relation from GraphDS
354         raises NoSuchObject from Standard;
355         
356     fields
357
358         myMap       : MapOfTransient from TColStd;
359         myRelations : MapIteratorOfMapOfTransient from TColStd;    
360         
361     end IncidentRelationsIterator;
362
363 is
364
365     Create 
366     returns RelationGraph from GraphDS;
367         ---Purpose: Creates an empty relation graph.
368
369     Create (other : RelationGraph from GraphDS)
370     returns RelationGraph from GraphDS;
371
372     IsEmpty (me) 
373         ---Purpose: tests if <me> contains any Entity.
374         ---Level: Public
375     returns Boolean from Standard;
376     
377     Clear (me : in out);
378         ---Purpose: Removes all the  Entities and all  the relations of
379         --          <me>.
380         ---Level: Public
381     
382     Contains (me; E : Entity from GraphDS) 
383         ---Purpose: tests if <me> contains <E>.
384         ---Level: Public    
385     returns Boolean from Standard;
386     
387     Contains (me; R : Relation from GraphDS) 
388         ---Purpose: tests if <me> contains <rel>.
389         ---Level: Public    
390     returns Boolean from Standard;
391
392     NbEntities (me) 
393         ---Purpose: returns the number of Entity of me.
394         ---Level: Public
395     returns Integer from Standard;
396     
397     NbRelations (me) 
398         ---Purpose: returns the number of Relations of <me>.
399         ---Level: Public
400     returns Integer from Standard;
401
402     IsInRelation (me; E : Entity from GraphDS) 
403         ---Purpose: To  Know if <E> is  in relation (as input,output
404         --          or both as well) with others Entities of <me>.
405         ---Level: Public    
406     returns Boolean from Standard
407     raises NoSuchObject from Standard;
408
409     IsInput (me; E : Entity from GraphDS) 
410     returns Boolean from Standard
411         ---Purpose: returns True if <E>
412         ---Level: Public
413     raises NoSuchObject from Standard;
414
415     IsOutput (me; E : Entity from GraphDS) 
416     returns Boolean from Standard
417         ---Purpose: returns True if <E> is  at least output  of one of
418         --          its relation.
419         ---Level: Public
420     raises NoSuchObject from Standard;
421
422     IsDependent (me; E : Entity from GraphDS) 
423     returns Boolean from Standard
424         ---Purpose: returns True if <E> is  not input of  one of its
425         --          relation.
426         ---Level: Public
427     raises NoSuchObject from Standard;
428
429     AddEntity (me : in out; value : GraphDS_Item)       
430     ---Purpose: Creates an adds a new Entity (which contains item)
431     --          to <me>.
432     ---Level: Public
433     returns Entity from GraphDS;
434     
435     RemoveEntity (me : in out; E : Entity from GraphDS)
436         ---Purpose: Removes a Entity <E> of <me>.  Be carefull than an
437         --          exception is raised if <E> is  still member of any
438         --          relation of <me>.
439         ---Level: Public
440     raises NoSuchObject from Standard,
441            DomainError  from Standard;
442
443     AddRelation (me : in out; value : GraphDS_Attribute)
444         ---Purpose: Creates  an adds a  new  Relation  (which contains
445         --          attribute)   to <me>. 
446         ---Level: Public
447     returns Relation from GraphDS;
448
449     RemoveRelation (me : in out; R : Relation from GraphDS)
450         ---Purpose: Removes a relation  <R> of <me>. 
451         ---Level: Public
452     raises NoSuchObject from Standard;
453
454     ---Purpose: relation editing function
455
456     IsEmpty (me; R : Relation)
457         ---Purpose: returns TRUE if noone entity is member of <R>.
458         ---Level: Public
459     returns Boolean from Standard
460     raises NoSuchObject from Standard;    
461     
462     Add (me : in out; R : Relation; E : Entity)
463         ---Purpose: add an InputAndOutput entity <E> to <R>
464         ---Level: Public
465     raises NoSuchObject from Standard;
466  
467     AddInput  (me : in out; R : Relation; E : Entity)
468         ---Purpose: add OnlyInput entity <E> to <R>.
469         ---Level: Public
470     raises NoSuchObject from Standard;
471
472     AddOutput (me : in out; R : Relation; E : Entity)
473         ---Purpose: add an OnlyOutput entity <E> to <R>.
474         ---Level: Public
475     raises NoSuchObject from Standard;
476     
477     Add (me : in out; R    : Relation; 
478                       E    : Entity;
479                       role : EntityRole from GraphDS)
480         ---Purpose: add an entity <E> to <R> with role <role>.
481         ---Level: Public
482     raises NoSuchObject from Standard;
483     
484     SetRole (me : in out; R    : Relation; 
485                           E    : Entity;
486                           role : EntityRole from GraphDS)
487         ---Purpose: set a new role <role> for the entity <E> member of <R>.
488         ---Level: Public
489     raises NoSuchObject from Standard;
490     
491     Remove (me : in out; R : Relation; E : Entity)
492         ---Purpose: remove the entity <E> member of <R>.
493         ---Level: Public
494     raises NoSuchObject from Standard;
495
496 fields
497
498     myEntities   : MapOfTransient from TColStd;
499     myRelations  : MapOfTransient from TColStd;
500     
501 friends
502
503     class EntitiesIterator from GraphDS,
504     class RelationsIterator from GraphDS
505
506 end RelationGraph;
507
508
509
510
511
512
513
514