Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:06

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