Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 09:29:24

0001 // Created on: 1996-12-16
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1996-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_Field_HeaderFile
0018 #define _StepData_Field_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Integer.hxx>
0025 #include <StepData_Logical.hxx>
0026 #include <Standard_CString.hxx>
0027 class StepData_SelectMember;
0028 
0029 //! Defines a generally defined Field for STEP data : can be used
0030 //! either in any kind of entity to implement it or in free format
0031 //! entities in a "late-binding" mode
0032 //! A field can have : no value (or derived), a single value of
0033 //! any kind, a list of value : single or double list
0034 //!
0035 //! When a field is set, this defines its new kind (Integer etc..)
0036 //! A single value is immediately set. A list of value is, firstly
0037 //! declared as for a kind (Integer String etc), then declared as
0038 //! a list with its initial size, after this its items are set
0039 //! Also it can be set in once if the HArray is ready
0040 class StepData_Field
0041 {
0042 public:
0043   DEFINE_STANDARD_ALLOC
0044 
0045   //! Creates a Field, empty ("no value defined")
0046   Standard_EXPORT StepData_Field();
0047 
0048   //! Creates a Field from another one. If <copy> is True, Handled
0049   //! data (Select,String,List, not entities) are copied
0050   Standard_EXPORT StepData_Field(const StepData_Field& other, const bool copy = false);
0051 
0052   //! Gets the copy of the values of another field
0053   Standard_EXPORT void CopyFrom(const StepData_Field& other);
0054 
0055   //! Assignment
0056   StepData_Field& operator=(const StepData_Field& theOther)
0057   {
0058     CopyFrom(theOther);
0059     return *this;
0060   }
0061 
0062   //! Clears the field, to set it as "no value defined"
0063   //! Just before SetList, predeclares it as "any"
0064   //! A Kind can be directly set here to declare a type
0065   Standard_EXPORT void Clear(const int kind = 0);
0066 
0067   //! Codes a Field as derived (no proper value)
0068   Standard_EXPORT void SetDerived();
0069 
0070   //! Directly sets the Integer value, if its Kind matches
0071   //! Integer, Boolean, Logical, or Enum (does not change Kind)
0072   Standard_EXPORT void SetInt(const int val);
0073 
0074   //! Sets an Integer value (before SetList* declares it as Integer)
0075   Standard_EXPORT void SetInteger(const int val = 0);
0076 
0077   //! Sets a Boolean value (or predeclares a list as boolean)
0078   Standard_EXPORT void SetBoolean(const bool val = false);
0079 
0080   //! Sets a Logical Value (or predeclares a list as logical)
0081   Standard_EXPORT void SetLogical(const StepData_Logical val = StepData_LFalse);
0082 
0083   //! Sets a Real Value (or predeclares a list as Real);
0084   Standard_EXPORT void SetReal(const double val = 0.0);
0085 
0086   //! Sets a String Value (or predeclares a list as String)
0087   //! Does not redefine the Kind if it is already String or Enum
0088   Standard_EXPORT void SetString(const char* const val = "");
0089 
0090   //! Sets an Enum Value (as its integer counterpart)
0091   //! (or predeclares a list as Enum)
0092   //! If <text> is given , also sets its textual expression
0093   //! <val> negative means unknown (known values begin at 0)
0094   Standard_EXPORT void SetEnum(const int val = -1, const char* const text = "");
0095 
0096   //! Sets a SelectMember (for Integer,Boolean,Enum,Real,Logical)
0097   //! Hence, the value of the field is accessed through this member
0098   Standard_EXPORT void SetSelectMember(const occ::handle<StepData_SelectMember>& val);
0099 
0100   //! Sets an Entity Value
0101   Standard_EXPORT void SetEntity(const occ::handle<Standard_Transient>& val);
0102 
0103   //! Predeclares a list as of entity
0104   Standard_EXPORT void SetEntity();
0105 
0106   //! Declares a field as a list, with an initial size
0107   //! Initial lower is defaulted as 1, can be defined
0108   //! The list starts empty, typed by the last Set*
0109   //! If no Set* before, sets it as "any" (transient/select)
0110   Standard_EXPORT void SetList(const int size, const int first = 1);
0111 
0112   //! Declares a field as an homogeneous square list, with initial
0113   //! sizes, and initial lowers
0114   Standard_EXPORT void SetList2(const int siz1, const int siz2, const int f1 = 1, const int f2 = 1);
0115 
0116   //! Sets an undetermined value : can be String, SelectMember,
0117   //! HArray(1-2) ... else, an Entity
0118   //! In case of an HArray, determines and records its size(s)
0119   Standard_EXPORT void Set(const occ::handle<Standard_Transient>& val);
0120 
0121   //! Declares an item of the list as undefined
0122   //! (ignored if list not defined as String,Entity or Any)
0123   Standard_EXPORT void ClearItem(const int num);
0124 
0125   //! Internal access to an Integer Value for a list, plus its kind
0126   Standard_EXPORT void SetInt(const int num, const int val, const int kind);
0127 
0128   //! Sets an Integer Value for a list (rank num)
0129   //! (recognizes a SelectMember)
0130   Standard_EXPORT void SetInteger(const int num, const int val);
0131 
0132   Standard_EXPORT void SetBoolean(const int num, const bool val);
0133 
0134   Standard_EXPORT void SetLogical(const int num, const StepData_Logical val);
0135 
0136   //! Sets an Enum Value (Integer counterpart), also its text
0137   //! expression if known (if list has been set as "any")
0138   Standard_EXPORT void SetEnum(const int num, const int val, const char* const text = "");
0139 
0140   Standard_EXPORT void SetReal(const int num, const double val);
0141 
0142   Standard_EXPORT void SetString(const int num, const char* const val);
0143 
0144   Standard_EXPORT void SetEntity(const int num, const occ::handle<Standard_Transient>& val);
0145 
0146   Standard_EXPORT bool IsSet(const int n1 = 1, const int n2 = 1) const;
0147 
0148   //! Returns the kind of an item in a list or double list
0149   //! It is the kind of the list, except if it is "Any", in such a
0150   //! case the true kind is determined and returned
0151   Standard_EXPORT int ItemKind(const int n1 = 1, const int n2 = 1) const;
0152 
0153   //! Returns the kind of the field
0154   //! <type> True (D) : returns only the type itself
0155   //! else, returns the complete kind
0156   Standard_EXPORT int Kind(const bool type = true) const;
0157 
0158   Standard_EXPORT int Arity() const;
0159 
0160   Standard_EXPORT int Length(const int index = 1) const;
0161 
0162   Standard_EXPORT int Lower(const int index = 1) const;
0163 
0164   Standard_EXPORT int Int() const;
0165 
0166   Standard_EXPORT int Integer(const int n1 = 1, const int n2 = 1) const;
0167 
0168   Standard_EXPORT bool Boolean(const int n1 = 1, const int n2 = 1) const;
0169 
0170   Standard_EXPORT StepData_Logical Logical(const int n1 = 1, const int n2 = 1) const;
0171 
0172   Standard_EXPORT double Real(const int n1 = 1, const int n2 = 1) const;
0173 
0174   Standard_EXPORT const char* String(const int n1 = 1, const int n2 = 1) const;
0175 
0176   Standard_EXPORT int Enum(const int n1 = 1, const int n2 = 1) const;
0177 
0178   Standard_EXPORT const char* EnumText(const int n1 = 1, const int n2 = 1) const;
0179 
0180   Standard_EXPORT occ::handle<Standard_Transient> Entity(const int n1 = 1, const int n2 = 1) const;
0181 
0182   Standard_EXPORT occ::handle<Standard_Transient> Transient() const;
0183 
0184 private:
0185   int                             thekind;
0186   int                             theint;
0187   double                          thereal;
0188   occ::handle<Standard_Transient> theany;
0189 };
0190 
0191 #endif // _StepData_Field_HeaderFile