Back to home page

EIC code displayed by LXR

 
 

    


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

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