0030686: Visualization, SelectMgr_ViewerSelector - sorting issues of transformation...
[occt.git] / src / Interface / Interface_EntityList.hxx
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
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Interface_EntityList_HeaderFile
18 #define _Interface_EntityList_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Integer.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <Standard_Type.hxx>
27 class Standard_Transient;
28 class Standard_OutOfRange;
29 class Interface_InterfaceError;
30 class Standard_NullObject;
31 class Interface_EntityIterator;
32
33
34 //! This class defines a list of Entities (Transient Objects),
35 //! it can be used as a field of other Transient classes, with
36 //! these features :
37 //! - oriented to define a little list, that is, slower than an
38 //! Array or a Map of Entities for a big count (about 100 and
39 //! over), but faster than a Sequence
40 //! - allows to work as a Sequence, limited to Clear, Append,
41 //! Remove, Access to an Item identified by its rank in the list
42 //! - space saving, compared to a Sequence, especially for little
43 //! amounts; better than an Array for a very little amount (less
44 //! than 10) but less good for a greater amount
45 //!
46 //! Works in conjunction with EntityCluster
47 //! An EntityList gives access to a list of Entity Clusters, which
48 //! are chained (in one sense : Single List)
49 //! Remark : a new Item may not be Null, because this is the
50 //! criterium used for "End of List"
51 class Interface_EntityList 
52 {
53 public:
54
55   DEFINE_STANDARD_ALLOC
56
57   
58   //! Creates a List as beeing empty
59   Standard_EXPORT Interface_EntityList();
60   
61   //! Clears the List
62   Standard_EXPORT void Clear();
63   
64   //! Appends an Entity, that is to the END of the list
65   //! (keeps order, but works slowerly than Add, see below)
66   Standard_EXPORT void Append (const Handle(Standard_Transient)& ent);
67   
68   //! Adds an Entity to the list, that is, with NO REGARD about the
69   //! order (faster than Append if count becomes greater than 10)
70   Standard_EXPORT void Add (const Handle(Standard_Transient)& ent);
71   
72   //! Removes an Entity from the list, if it is there
73   Standard_EXPORT void Remove (const Handle(Standard_Transient)& ent);
74   
75   //! Removes an Entity from the list, given its rank
76   Standard_EXPORT void Remove (const Standard_Integer num);
77   
78   //! Returns True if the list is empty
79   Standard_EXPORT Standard_Boolean IsEmpty() const;
80   
81   //! Returns count of recorded Entities
82   Standard_EXPORT Standard_Integer NbEntities() const;
83   
84   //! Returns an Item given its number. Beware about the way the
85   //! list was filled (see above, Add and Append)
86   Standard_EXPORT const Handle(Standard_Transient)& Value (const Standard_Integer num) const;
87   
88   //! Returns an Item given its number. Beware about the way the
89   //! list was filled (see above, Add and Append)
90   Standard_EXPORT void SetValue (const Standard_Integer num, const Handle(Standard_Transient)& ent);
91   
92   //! fills an Iterator with the content of the list
93   //! (normal way to consult a list which has been filled with Add)
94   Standard_EXPORT void FillIterator (Interface_EntityIterator& iter) const;
95   
96   //! Returns count of Entities of a given Type (0 : none)
97   Standard_EXPORT Standard_Integer NbTypedEntities (const Handle(Standard_Type)& atype) const;
98   
99   //! 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   Standard_EXPORT Handle(Standard_Transient) TypedEntity (const Handle(Standard_Type)& atype, const Standard_Integer num = 0) const;
103
104
105
106
107 protected:
108
109
110
111
112
113 private:
114
115
116
117   Handle(Standard_Transient) theval;
118
119
120 };
121
122
123
124
125
126
127
128 #endif // _Interface_EntityList_HeaderFile