Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-29 09:19:27

0001 // Created on: 1993-02-02
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1993-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_ShareTool_HeaderFile
0018 #define _Interface_ShareTool_HeaderFile
0019 
0020 #include <Standard_Type.hxx>
0021 
0022 class Interface_HGraph;
0023 class Interface_InterfaceModel;
0024 class Interface_GeneralLib;
0025 class Interface_GTool;
0026 class Interface_Protocol;
0027 class Interface_Graph;
0028 class Interface_EntityIterator;
0029 
0030 //! Builds the Graph of Dependencies, from the General Service
0031 //! "Shared" -> builds for each Entity of a Model, the Shared and
0032 //! Sharing Lists, and gives access to them.
0033 //! Allows to complete with Implied References (which are not
0034 //! regarded as Shared Entities, but are nevertheless Referenced),
0035 //! this can be useful for Reference Checking
0036 class Interface_ShareTool
0037 {
0038 public:
0039   DEFINE_STANDARD_ALLOC
0040 
0041   //! Creates a ShareTool from a Model and builds all required data,
0042   //! by calling the General Service Library and Modules
0043   //! (GeneralLib given as an argument)
0044   Standard_EXPORT Interface_ShareTool(const occ::handle<Interface_InterfaceModel>& amodel,
0045                                       const Interface_GeneralLib&                  lib);
0046 
0047   //! Same a above, but GeneralLib is detained by a GTool
0048   Standard_EXPORT Interface_ShareTool(const occ::handle<Interface_InterfaceModel>& amodel,
0049                                       const occ::handle<Interface_GTool>&          gtool);
0050 
0051   //! Same a above, but GeneralLib is defined through a Protocol
0052   //! Protocol is used to build the working library
0053   Standard_EXPORT Interface_ShareTool(const occ::handle<Interface_InterfaceModel>& amodel,
0054                                       const occ::handle<Interface_Protocol>&       protocol);
0055 
0056   //! Same as above, but works with the GTool of the Model
0057   Standard_EXPORT Interface_ShareTool(const occ::handle<Interface_InterfaceModel>& amodel);
0058 
0059   //! Creates a ShareTool from an already defined Graph
0060   //! Remark that the data of the Graph are copied
0061   Standard_EXPORT Interface_ShareTool(const Interface_Graph& agraph);
0062 
0063   //! Completes the Graph by Adding Implied References. Hence, they
0064   //! are considered as Sharing References in all the other queries
0065   Standard_EXPORT Interface_ShareTool(const occ::handle<Interface_HGraph>& ahgraph);
0066 
0067   //! Returns the Model used for Creation (directly or for Graph)
0068   Standard_EXPORT occ::handle<Interface_InterfaceModel> Model() const;
0069 
0070   //! Returns the data used by the ShareTool to work
0071   //! Can then be used directly (read only)
0072   Standard_EXPORT const Interface_Graph& Graph() const;
0073 
0074   //! Returns the Entities which are not Shared (their Sharing List
0075   //! is empty) in the Model
0076   Standard_EXPORT Interface_EntityIterator RootEntities() const;
0077 
0078   //! Returns True if <ent> is Shared by other Entities in the Model
0079   Standard_EXPORT bool IsShared(const occ::handle<Standard_Transient>& ent) const;
0080 
0081   //! Returns the List of Entities Shared by a given Entity <ent>
0082   Standard_EXPORT Interface_EntityIterator
0083     Shareds(const occ::handle<Standard_Transient>& ent) const;
0084 
0085   //! Returns the List of Entities Sharing a given Entity <ent>
0086   Standard_EXPORT Interface_EntityIterator
0087     Sharings(const occ::handle<Standard_Transient>& ent) const;
0088 
0089   //! Returns the count of Sharing Entities of an Entity, which
0090   //! are Kind of a given Type
0091   Standard_EXPORT int NbTypedSharings(const occ::handle<Standard_Transient>& ent,
0092                                       const occ::handle<Standard_Type>&      atype) const;
0093 
0094   //! Returns the Sharing Entity of an Entity, which is Kind of a
0095   //! given Type. Allows to access a Sharing Entity of a given type
0096   //! when there is one and only one (current case)
0097   Standard_EXPORT occ::handle<Standard_Transient> TypedSharing(
0098     const occ::handle<Standard_Transient>& ent,
0099     const occ::handle<Standard_Type>&      atype) const;
0100 
0101   //! Returns the complete list of entities shared by <ent> at any
0102   //! level, including <ent> itself
0103   //! If <ent> is the Model, considers the concatenation of
0104   //! AllShared for each root
0105   //! If <rootlast> is True (D), the list starts with lower level
0106   //! entities and ends by the root. Else, the root is first and
0107   //! the lower level entities are at end
0108   Standard_EXPORT Interface_EntityIterator All(const occ::handle<Standard_Transient>& ent,
0109                                                const bool rootlast = true) const;
0110 
0111   //! Utility method which Prints the content of an iterator
0112   //! (by their Numbers)
0113   Standard_EXPORT void Print(const Interface_EntityIterator& iter, Standard_OStream& S) const;
0114 
0115 private:
0116   occ::handle<Interface_HGraph> theHGraph;
0117 };
0118 
0119 #endif // _Interface_ShareTool_HeaderFile