Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-16 09:18:39

0001 // Created on: 1997-01-03
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1997-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 _StepData_PDescr_HeaderFile
0018 #define _StepData_PDescr_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TCollection_AsciiString.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <StepData_EnumTool.hxx>
0026 #include <Standard_Transient.hxx>
0027 #include <Standard_CString.hxx>
0028 class StepData_EDescr;
0029 class StepData_Field;
0030 class Interface_Check;
0031 
0032 //! This class is intended to describe the authorized form for a
0033 //! parameter, as a type or a value for a field
0034 //!
0035 //! A PDescr firstly describes a type, which can be SELECT, i.e.
0036 //! have several members
0037 class StepData_PDescr : public Standard_Transient
0038 {
0039 
0040 public:
0041   Standard_EXPORT StepData_PDescr();
0042 
0043   Standard_EXPORT void SetName(const char* const name);
0044 
0045   Standard_EXPORT const char* Name() const;
0046 
0047   //! Declares this PDescr to be a Select, hence to have members
0048   //! <me> itself can be the first member
0049   Standard_EXPORT void SetSelect();
0050 
0051   //! Adds a member to a SELECT description
0052   Standard_EXPORT void AddMember(const occ::handle<StepData_PDescr>& member);
0053 
0054   //! Sets a name for SELECT member. To be used if a member is for
0055   //! an immediate type
0056   Standard_EXPORT void SetMemberName(const char* const memname);
0057 
0058   //! Sets <me> for an Integer value
0059   Standard_EXPORT void SetInteger();
0060 
0061   //! Sets <me> for a Real value
0062   Standard_EXPORT void SetReal();
0063 
0064   //! Sets <me> for a String value
0065   Standard_EXPORT void SetString();
0066 
0067   //! Sets <me> for a Boolean value (false,true)
0068   Standard_EXPORT void SetBoolean();
0069 
0070   //! Sets <me> for a Logical value (false,true,unknown)
0071   Standard_EXPORT void SetLogical();
0072 
0073   //! Sets <me> for an Enum value
0074   //! Then, call AddEnumDef ordered from the first one (value 0)
0075   Standard_EXPORT void SetEnum();
0076 
0077   //! Adds an enum value as a string
0078   Standard_EXPORT void AddEnumDef(const char* const enumdef);
0079 
0080   //! Sets <me> for an Entity which must match a Type (early-bound)
0081   Standard_EXPORT void SetType(const occ::handle<Standard_Type>& atype);
0082 
0083   //! Sets <me> for a Described Entity, whose Description must match
0084   //! the type name <dscnam>
0085   Standard_EXPORT void SetDescr(const char* const dscnam);
0086 
0087   //! Adds an arity count to <me>, by default 1
0088   //! 1 : a simple field passes to a LIST/ARRAY etc
0089   //! or a LIST to a LIST OF LIST
0090   //! 2 : a simple field passes to a LIST OF LIST
0091   Standard_EXPORT void AddArity(const int arity = 1);
0092 
0093   //! Directly sets the arity count
0094   //! 0 : simple field
0095   //! 1 : LIST or ARRAY etc
0096   //! 2 : LIST OF LIST
0097   Standard_EXPORT void SetArity(const int arity = 1);
0098 
0099   //! Sets <me> as <other> but duplicated
0100   //! Hence, some definition may be changed
0101   Standard_EXPORT void SetFrom(const occ::handle<StepData_PDescr>& other);
0102 
0103   //! Sets/Unsets <me> to accept undefined values
0104   Standard_EXPORT void SetOptional(const bool opt = true);
0105 
0106   //! Sets/Unsets <me> to be for a derived field
0107   Standard_EXPORT void SetDerived(const bool der = true);
0108 
0109   //! Sets <me> to describe a field of an entity
0110   //! With a name and a rank
0111   Standard_EXPORT void SetField(const char* const name, const int rank);
0112 
0113   //! Tells if <me> is for a SELECT
0114   Standard_EXPORT bool IsSelect() const;
0115 
0116   //! For a SELECT, returns the member whose name matches <name>
0117   //! To this member, the following question can then be asked
0118   //! Null Handle if <name> not matched or <me> not a SELECT
0119   //!
0120   //! Remark : not to be asked for an entity type
0121   //! Hence, following IsInteger .. Enum* only apply on <me> and
0122   //! require Member
0123   //! While IsType applies on <me> and all Select Members
0124   Standard_EXPORT occ::handle<StepData_PDescr> Member(const char* const name) const;
0125 
0126   //! Tells if <me> is for an Integer
0127   Standard_EXPORT bool IsInteger() const;
0128 
0129   //! Tells if <me> is for a Real value
0130   Standard_EXPORT bool IsReal() const;
0131 
0132   //! Tells if <me> is for a String value
0133   Standard_EXPORT bool IsString() const;
0134 
0135   //! Tells if <me> is for a Boolean value (false,true)
0136   Standard_EXPORT bool IsBoolean() const;
0137 
0138   //! Tells if <me> is for a Logical value (false,true,unknown)
0139   Standard_EXPORT bool IsLogical() const;
0140 
0141   //! Tells if <me> is for an Enum value
0142   //! Then, call AddEnumDef ordered from the first one (value 0)
0143   //! Managed by an EnumTool
0144   Standard_EXPORT bool IsEnum() const;
0145 
0146   //! Returns the maximum integer for a suitable value (count - 1)
0147   Standard_EXPORT int EnumMax() const;
0148 
0149   //! Returns the numeric value found for an enum text
0150   //! The text must be in capitals and limited by dots
0151   //! A non-suitable text gives a negative value to be returned
0152   Standard_EXPORT int EnumValue(const char* const name) const;
0153 
0154   //! Returns the text which corresponds to a numeric value,
0155   //! between 0 and EnumMax. It is limited by dots
0156   Standard_EXPORT const char* EnumText(const int val) const;
0157 
0158   //! Tells if <me> is for an Entity, either Described or CDL Type
0159   Standard_EXPORT bool IsEntity() const;
0160 
0161   //! Tells if <me> is for an entity of a given CDL type (early-bnd)
0162   //! (works for <me> + nexts if <me> is a Select)
0163   Standard_EXPORT bool IsType(const occ::handle<Standard_Type>& atype) const;
0164 
0165   //! Returns the type to match (IsKind), for a CDL Entity
0166   //! (else, null handle)
0167   Standard_EXPORT occ::handle<Standard_Type> Type() const;
0168 
0169   //! Tells if <me> is for a Described entity of a given EDescr
0170   //! (does this EDescr match description name ?). For late-bnd
0171   //! (works for <me> + nexts if <me> is a Select)
0172   Standard_EXPORT bool IsDescr(const occ::handle<StepData_EDescr>& descr) const;
0173 
0174   //! Returns the description (type name) to match, for a Described
0175   //! (else, empty string)
0176   Standard_EXPORT const char* DescrName() const;
0177 
0178   //! Returns the arity of <me>
0179   Standard_EXPORT int Arity() const;
0180 
0181   //! For a LIST or LIST OF LIST, Returns the PDescr for the simpler
0182   //! PDescr. Else, returns <me>
0183   //! This allows to have different attributes for Optional for
0184   //! instance, on a field, and on the parameter of a LIST :
0185   //! [OPTIONAL] LIST OF [OPTIONAL] ...
0186   Standard_EXPORT occ::handle<StepData_PDescr> Simple() const;
0187 
0188   //! Tells if <me> is Optional
0189   Standard_EXPORT bool IsOptional() const;
0190 
0191   //! Tells if <me> is Derived
0192   Standard_EXPORT bool IsDerived() const;
0193 
0194   //! Tells if <me> is a Field. Else it is a Type
0195   Standard_EXPORT bool IsField() const;
0196 
0197   Standard_EXPORT const char* FieldName() const;
0198 
0199   Standard_EXPORT int FieldRank() const;
0200 
0201   //! Semantic Check of a Field : does it complies with the given
0202   //! description ?
0203   Standard_EXPORT virtual void Check(const StepData_Field&         afild,
0204                                      occ::handle<Interface_Check>& ach) const;
0205 
0206   DEFINE_STANDARD_RTTIEXT(StepData_PDescr, Standard_Transient)
0207 
0208 private:
0209   Standard_EXPORT int Kind() const;
0210 
0211   TCollection_AsciiString      thename;
0212   int                          thesel;
0213   TCollection_AsciiString      thesnam;
0214   occ::handle<StepData_PDescr> thenext;
0215   int                          thekind;
0216   StepData_EnumTool            theenum;
0217   occ::handle<Standard_Type>   thetype;
0218   TCollection_AsciiString      thednam;
0219   int                          thearit;
0220   occ::handle<StepData_PDescr> thefrom;
0221   bool                         theopt;
0222   bool                         theder;
0223   TCollection_AsciiString      thefnam;
0224   int                          thefnum;
0225 };
0226 
0227 #endif // _StepData_PDescr_HeaderFile