Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-06 08:36:26

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