0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / Interface / Interface_EntityCluster.hxx
CommitLineData
42cf5bc1 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_EntityCluster_HeaderFile
18#define _Interface_EntityCluster_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
25e59720 23#include <Standard_Transient.hxx>
42cf5bc1 24#include <Standard_Boolean.hxx>
25#include <Standard_Integer.hxx>
26class Standard_Transient;
27class Standard_OutOfRange;
28class Standard_NullObject;
29class Interface_EntityList;
30class Interface_EntityIterator;
31
32
33class Interface_EntityCluster;
25e59720 34DEFINE_STANDARD_HANDLE(Interface_EntityCluster, Standard_Transient)
42cf5bc1 35
36//! Auxiliary class for EntityList. An EntityList designates an
37//! EntityCluster, which brings itself an fixed maximum count of
38//! Entities. If it is full, it gives access to another cluster
39//! ("Next"). This class is intended to give a good compromise
40//! between access time (faster than a Sequence, good for little
41//! count) and memory use (better than a Sequence in any case,
42//! overall for little count, better than an Array for a very
43//! little count. It is designed for a light management.
44//! Remark that a new Item may not be Null, because this is the
45//! criterium used for "End of List"
25e59720 46class Interface_EntityCluster : public Standard_Transient
42cf5bc1 47{
48
49public:
50
51
52 //! Creates an empty, non-chained, EntityCluster
53 Standard_EXPORT Interface_EntityCluster();
54
55 //! Creates a non-chained EntityCluster, filled with one Entity
56 Standard_EXPORT Interface_EntityCluster(const Handle(Standard_Transient)& ent);
57
58 //! Creates an empty EntityCluster, chained with another one
59 //! (that is, put BEFORE this other one in the list)
60 Standard_EXPORT Interface_EntityCluster(const Handle(Interface_EntityCluster)& ec);
61
62 //! Creates an EntityCluster, filled with a first Entity, and
63 //! chained to another EntityCluster (BEFORE it, as above)
64 Standard_EXPORT Interface_EntityCluster(const Handle(Standard_Transient)& ant, const Handle(Interface_EntityCluster)& ec);
65
66 //! Appends an Entity to the Cluster. If it is not full, adds the
67 //! entity directly inside itself. Else, transmits to its Next
68 //! and Creates it if it does not yet exist
69 Standard_EXPORT void Append (const Handle(Standard_Transient)& ent);
70
71 //! Removes an Entity from the Cluster. If it is not found, calls
72 //! its Next one to do so.
73 //! Returns True if it becomes itself empty, False else
74 //! (thus, a Cluster which becomes empty is deleted from the list)
75 Standard_EXPORT Standard_Boolean Remove (const Handle(Standard_Transient)& ent);
76
77 //! Removes an Entity from the Cluster, given its rank. If <num>
78 //! is greater than NbLocal, calls its Next with (num - NbLocal),
79 //! Returns True if it becomes itself empty, False else
80 Standard_EXPORT Standard_Boolean Remove (const Standard_Integer num);
81
82 //! Returns total count of Entities (including Next)
83 Standard_EXPORT Standard_Integer NbEntities() const;
84
85 //! Returns the Entity identified by its rank in the list
86 //! (including Next)
87 Standard_EXPORT const Handle(Standard_Transient)& Value (const Standard_Integer num) const;
88
89 //! Changes an Entity given its rank.
90 Standard_EXPORT void SetValue (const Standard_Integer num, const Handle(Standard_Transient)& ent);
91
92 //! Fills an Iterator with designated Entities (includes Next)
93 Standard_EXPORT void FillIterator (Interface_EntityIterator& iter) const;
94
e00b8ed9 95 //! Destructor
96 //! If Next exists, destroy from the last entity in reverse order.
97 Standard_EXPORT virtual ~Interface_EntityCluster();
42cf5bc1 98
99friend class Interface_EntityList;
100
101
25e59720 102 DEFINE_STANDARD_RTTIEXT(Interface_EntityCluster,Standard_Transient)
42cf5bc1 103
104protected:
105
106
107
108
109private:
110
111
112 //! Returns True if all the set of entities local to a Cluster is
113 //! full. Used by EntityList.
114 Standard_EXPORT Standard_Boolean IsLocalFull() const;
115
116 //! Returns count of entities in the local set (without Next)
117 //! Entities can then be read normally by method Value
118 Standard_EXPORT Standard_Integer NbLocal() const;
119
120 //! Returns True if a Cluster has a Next
121 Standard_EXPORT Standard_Boolean HasNext() const;
122
123 //! Returns Next Cluster in the chain
124 Standard_EXPORT Handle(Interface_EntityCluster) Next() const;
125
126 Handle(Standard_Transient) theents[4];
127 Handle(Interface_EntityCluster) thenext;
128
129
130};
131
132
133
134
135
136
137
138#endif // _Interface_EntityCluster_HeaderFile