Back to home page

EIC code displayed by LXR

 
 

    


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

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