Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-03 09:16:38

0001 // Created on: 1992-02-04
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_UndefinedContent_HeaderFile
0018 #define _Interface_UndefinedContent_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Standard_Integer.hxx>
0024 #include <NCollection_Array1.hxx>
0025 #include <NCollection_HArray1.hxx>
0026 #include <TCollection_HAsciiString.hxx>
0027 #include <Interface_EntityList.hxx>
0028 #include <Standard_Transient.hxx>
0029 #include <Interface_ParamType.hxx>
0030 class TCollection_HAsciiString;
0031 class Interface_CopyTool;
0032 
0033 //! Defines resources for an "Undefined Entity" : such an Entity
0034 //! is used to describe an Entity which complies with the Norm,
0035 //! but of an Unknown Type : hence it is kept under a literal
0036 //! form (avoiding to loose data). UndefinedContent offers a way
0037 //! to store a list of Parameters, as literals or references to
0038 //! other Entities
0039 //!
0040 //! Each Interface must provide one "UndefinedEntity", which must
0041 //! have same basic description as all its types of entities :
0042 //! the best way would be double inheritance : on the Entity Root
0043 //! of the Norm and on an general "UndefinedEntity"
0044 //!
0045 //! While it is not possible to do so, the UndefinedEntity of each
0046 //! Interface can define its own UndefinedEntity by INCLUDING
0047 //! (in a field) this UndefinedContent
0048 //!
0049 //! Hence, for that UndefinedEntity, define a Constructor which
0050 //! creates this UndefinedContent, plus access methods to it
0051 //! (or to its data, calling methods defined here).
0052 //!
0053 //! Finally, the Protocols of each norm have to Create and
0054 //! Recognize Unknown Entities of this norm
0055 class Interface_UndefinedContent : public Standard_Transient
0056 {
0057 
0058 public:
0059   //! Defines an empty UndefinedContent
0060   Standard_EXPORT Interface_UndefinedContent();
0061 
0062   //! Gives count of recorded parameters
0063   Standard_EXPORT int NbParams() const;
0064 
0065   //! Gives count of Literal Parameters
0066   Standard_EXPORT int NbLiterals() const;
0067 
0068   //! Returns data of a Parameter : its type, and the entity if it
0069   //! designates en entity ("ent") or its literal value else ("str")
0070   //! Returned value (Boolean) : True if it is an Entity, False else
0071   Standard_EXPORT bool ParamData(const int                              num,
0072                                  Interface_ParamType&                   ptype,
0073                                  occ::handle<Standard_Transient>&       ent,
0074                                  occ::handle<TCollection_HAsciiString>& val) const;
0075 
0076   //! Returns the ParamType of a Param, given its rank
0077   //! Error if num is not between 1 and NbParams
0078   Standard_EXPORT Interface_ParamType ParamType(const int num) const;
0079 
0080   //! Returns True if a Parameter is recorded as an entity
0081   //! Error if num is not between 1 and NbParams
0082   Standard_EXPORT bool IsParamEntity(const int num) const;
0083 
0084   //! Returns Entity corresponding to a Param, given its rank
0085   Standard_EXPORT occ::handle<Standard_Transient> ParamEntity(const int num) const;
0086 
0087   //! Returns literal value of a Parameter, given its rank
0088   Standard_EXPORT occ::handle<TCollection_HAsciiString> ParamValue(const int num) const;
0089 
0090   //! Manages reservation for parameters (internal use)
0091   //! (nb : total count of parameters, nblit : count of literals)
0092   Standard_EXPORT void Reservate(const int nb, const int nblit);
0093 
0094   //! Adds a literal Parameter to the list
0095   Standard_EXPORT void AddLiteral(const Interface_ParamType                    ptype,
0096                                   const occ::handle<TCollection_HAsciiString>& val);
0097 
0098   //! Adds a Parameter which references an Entity
0099   Standard_EXPORT void AddEntity(const Interface_ParamType              ptype,
0100                                  const occ::handle<Standard_Transient>& ent);
0101 
0102   //! Removes a Parameter given its rank
0103   Standard_EXPORT void RemoveParam(const int num);
0104 
0105   //! Sets a new value for the Parameter <num>, to a literal value
0106   //! (if it referenced formerly an Entity, this Entity is removed)
0107   Standard_EXPORT void SetLiteral(const int                                    num,
0108                                   const Interface_ParamType                    ptype,
0109                                   const occ::handle<TCollection_HAsciiString>& val);
0110 
0111   //! Sets a new value for the Parameter <num>, to reference an
0112   //! Entity. To simply change the Entity, see the variant below
0113   Standard_EXPORT void SetEntity(const int                              num,
0114                                  const Interface_ParamType              ptype,
0115                                  const occ::handle<Standard_Transient>& ent);
0116 
0117   //! Changes the Entity referenced by the Parameter <num>
0118   //! (with same ParamType)
0119   Standard_EXPORT void SetEntity(const int num, const occ::handle<Standard_Transient>& ent);
0120 
0121   //! Returns globally the list of param entities. Note that it can
0122   //! be used as shared entity list for the UndefinedEntity
0123   Standard_EXPORT Interface_EntityList EntityList() const;
0124 
0125   //! Copies contents of undefined entities; deigned to be called by
0126   //! GetFromAnother method from Undefined entity of each Interface
0127   //! (the basic operation is the same regardless the norm)
0128   Standard_EXPORT void GetFromAnother(const occ::handle<Interface_UndefinedContent>& other,
0129                                       Interface_CopyTool&                            TC);
0130 
0131   DEFINE_STANDARD_RTTIEXT(Interface_UndefinedContent, Standard_Transient)
0132 
0133 private:
0134   int                                                                     thenbparams;
0135   int                                                                     thenbstr;
0136   occ::handle<NCollection_HArray1<int>>                                   theparams;
0137   occ::handle<NCollection_HArray1<occ::handle<TCollection_HAsciiString>>> thevalues;
0138   Interface_EntityList                                                    theentities;
0139 };
0140 
0141 #endif // _Interface_UndefinedContent_HeaderFile