Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 09:19:21

0001 // Created on: 1997-12-10
0002 // Created by: Denis PASCAL
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 _TDataStd_Variable_HeaderFile
0018 #define _TDataStd_Variable_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <TCollection_AsciiString.hxx>
0023 #include <TDF_Attribute.hxx>
0024 #include <Standard_Real.hxx>
0025 #include <TDataStd_RealEnum.hxx>
0026 #include <Standard_OStream.hxx>
0027 class Standard_GUID;
0028 class TDF_Label;
0029 class TCollection_ExtendedString;
0030 class TDataStd_Real;
0031 class TDataStd_Expression;
0032 class TDF_RelocationTable;
0033 class TDF_DataSet;
0034 
0035 //! Variable attribute.
0036 //! ==================
0037 //!
0038 //! * A variable is associated to a TDataStd_Real (which
0039 //! contains its current value) and a TDataStd_Name
0040 //! attribute (which contains its name). It contains a
0041 //! constant flag, and a Unit
0042 //!
0043 //! * An expression may be assigned to a variable. In
0044 //! thatcase the expression is handled by the associated
0045 //! Expression Attribute and the Variable returns True to
0046 //! the method <IsAssigned>.
0047 class TDataStd_Variable : public TDF_Attribute
0048 {
0049 
0050 public:
0051   //! class methods
0052   //! =============
0053   Standard_EXPORT static const Standard_GUID& GetID();
0054 
0055   //! Find, or create, a Variable attribute.
0056   //! Real methods
0057   //! ============
0058   Standard_EXPORT static occ::handle<TDataStd_Variable> Set(const TDF_Label& label);
0059 
0060   Standard_EXPORT TDataStd_Variable();
0061 
0062   //! set or change the name of the variable, in myUnknown
0063   //! and my associated Name attribute.
0064   Standard_EXPORT void Name(const TCollection_ExtendedString& string);
0065 
0066   //! returns string stored in the associated Name
0067   //! attribute.
0068   Standard_EXPORT const TCollection_ExtendedString& Name() const;
0069 
0070   //! retrieve or create the associated real attribute and
0071   //! set the value <value>.
0072   Standard_EXPORT void Set(const double value) const;
0073 
0074   //! Obsolete method that will be removed in next versions.
0075   //! The dimension argument is not supported in the persistence mechanism.
0076   Standard_DEPRECATED("TDataStd_Variable::Set(value, dimension) is deprecated. Please use "
0077                       "TDataStd_Variable::Set(value) instead.")
0078   Standard_EXPORT void Set(const double value, const TDataStd_RealEnum dimension) const;
0079 
0080   //! returns True if a Real attribute is associated.
0081   Standard_EXPORT bool IsValued() const;
0082 
0083   //! returns value stored in associated Real attribute.
0084   Standard_EXPORT double Get() const;
0085 
0086   //! returns associated Real attribute.
0087   Standard_EXPORT occ::handle<TDataStd_Real> Real() const;
0088 
0089   //! returns True if an Expression attribute is associated.
0090   //! create(if doesn't exist), set and returns the assigned
0091   //! expression attribute.
0092   Standard_EXPORT bool IsAssigned() const;
0093 
0094   //! create(if doesn't exist) and returns the assigned
0095   //! expression attribute. fill it after.
0096   Standard_EXPORT occ::handle<TDataStd_Expression> Assign() const;
0097 
0098   //! if <me> is assigned delete the associated expression
0099   //! attribute.
0100   Standard_EXPORT void Desassign() const;
0101 
0102   //! if <me> is assigned, returns associated Expression
0103   //! attribute.
0104   Standard_EXPORT occ::handle<TDataStd_Expression> Expression() const;
0105 
0106   //! shortcut for <Real()->IsCaptured()>
0107   Standard_EXPORT bool IsCaptured() const;
0108 
0109   //! A constant value is not modified by regeneration.
0110   Standard_EXPORT bool IsConstant() const;
0111 
0112   Standard_EXPORT void Unit(const TCollection_AsciiString& unit);
0113 
0114   //! to read/write fields
0115   //! ====================
0116   Standard_EXPORT const TCollection_AsciiString& Unit() const;
0117 
0118   //! if <status> is True, this variable will not be
0119   //! modified by the solver.
0120   Standard_EXPORT void Constant(const bool status);
0121 
0122   Standard_EXPORT const Standard_GUID& ID() const override;
0123 
0124   Standard_EXPORT void Restore(const occ::handle<TDF_Attribute>& With) override;
0125 
0126   Standard_EXPORT occ::handle<TDF_Attribute> NewEmpty() const override;
0127 
0128   Standard_EXPORT void Paste(const occ::handle<TDF_Attribute>&       Into,
0129                              const occ::handle<TDF_RelocationTable>& RT) const override;
0130 
0131   //! to export reference to the associated Name attribute.
0132   Standard_EXPORT void References(const occ::handle<TDF_DataSet>& DS) const override;
0133 
0134   Standard_EXPORT Standard_OStream& Dump(Standard_OStream& anOS) const override;
0135 
0136   //! Dumps the content of me into the stream
0137   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override;
0138 
0139   DEFINE_STANDARD_RTTIEXT(TDataStd_Variable, TDF_Attribute)
0140 
0141 private:
0142   bool                    isConstant;
0143   TCollection_AsciiString myUnit;
0144 };
0145 
0146 #endif // _TDataStd_Variable_HeaderFile