Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:08

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