Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-26 09:02:59

0001 // Created on: 1991-01-10
0002 // Created by: Arnaud BOUZY
0003 // Copyright (c) 1991-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 _Expr_NamedConstant_HeaderFile
0018 #define _Expr_NamedConstant_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Expr_NamedExpression.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <NCollection_Array1.hxx>
0026 class TCollection_AsciiString;
0027 class Expr_GeneralExpression;
0028 class Expr_NamedUnknown;
0029 
0030 //! Describes any numeric constant known by a special name
0031 //! (as PI, e,...).
0032 class Expr_NamedConstant : public Expr_NamedExpression
0033 {
0034 
0035 public:
0036   //! Creates a constant value of name <name> and value <value>.
0037   Standard_EXPORT Expr_NamedConstant(const TCollection_AsciiString& name, const double value);
0038 
0039   double GetValue() const;
0040 
0041   //! returns the number of sub-expressions contained
0042   //! in <me> (always returns zero)
0043   Standard_EXPORT int NbSubExpressions() const override;
0044 
0045   //! returns the <I>-th sub-expression of <me>
0046   //! raises OutOfRange
0047   Standard_EXPORT const occ::handle<Expr_GeneralExpression>& SubExpression(
0048     const int I) const override;
0049 
0050   //! returns a GeneralExpression after replacement of
0051   //! NamedUnknowns by an associated expression and after
0052   //! values computation.
0053   Standard_EXPORT occ::handle<Expr_GeneralExpression> Simplified() const override;
0054 
0055   //! Returns a GeneralExpression after a simplification
0056   //! of the arguments of <me>.
0057   Standard_EXPORT occ::handle<Expr_GeneralExpression> ShallowSimplified() const override;
0058 
0059   //! Returns a copy of <me> having the same unknowns and functions.
0060   Standard_EXPORT occ::handle<Expr_GeneralExpression> Copy() const override;
0061 
0062   //! Tests if <me> contains NamedUnknown.
0063   //! (returns always False)
0064   Standard_EXPORT bool ContainsUnknowns() const override;
0065 
0066   //! Tests if <exp> is contained in <me>.
0067   Standard_EXPORT bool Contains(const occ::handle<Expr_GeneralExpression>& exp) const override;
0068 
0069   Standard_EXPORT bool IsLinear() const override;
0070 
0071   //! Returns the derivative on <X> unknown of <me>
0072   Standard_EXPORT occ::handle<Expr_GeneralExpression> Derivative(
0073     const occ::handle<Expr_NamedUnknown>& X) const override;
0074 
0075   //! Returns the <N>-th derivative on <X> unknown of <me>.
0076   //! Raises OutOfRange if <N> <= 0
0077   Standard_EXPORT occ::handle<Expr_GeneralExpression> NDerivative(
0078     const occ::handle<Expr_NamedUnknown>& X,
0079     const int                             N) const override;
0080 
0081   //! Replaces all occurrences of <var> with <with> in <me>
0082   Standard_EXPORT void Replace(const occ::handle<Expr_NamedUnknown>&      var,
0083                                const occ::handle<Expr_GeneralExpression>& with) override;
0084 
0085   //! Returns the value of <me> (as a Real) by
0086   //! replacement of <vars> by <vals>.
0087   Standard_EXPORT double Evaluate(const NCollection_Array1<occ::handle<Expr_NamedUnknown>>& vars,
0088                                   const NCollection_Array1<double>& vals) const override;
0089 
0090   DEFINE_STANDARD_RTTIEXT(Expr_NamedConstant, Expr_NamedExpression)
0091 
0092 private:
0093   double myValue;
0094 };
0095 
0096 #include <Expr_NamedConstant.lxx>
0097 
0098 #endif // _Expr_NamedConstant_HeaderFile