Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:07

0001 // Created on: 1992-11-02
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Interface_EntityCluster_HeaderFile
0018 #define _Interface_EntityCluster_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Standard_Transient.hxx>
0024 #include <Standard_Integer.hxx>
0025 class Interface_EntityIterator;
0026 
0027 
0028 class Interface_EntityCluster;
0029 DEFINE_STANDARD_HANDLE(Interface_EntityCluster, Standard_Transient)
0030 
0031 //! Auxiliary class for EntityList. An EntityList designates an
0032 //! EntityCluster, which brings itself an fixed maximum count of
0033 //! Entities. If it is full, it gives access to another cluster
0034 //! ("Next"). This class is intended to give a good compromise
0035 //! between access time (faster than a Sequence, good for little
0036 //! count) and memory use (better than a Sequence in any case,
0037 //! overall for little count, better than an Array for a very
0038 //! little count. It is designed for a light management.
0039 //! Remark that a new Item may not be Null, because this is the
0040 //! criterium used for "End of List"
0041 class Interface_EntityCluster : public Standard_Transient
0042 {
0043 
0044 public:
0045 
0046   
0047   //! Creates an empty, non-chained, EntityCluster
0048   Standard_EXPORT Interface_EntityCluster();
0049   
0050   //! Creates a non-chained EntityCluster, filled with one Entity
0051   Standard_EXPORT Interface_EntityCluster(const Handle(Standard_Transient)& ent);
0052   
0053   //! Creates an empty EntityCluster, chained with another one
0054   //! (that is, put BEFORE this other one in the list)
0055   Standard_EXPORT Interface_EntityCluster(const Handle(Interface_EntityCluster)& ec);
0056   
0057   //! Creates an EntityCluster, filled with a first Entity, and
0058   //! chained to another EntityCluster (BEFORE it, as above)
0059   Standard_EXPORT Interface_EntityCluster(const Handle(Standard_Transient)& ant, const Handle(Interface_EntityCluster)& ec);
0060   
0061   //! Appends an Entity to the Cluster. If it is not full, adds the
0062   //! entity directly inside itself. Else, transmits to its Next
0063   //! and Creates it if it does not yet exist
0064   Standard_EXPORT void Append (const Handle(Standard_Transient)& ent);
0065   
0066   //! Removes an Entity from the Cluster. If it is not found, calls
0067   //! its Next one to do so.
0068   //! Returns True if it becomes itself empty, False else
0069   //! (thus, a Cluster which becomes empty is deleted from the list)
0070   Standard_EXPORT Standard_Boolean Remove (const Handle(Standard_Transient)& ent);
0071   
0072   //! Removes an Entity from the Cluster, given its rank. If <num>
0073   //! is greater than NbLocal, calls its Next with (num - NbLocal),
0074   //! Returns True if it becomes itself empty, False else
0075   Standard_EXPORT Standard_Boolean Remove (const Standard_Integer num);
0076   
0077   //! Returns total count of Entities (including Next)
0078   Standard_EXPORT Standard_Integer NbEntities() const;
0079   
0080   //! Returns the Entity identified by its rank in the list
0081   //! (including Next)
0082   Standard_EXPORT const Handle(Standard_Transient)& Value (const Standard_Integer num) const;
0083   
0084   //! Changes an Entity given its rank.
0085   Standard_EXPORT void SetValue (const Standard_Integer num, const Handle(Standard_Transient)& ent);
0086   
0087   //! Fills an Iterator with designated Entities (includes Next)
0088   Standard_EXPORT void FillIterator (Interface_EntityIterator& iter) const;
0089 
0090   //! Destructor 
0091   //! If Next exists, destroy from the last entity in reverse order.
0092   Standard_EXPORT virtual ~Interface_EntityCluster();
0093 
0094 friend class Interface_EntityList;
0095 
0096 
0097   DEFINE_STANDARD_RTTIEXT(Interface_EntityCluster,Standard_Transient)
0098 
0099 protected:
0100 
0101 
0102 
0103 
0104 private:
0105 
0106   
0107   //! Returns True if all the set of entities local to a Cluster is
0108   //! full. Used by EntityList.
0109   Standard_EXPORT Standard_Boolean IsLocalFull() const;
0110   
0111   //! Returns count of entities in the local set (without Next)
0112   //! Entities can then be read normally by method Value
0113   Standard_EXPORT Standard_Integer NbLocal() const;
0114   
0115   //! Returns True if a Cluster has a Next
0116   Standard_EXPORT Standard_Boolean HasNext() const;
0117   
0118   //! Returns Next Cluster in the chain
0119   Standard_EXPORT Handle(Interface_EntityCluster) Next() const;
0120 
0121   Handle(Standard_Transient) theents[4];
0122   Handle(Interface_EntityCluster) thenext;
0123 
0124 
0125 };
0126 
0127 
0128 
0129 
0130 
0131 
0132 
0133 #endif // _Interface_EntityCluster_HeaderFile