0031939: Coding - correction of spelling errors in comments [part 6]
[occt.git] / src / Expr / Expr_NamedUnknown.hxx
1 // Created on: 1991-01-10
2 // Created by: Arnaud BOUZY
3 // Copyright (c) 1991-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Expr_NamedUnknown_HeaderFile
18 #define _Expr_NamedUnknown_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Expr_NamedExpression.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Standard_Real.hxx>
27 #include <Expr_Array1OfNamedUnknown.hxx>
28 #include <TColStd_Array1OfReal.hxx>
29 class Expr_GeneralExpression;
30 class Expr_NotAssigned;
31 class Standard_OutOfRange;
32 class Standard_NumericError;
33 class Expr_InvalidAssignment;
34 class Expr_InvalidOperand;
35 class Expr_NotEvaluable;
36 class TCollection_AsciiString;
37
38
39 class Expr_NamedUnknown;
40 DEFINE_STANDARD_HANDLE(Expr_NamedUnknown, Expr_NamedExpression)
41
42 //! This class describes any variable of an expression.
43 //! Assignment is treated directly in this class.
44 class Expr_NamedUnknown : public Expr_NamedExpression
45 {
46
47 public:
48
49   
50   Standard_EXPORT Expr_NamedUnknown(const TCollection_AsciiString& name);
51   
52   //! Tests if an expression is assigned to <me>.
53     Standard_Boolean IsAssigned() const;
54   
55   //! If exists, returns the assigned expression.
56   //! An exception is raised if the expression does not exist.
57   Standard_EXPORT const Handle(Expr_GeneralExpression)& AssignedExpression() const;
58   
59   //! Assigns <me> to <exp> expression.
60   //! Raises exception if <exp> refers to <me>.
61   Standard_EXPORT void Assign (const Handle(Expr_GeneralExpression)& exp);
62   
63   //! Suppresses the assigned expression
64     void Deassign();
65   
66   //! Returns the number of sub-expressions contained
67   //! in <me> ( >= 0)
68   Standard_EXPORT Standard_Integer NbSubExpressions() const Standard_OVERRIDE;
69   
70   //! Returns the <I>-th sub-expression of <me>
71   //! raises OutOfRange if <I> > NbSubExpressions(me)
72   Standard_EXPORT const Handle(Expr_GeneralExpression)& SubExpression (const Standard_Integer I) const Standard_OVERRIDE;
73   
74   //! Returns a GeneralExpression after replacement of
75   //! NamedUnknowns by an associated expression and after
76   //! values computation.
77   Standard_EXPORT Handle(Expr_GeneralExpression) Simplified() const Standard_OVERRIDE;
78   
79   //! Returns a GeneralExpression after a simplification
80   //! of the arguments of <me>.
81   Standard_EXPORT Handle(Expr_GeneralExpression) ShallowSimplified() const Standard_OVERRIDE;
82   
83   //! Returns a copy of <me> having the same unknowns and functions.
84   Standard_EXPORT Handle(Expr_GeneralExpression) Copy() const Standard_OVERRIDE;
85   
86   //! Tests if <me> contains NamedUnknown.
87   Standard_EXPORT Standard_Boolean ContainsUnknowns() const Standard_OVERRIDE;
88   
89   //! Tests if <exp> is contained in <me>.
90   Standard_EXPORT Standard_Boolean Contains (const Handle(Expr_GeneralExpression)& exp) const Standard_OVERRIDE;
91   
92   Standard_EXPORT Standard_Boolean IsLinear() const Standard_OVERRIDE;
93   
94   //! Returns the derivative on <X> unknown of <me>
95   Standard_EXPORT Handle(Expr_GeneralExpression) Derivative (const Handle(Expr_NamedUnknown)& X) const Standard_OVERRIDE;
96   
97   //! Replaces all occurrences of <var> with <with> in <me>
98   //! Raises InvalidOperand if <with> contains <me>.
99   Standard_EXPORT void Replace (const Handle(Expr_NamedUnknown)& var, const Handle(Expr_GeneralExpression)& with) Standard_OVERRIDE;
100   
101   //! Returns the value of <me> (as a Real) by
102   //! replacement of <vars> by <vals>.
103   //! Raises NotEvaluable if <me> contains NamedUnknown not
104   //! in <vars> or NumericError if result cannot be computed.
105   Standard_EXPORT Standard_Real Evaluate (const Expr_Array1OfNamedUnknown& vars, const TColStd_Array1OfReal& vals) const Standard_OVERRIDE;
106
107
108
109
110   DEFINE_STANDARD_RTTIEXT(Expr_NamedUnknown,Expr_NamedExpression)
111
112 protected:
113
114
115
116
117 private:
118
119
120   Handle(Expr_GeneralExpression) myExpression;
121
122
123 };
124
125
126 #include <Expr_NamedUnknown.lxx>
127
128
129
130
131
132 #endif // _Expr_NamedUnknown_HeaderFile