0028832: MMgt_TShared can be replaced by Standard_Transient
[occt.git] / src / Expr / Expr_GeneralFunction.hxx
1 // Created on: 1991-01-14
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_GeneralFunction_HeaderFile
18 #define _Expr_GeneralFunction_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_Transient.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Standard_Real.hxx>
26 #include <Expr_Array1OfNamedUnknown.hxx>
27 #include <TColStd_Array1OfReal.hxx>
28 #include <Standard_Boolean.hxx>
29 class Standard_OutOfRange;
30 class Standard_DimensionMismatch;
31 class Standard_NumericError;
32 class Expr_NotEvaluable;
33 class Expr_NamedUnknown;
34 class TCollection_AsciiString;
35
36
37 class Expr_GeneralFunction;
38 DEFINE_STANDARD_HANDLE(Expr_GeneralFunction, Standard_Transient)
39
40 //! Defines the general purposes of any function.
41 class Expr_GeneralFunction : public Standard_Transient
42 {
43
44 public:
45
46   
47   //! Returns the number of variables of <me>.
48   Standard_EXPORT virtual Standard_Integer NbOfVariables() const = 0;
49   
50   //! Returns the variable denoted by <index> in <me>.
51   //! Raises OutOfRange if index > NbOfVariables.
52   Standard_EXPORT virtual Handle(Expr_NamedUnknown) Variable (const Standard_Integer index) const = 0;
53   
54   //! Returns a copy of <me> with the same form.
55   Standard_EXPORT virtual Handle(Expr_GeneralFunction) Copy() const = 0;
56   
57   //! Returns Derivative of <me> for variable <var>.
58   Standard_EXPORT virtual Handle(Expr_GeneralFunction) Derivative (const Handle(Expr_NamedUnknown)& var) const = 0;
59   
60   //! Returns Derivative of <me> for variable <var> with
61   //! degree <deg>.
62   Standard_EXPORT virtual Handle(Expr_GeneralFunction) Derivative (const Handle(Expr_NamedUnknown)& var, const Standard_Integer deg) const = 0;
63   
64   //! Computes the value of <me> with the given variables.
65   //! Raises NotEvaluable if <vars> does not match all variables
66   //! of <me>.
67   Standard_EXPORT virtual Standard_Real Evaluate (const Expr_Array1OfNamedUnknown& vars, const TColStd_Array1OfReal& vals) const = 0;
68   
69   //! Tests if <me> and <func> are similar functions (same
70   //! name and same used expression).
71   Standard_EXPORT virtual Standard_Boolean IsIdentical (const Handle(Expr_GeneralFunction)& func) const = 0;
72   
73   //! Tests if <me> is linear on variable on range <index>
74   Standard_EXPORT virtual Standard_Boolean IsLinearOnVariable (const Standard_Integer index) const = 0;
75   
76   Standard_EXPORT virtual TCollection_AsciiString GetStringName() const = 0;
77
78
79
80
81   DEFINE_STANDARD_RTTIEXT(Expr_GeneralFunction,Standard_Transient)
82
83 protected:
84
85
86
87
88 private:
89
90
91
92
93 };
94
95
96
97
98
99
100
101 #endif // _Expr_GeneralFunction_HeaderFile