1 // Created on: 1991-04-12
2 // Created by: Arnaud BOUZY
3 // Copyright (c) 1991-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Expr_GeneralExpression.hxx>
19 #include <Expr_NamedConstant.hxx>
20 #include <Expr_NamedUnknown.hxx>
21 #include <Expr_NumericValue.hxx>
22 #include <Standard_OutOfRange.hxx>
23 #include <Standard_Type.hxx>
24 #include <TCollection_AsciiString.hxx>
26 IMPLEMENT_STANDARD_RTTIEXT(Expr_NamedConstant,Expr_NamedExpression)
28 Expr_NamedConstant::Expr_NamedConstant(const TCollection_AsciiString& name, const Standard_Real value)
34 const Handle(Expr_GeneralExpression)& Expr_NamedConstant::SubExpression (const Standard_Integer ) const
36 throw Standard_OutOfRange();
39 Handle(Expr_GeneralExpression) Expr_NamedConstant::Simplified () const
41 Handle(Expr_GeneralExpression) res = new Expr_NumericValue(myValue);
45 Handle(Expr_GeneralExpression) Expr_NamedConstant::Copy () const
47 return new Expr_NamedConstant(GetName(),myValue);
50 Handle(Expr_GeneralExpression) Expr_NamedConstant::Derivative (const Handle(Expr_NamedUnknown)& ) const
52 Handle(Expr_GeneralExpression) aNumVal = new Expr_NumericValue(0.0);
56 Handle(Expr_GeneralExpression) Expr_NamedConstant::NDerivative (const Handle(Expr_NamedUnknown)& , const Standard_Integer ) const
58 return new Expr_NumericValue(0.0);
61 Handle(Expr_GeneralExpression) Expr_NamedConstant::ShallowSimplified () const
63 Handle(Expr_GeneralExpression) res = new Expr_NumericValue(myValue);
67 Standard_Real Expr_NamedConstant::Evaluate(const Expr_Array1OfNamedUnknown&, const TColStd_Array1OfReal&) const
72 Standard_Integer Expr_NamedConstant::NbSubExpressions () const
77 Standard_Boolean Expr_NamedConstant::ContainsUnknowns () const
79 return Standard_False;
82 Standard_Boolean Expr_NamedConstant::Contains (const Handle(Expr_GeneralExpression)& ) const
84 return Standard_False;
87 Standard_Boolean Expr_NamedConstant::IsLinear () const
92 void Expr_NamedConstant::Replace (const Handle(Expr_NamedUnknown)& , const Handle(Expr_GeneralExpression)& )