Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-03 09:17:41

0001 // Created on: 1993-03-26
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 _StepData_SelectType_HeaderFile
0018 #define _StepData_SelectType_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Integer.hxx>
0025 #include <Standard_Type.hxx>
0026 #include <Standard_CString.hxx>
0027 #include <StepData_Logical.hxx>
0028 class Standard_Transient;
0029 class StepData_PDescr;
0030 class StepData_SelectMember;
0031 
0032 //! SelectType is the basis used for SELECT_TYPE definitions from
0033 //! the EXPRESS form. A SELECT_TYPE in EXPRESS is an enumeration
0034 //! of Types, it corresponds in a way to a Super-Type, but with
0035 //! no specific Methods, and no exclusivity (a given Type can be
0036 //! member of several SELECT_TYPES, plus be itself a SUB_TYPE).
0037 //!
0038 //! A SelectType can be field of a Transient Entity or only used
0039 //! to control an input Argument
0040 //!
0041 //! This class implies to designate each member Type by a Case
0042 //! Number which is a positive Integer value (this allows a faster treatment).
0043 //!
0044 //! With this class, a specific SelectType can :
0045 //! - recognize an Entity as complying or not with its definition,
0046 //! - storing it, with the guarantee that the stored Entity complies
0047 //! with the definition of the SelectType
0048 //! - and (if judged useful) give the stored Entity under the good
0049 //! Type rather than simply "Transient".
0050 class StepData_SelectType
0051 {
0052 public:
0053   DEFINE_STANDARD_ALLOC
0054 
0055   //! Recognizes the Type of an Entity. Returns a positive Number
0056   //! which identifies the Type in the definition List of the
0057   //! SelectType. Returns Zero if its Type in not in this List.
0058   Standard_EXPORT virtual int CaseNum(const occ::handle<Standard_Transient>& ent) const = 0;
0059 
0060   //! Returns True if the Type of an Entity complies with the
0061   //! definition list of the SelectType.
0062   //! Also checks for a SelectMember
0063   //! Default Implementation looks for CaseNum or CaseMem positive
0064   Standard_EXPORT bool Matches(const occ::handle<Standard_Transient>& ent) const;
0065 
0066   //! Stores an Entity. This allows to define a specific SelectType
0067   //! class with one read method per member Type, which returns the
0068   //! Value casted with the good Type.
0069   Standard_EXPORT void SetValue(const occ::handle<Standard_Transient>& ent);
0070 
0071   //! Nullifies the Stored Entity
0072   Standard_EXPORT void Nullify();
0073 
0074   //! Returns the Stored Entity. Can be used to define specific
0075   //! read methods (see above)
0076   Standard_EXPORT const occ::handle<Standard_Transient>& Value() const;
0077 
0078   //! Returns True if there is no Stored Entity (i.e. it is Null)
0079   Standard_EXPORT bool IsNull() const;
0080 
0081   //! Returns the Effective (Dynamic) Type of the Stored Entity
0082   //! If it is Null, returns TYPE(Transient)
0083   Standard_EXPORT occ::handle<Standard_Type> Type() const;
0084 
0085   //! Recognizes the Type of the stored Entity, or zero if it is
0086   //! Null or SelectMember. Calls the first method CaseNum on Value
0087   Standard_EXPORT int CaseNumber() const;
0088 
0089   //! Returns the Description which corresponds to <me>
0090   //! Null if no specific description to give. This description is
0091   //! used to control reading an check validity.
0092   //! Default returns a Null Handle, i.e. undefined description
0093   //! It can suffice if CaseNum and CaseMem give enough control
0094   Standard_EXPORT virtual occ::handle<StepData_PDescr> Description() const;
0095 
0096   //! Returns a preferred SelectMember. Default returns a Null
0097   //! By default, a SelectMember can be set according to data type
0098   //! and Name : it is a SelectNamed if Name is defined
0099   //!
0100   //! This method allows to define, for a specific SelectType, a
0101   //! specific SelectMember than SelectNamed. For instance for a
0102   //! Real plus a Name, a SelectReal plus a case number is a good
0103   //! solution, lighter than SelectNamed which is very multipurpose
0104   Standard_EXPORT virtual occ::handle<StepData_SelectMember> NewMember() const;
0105 
0106   //! Recognize a SelectMember (kind, name). Returns a positive
0107   //! value which identifies the case in the List of immediate cases
0108   //! (distinct from the List of Entity Types). Zero if not
0109   //! recognizes
0110   //! Default returns 0, saying that no immediate value is allowed
0111   Standard_EXPORT virtual int CaseMem(const occ::handle<StepData_SelectMember>& ent) const;
0112 
0113   //! Returns the Type of the stored SelectMember, or zero if it is
0114   //! Null or Entity. Calls the method CaseMem on Value
0115   Standard_EXPORT int CaseMember() const;
0116 
0117   //! Returns Value as a SelectMember. Null if not a SelectMember
0118   Standard_EXPORT occ::handle<StepData_SelectMember> Member() const;
0119 
0120   //! Returns the type name of SelectMember. If no SelectMember or
0121   //! with no type name, returns an empty string
0122   //! To change it, pass through the SelectMember itself
0123   Standard_EXPORT const char* SelectName() const;
0124 
0125   //! This internal method gives access to a value implemented by an
0126   //! Integer (to read it)
0127   Standard_EXPORT int Int() const;
0128 
0129   //! This internal method gives access to a value implemented by an
0130   //! Integer (to set it) : a SelectMember MUST ALREADY BE THERE !
0131   Standard_EXPORT void SetInt(const int val);
0132 
0133   //! Gets the value as an Integer
0134   Standard_EXPORT int Integer() const;
0135 
0136   //! Sets a new Integer value, with an optional type name
0137   //! Warning : If a SelectMember is already set, works on it : value and
0138   //! name must then be accepted by this SelectMember
0139   Standard_EXPORT void SetInteger(const int val, const char* const name = "");
0140 
0141   Standard_EXPORT bool Boolean() const;
0142 
0143   Standard_EXPORT void SetBoolean(const bool val, const char* const name = "");
0144 
0145   Standard_EXPORT StepData_Logical Logical() const;
0146 
0147   Standard_EXPORT void SetLogical(const StepData_Logical val, const char* const name = "");
0148 
0149   Standard_EXPORT double Real() const;
0150 
0151   Standard_EXPORT void SetReal(const double val, const char* const name = "");
0152 
0153   Standard_EXPORT virtual ~StepData_SelectType();
0154 
0155 private:
0156   occ::handle<Standard_Transient> thevalue;
0157 };
0158 
0159 #endif // _StepData_SelectType_HeaderFile