Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:17:48

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_Protocol_HeaderFile
0018 #define _Interface_Protocol_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_Graph;
0026 class Interface_Check;
0027 class Interface_InterfaceModel;
0028 
0029 //! General description of Interface Protocols. A Protocol defines
0030 //! a set of Entity types. This class provides also the notion of
0031 //! Active Protocol, as a working context, defined once then
0032 //! exploited by various Tools and Libraries.
0033 //!
0034 //! It also gives control of type definitions. By default, types
0035 //! are provided by CDL, but specific implementations, or topics
0036 //! like multi-typing, may involve another way
0037 class Interface_Protocol : public Standard_Transient
0038 {
0039 
0040 public:
0041   //! Returns the Active Protocol, if defined (else, returns a
0042   //! Null Handle, which means "no defined active protocol")
0043   Standard_EXPORT static occ::handle<Interface_Protocol> Active();
0044 
0045   //! Sets a given Protocol to be the Active one (for the users of
0046   //! Active, see just above). Applies to every sub-type of Protocol
0047   Standard_EXPORT static void SetActive(const occ::handle<Interface_Protocol>& aprotocol);
0048 
0049   //! Erases the Active Protocol (hence it becomes undefined)
0050   Standard_EXPORT static void ClearActive();
0051 
0052   //! Returns count of Protocol used as Resources (level one)
0053   Standard_EXPORT virtual int NbResources() const = 0;
0054 
0055   //! Returns a Resource, given its rank (between 1 and NbResources)
0056   Standard_EXPORT virtual occ::handle<Interface_Protocol> Resource(const int num) const = 0;
0057 
0058   //! Returns a unique positive CaseNumber for each Recognized
0059   //! Object. By default, recognition is based on Type(1)
0060   //! By default, calls the following one which is deferred.
0061   Standard_EXPORT virtual int CaseNumber(const occ::handle<Standard_Transient>& obj) const;
0062 
0063   //! Returns True if type of <obj> is that defined from CDL
0064   //! This is the default but it may change according implementation
0065   Standard_EXPORT virtual bool IsDynamicType(const occ::handle<Standard_Transient>& obj) const;
0066 
0067   //! Returns the count of DISTINCT types under which an entity may
0068   //! be processed. Each one is candidate to be recognized by
0069   //! TypeNumber, <obj> is then processed according it
0070   //! By default, returns 1 (the DynamicType)
0071   Standard_EXPORT virtual int NbTypes(const occ::handle<Standard_Transient>& obj) const;
0072 
0073   //! Returns a type under which <obj> can be recognized and
0074   //! processed, according its rank in its definition list (see
0075   //! NbTypes).
0076   //! By default, returns DynamicType
0077   Standard_EXPORT occ::handle<Standard_Type> Type(const occ::handle<Standard_Transient>& obj,
0078                                                   const int nt = 1) const;
0079 
0080   //! Returns a unique positive CaseNumber for each Recognized Type,
0081   //! Returns Zero for "<type> not recognized"
0082   Standard_EXPORT virtual int TypeNumber(const occ::handle<Standard_Type>& atype) const = 0;
0083 
0084   //! Evaluates a Global Check for a model (with its Graph)
0085   //! Returns True when done, False if data in model do not apply
0086   //!
0087   //! Very specific of each norm, i.e. of each protocol : the
0088   //! uppest level Protocol assumes it, it can call GlobalCheck of
0089   //! its resources only if it is necessary
0090   //!
0091   //! Default does nothing, can be redefined
0092   Standard_EXPORT virtual bool GlobalCheck(const Interface_Graph&        G,
0093                                            occ::handle<Interface_Check>& ach) const;
0094 
0095   //! Creates an empty Model of the considered Norm
0096   Standard_EXPORT virtual occ::handle<Interface_InterfaceModel> NewModel() const = 0;
0097 
0098   //! Returns True if <model> is a Model of the considered Norm
0099   Standard_EXPORT virtual bool IsSuitableModel(
0100     const occ::handle<Interface_InterfaceModel>& model) const = 0;
0101 
0102   //! Creates a new Unknown Entity for the considered Norm
0103   Standard_EXPORT virtual occ::handle<Standard_Transient> UnknownEntity() const = 0;
0104 
0105   //! Returns True if <ent> is an Unknown Entity for the Norm, i.e.
0106   //! same Type as them created by method UnknownEntity
0107   //! (for an Entity out of the Norm, answer can be unpredictable)
0108   Standard_EXPORT virtual bool IsUnknownEntity(
0109     const occ::handle<Standard_Transient>& ent) const = 0;
0110 
0111   DEFINE_STANDARD_RTTIEXT(Interface_Protocol, Standard_Transient)
0112 };
0113 
0114 #endif // _Interface_Protocol_HeaderFile