Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-03 10:31:15

0001 // Created on: 1998-01-08
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1998-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_GTool_HeaderFile
0018 #define _Interface_GTool_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Interface_GeneralLib.hxx>
0024 #include <Standard_Transient.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <NCollection_DataMap.hxx>
0027 #include <NCollection_IndexedDataMap.hxx>
0028 class Interface_Protocol;
0029 class Interface_SignType;
0030 class Interface_InterfaceModel;
0031 class Interface_GeneralModule;
0032 
0033 //! GTool - General Tool for a Model
0034 //! Provides the functions performed by Protocol/GeneralModule for
0035 //! entities of a Model, and recorded in a GeneralLib
0036 //! Optimized : once an entity has been queried, the GeneralLib is
0037 //! not longer queried
0038 //! Shareable between several users : as a Handle
0039 class Interface_GTool : public Standard_Transient
0040 {
0041 
0042 public:
0043   //! Creates an empty, not set, GTool
0044   Standard_EXPORT Interface_GTool();
0045 
0046   //! Creates a GTool from a Protocol
0047   //! Optional starting count of entities
0048   Standard_EXPORT Interface_GTool(const occ::handle<Interface_Protocol>& proto,
0049                                   const int                              nbent = 0);
0050 
0051   //! Sets a new SignType
0052   Standard_EXPORT void SetSignType(const occ::handle<Interface_SignType>& sign);
0053 
0054   //! Returns the SignType. Can be null
0055   Standard_EXPORT occ::handle<Interface_SignType> SignType() const;
0056 
0057   //! Returns the Signature for a Transient Object in a Model
0058   //! It calls SignType to do that
0059   //! If SignType is not defined, return ClassName of <ent>
0060   Standard_EXPORT const char* SignValue(const occ::handle<Standard_Transient>&       ent,
0061                                         const occ::handle<Interface_InterfaceModel>& model) const;
0062 
0063   //! Returns the Name of the SignType, or "Class Name"
0064   Standard_EXPORT const char* SignName() const;
0065 
0066   //! Sets a new Protocol
0067   //! if <enforce> is False and the new Protocol equates the old one
0068   //! then nothing is done
0069   Standard_EXPORT void SetProtocol(const occ::handle<Interface_Protocol>& proto,
0070                                    const bool                             enforce = false);
0071 
0072   //! Returns the Protocol. Warning: it can be Null
0073   Standard_EXPORT occ::handle<Interface_Protocol> Protocol() const;
0074 
0075   //! Returns the GeneralLib itself
0076   Standard_EXPORT Interface_GeneralLib& Lib();
0077 
0078   //! Reservates maps for a count of entities
0079   //! <enforce> False : minimum count
0080   //! <enforce> True  : clears former reservations
0081   //! Does not clear the maps
0082   Standard_EXPORT void Reservate(const int nb, const bool enforce = false);
0083 
0084   //! Clears the maps which record, for each already recorded entity
0085   //! its Module and Case Number
0086   Standard_EXPORT void ClearEntities();
0087 
0088   //! Selects for an entity, its Module and Case Number
0089   //! It is optimised : once done for each entity, the result is
0090   //! mapped and the GeneralLib is not longer queried
0091   //! <enforce> True overpasses this optimisation
0092   Standard_EXPORT bool Select(const occ::handle<Standard_Transient>& ent,
0093                               occ::handle<Interface_GeneralModule>&  gmod,
0094                               int&                                   CN,
0095                               const bool                             enforce = false);
0096 
0097   DEFINE_STANDARD_RTTIEXT(Interface_GTool, Standard_Transient)
0098 
0099 private:
0100   occ::handle<Interface_Protocol>                           theproto;
0101   occ::handle<Interface_SignType>                           thesign;
0102   Interface_GeneralLib                                      thelib;
0103   NCollection_DataMap<occ::handle<Standard_Transient>, int> thentnum;
0104   NCollection_IndexedDataMap<occ::handle<Standard_Transient>, occ::handle<Standard_Transient>>
0105     thentmod;
0106 };
0107 
0108 #endif // _Interface_GTool_HeaderFile