1 -- Created on: 1992-11-02
2 -- Created by: Christian CAILLET
3 -- Copyright (c) 1992-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class EntityList from Interface
19 ---Purpose : This class defines a list of Entities (Transient Objects),
20 -- it can be used as a field of other Transient classes, with
22 -- - oriented to define a little list, that is, slower than an
23 -- Array or a Map of Entities for a big count (about 100 and
24 -- over), but faster than a Sequence
25 -- - allows to work as a Sequence, limited to Clear, Append,
26 -- Remove, Access to an Item identified by its rank in the list
27 -- - space saving, compared to a Sequence, especially for little
28 -- amounts; better than an Array for a very little amount (less
29 -- than 10) but less good for a greater amount
31 -- Works in conjunction with EntityCluster
32 -- An EntityList gives access to a list of Entity Clusters, which
33 -- are chained (in one sense : Single List)
34 -- Remark : a new Item may not be Null, because this is the
35 -- criterium used for "End of List"
37 uses Type, Transient, EntityCluster, EntityIterator
39 raises OutOfRange, InterfaceError, NullObject
43 Create returns EntityList;
44 ---Purpose : Creates a List as beeing empty
46 Clear (me : in out) is static;
47 ---Purpose : Clears the List
49 Append (me : in out; ent : any Transient)
50 ---Purpose : Appends an Entity, that is to the END of the list
51 -- (keeps order, but works slowerly than Add, see below)
52 raises NullObject is static;
53 -- Error if <ent> is Null
55 Add (me : in out; ent : any Transient)
56 ---Purpose : Adds an Entity to the list, that is, with NO REGARD about the
57 -- order (faster than Append if count becomes greater than 10)
58 raises NullObject is static;
59 -- Error if <ent> is Null
61 Remove (me : in out; ent : any Transient)
62 ---Purpose : Removes an Entity from the list, if it is there
63 raises NullObject is static;
64 -- Error if <ent> is Null
66 Remove (me : in out; num : Integer)
67 ---Purpose : Removes an Entity from the list, given its rank
68 raises OutOfRange is static;
69 -- Error if <num> is not in range [1 - NbEntities]
71 IsEmpty (me) returns Boolean is static;
72 ---Purpose : Returns True if the list is empty
74 NbEntities (me) returns Integer is static;
75 ---Purpose : Returns count of recorded Entities
77 Value (me; num : Integer) returns any Transient
78 ---Purpose : Returns an Item given its number. Beware about the way the
79 -- list was filled (see above, Add and Append)
80 raises OutOfRange is static;
81 -- Error if <num> is not in range [1 - NbEntities]
82 ---C++ : return const &
84 SetValue (me : in out; num : Integer; ent : any Transient)
85 ---Purpose : Returns an Item given its number. Beware about the way the
86 -- list was filled (see above, Add and Append)
87 raises OutOfRange, NullObject is static;
88 -- Error if <num> is not in [1 - NbEntities], or if <ent> is Null
91 FillIterator (me; iter : in out EntityIterator) is static;
92 ---Purpose : fills an Iterator with the content of the list
93 -- (normal way to consult a list which has been filled with Add)
95 NbTypedEntities (me; atype : any Type) returns Integer is static;
96 ---Purpose : Returns count of Entities of a given Type (0 : none)
98 TypedEntity (me; atype : any Type; num : Integer = 0) returns any Transient
99 ---Purpose : Returns the Entity which is of a given type.
100 -- If num = 0 (D), there must be ONE AND ONLY ONE
101 -- If num > 0, returns the num-th entity of this type
102 raises InterfaceError is static;
103 -- Error if none or several found (num=0), or not enough (num>0)
107 theval : Transient; -- Null(zero), a Transient(one), EntityCluster(more)
108 -- Mandatory only one field