1 // Created on: 1991-03-06
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_NamedUnknown.hxx>
20 #include <Expr_NumericValue.hxx>
21 #include <Standard_OutOfRange.hxx>
22 #include <Standard_Type.hxx>
23 #include <TCollection_AsciiString.hxx>
26 IMPLEMENT_STANDARD_RTTIEXT(Expr_NumericValue,Expr_GeneralExpression)
28 Expr_NumericValue::Expr_NumericValue(const Standard_Real val)
33 Standard_Real Expr_NumericValue::GetValue() const
38 void Expr_NumericValue::SetValue(const Standard_Real val)
43 Standard_Integer Expr_NumericValue::NbSubExpressions() const
48 const Handle(Expr_GeneralExpression)& Expr_NumericValue::SubExpression(const Standard_Integer) const
50 throw Standard_OutOfRange();
53 Handle(Expr_GeneralExpression) Expr_NumericValue::Simplified() const
58 Handle(Expr_GeneralExpression) Expr_NumericValue::Copy() const
60 return new Expr_NumericValue(myValue);
63 Standard_Boolean Expr_NumericValue::ContainsUnknowns () const
65 return Standard_False;
68 Standard_Boolean Expr_NumericValue::Contains (const Handle(Expr_GeneralExpression)& ) const
70 return Standard_False;
73 Standard_Boolean Expr_NumericValue::IsIdentical (const Handle(Expr_GeneralExpression)& Other) const
75 if (!Other->IsKind(STANDARD_TYPE(Expr_NumericValue))) {
76 return Standard_False;
78 Handle(Expr_NumericValue) NVOther = Handle(Expr_NumericValue)::DownCast(Other);
79 return (myValue == NVOther->GetValue());
82 Standard_Boolean Expr_NumericValue::IsLinear () const
87 Handle(Expr_GeneralExpression) Expr_NumericValue::Derivative (const Handle(Expr_NamedUnknown)& ) const
89 return new Expr_NumericValue(0.0);
92 Handle(Expr_GeneralExpression) Expr_NumericValue::NDerivative (const Handle(Expr_NamedUnknown)& , const Standard_Integer) const
94 return new Expr_NumericValue(0.0);
97 void Expr_NumericValue::Replace (const Handle(Expr_NamedUnknown)& , const Handle(Expr_GeneralExpression)& )
101 Handle(Expr_GeneralExpression) Expr_NumericValue::ShallowSimplified () const
103 Handle(Expr_NumericValue) me = this;
107 Standard_Real Expr_NumericValue::Evaluate(const Expr_Array1OfNamedUnknown&, const TColStd_Array1OfReal&) const
112 TCollection_AsciiString Expr_NumericValue::String() const
115 Sprintf(val,"%g",myValue);
116 return TCollection_AsciiString(val);