Integration of OCCT 6.5.0 from SVN
[occt.git] / src / Expr / Expr_NumericValue.cxx
CommitLineData
7fd59977 1//static const char* sccsid = "@(#)Expr_NumericValue.cxx 3.3 95/01/10"; // Do not delete this line. Used by sccs.
2// Copyright: Matra-Datavision 1991
3// File: Expr_NumericValue.cxx
4// Created: Wed Mar 6 11:06:16 1991
5// Author: Arnaud BOUZY
6// <adn>
7
8
9#include <Expr_NumericValue.ixx>
10#include <Standard_OutOfRange.hxx>
11
12//#if defined (WNT) || !defined (DEB)
13# include <stdio.h>
14//#endif // WNT || !DEB
15
16Expr_NumericValue::Expr_NumericValue(const Standard_Real val)
17{
18 myValue = val;
19}
20
21Standard_Real Expr_NumericValue::GetValue() const
22{
23 return myValue;
24}
25
26void Expr_NumericValue::SetValue(const Standard_Real val)
27{
28 myValue = val;
29}
30
31Standard_Integer Expr_NumericValue::NbSubExpressions() const
32{
33 return 0;
34}
35
36const Handle(Expr_GeneralExpression)& Expr_NumericValue::SubExpression(const Standard_Integer) const
37{
38 Standard_OutOfRange::Raise();
39 Handle(Expr_GeneralExpression)* bid=NULL;
40 return *bid;
41}
42
43Handle(Expr_GeneralExpression) Expr_NumericValue::Simplified() const
44{
45 return Copy();
46}
47
48Handle(Expr_GeneralExpression) Expr_NumericValue::Copy() const
49{
50 return new Expr_NumericValue(myValue);
51}
52
53Standard_Boolean Expr_NumericValue::ContainsUnknowns () const
54{
55 return Standard_False;
56}
57
58Standard_Boolean Expr_NumericValue::Contains (const Handle(Expr_GeneralExpression)& ) const
59{
60 return Standard_False;
61}
62
63Standard_Boolean Expr_NumericValue::IsIdentical (const Handle(Expr_GeneralExpression)& Other) const
64{
65 if (!Other->IsKind(STANDARD_TYPE(Expr_NumericValue))) {
66 return Standard_False;
67 }
68 Handle(Expr_NumericValue) NVOther = Handle(Expr_NumericValue)::DownCast(Other);
69 return (myValue == NVOther->GetValue());
70}
71
72Standard_Boolean Expr_NumericValue::IsLinear () const
73{
74 return Standard_True;
75}
76
77Handle(Expr_GeneralExpression) Expr_NumericValue::Derivative (const Handle(Expr_NamedUnknown)& ) const
78{
79 return new Expr_NumericValue(0.0);
80}
81
82Handle(Expr_GeneralExpression) Expr_NumericValue::NDerivative (const Handle(Expr_NamedUnknown)& , const Standard_Integer) const
83{
84 return new Expr_NumericValue(0.0);
85}
86
87void Expr_NumericValue::Replace (const Handle(Expr_NamedUnknown)& , const Handle(Expr_GeneralExpression)& )
88{
89}
90
91Handle(Expr_GeneralExpression) Expr_NumericValue::ShallowSimplified () const
92{
93 Handle(Expr_NumericValue) me = this;
94 return me;
95}
96
97Standard_Real Expr_NumericValue::Evaluate(const Expr_Array1OfNamedUnknown&, const TColStd_Array1OfReal&) const
98{
99 return myValue;
100}
101
102TCollection_AsciiString Expr_NumericValue::String() const
103{
104 char val[100];
105 sprintf(val,"%g",myValue);
106 return TCollection_AsciiString(val);
107}