0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / Expr / Expr_UnaryExpression.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_UnaryExpression_HeaderFile
18 #define _Expr_UnaryExpression_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Expr_GeneralExpression.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Standard_Boolean.hxx>
26 class Expr_GeneralExpression;
27 class Standard_OutOfRange;
28 class Standard_NumericError;
29 class Expr_InvalidOperand;
30 class Expr_NamedUnknown;
31
32
33 class Expr_UnaryExpression;
34 DEFINE_STANDARD_HANDLE(Expr_UnaryExpression, Expr_GeneralExpression)
35
36
37 class Expr_UnaryExpression : public Expr_GeneralExpression
38 {
39
40 public:
41
42   
43   //! Returns the operand used
44     const Handle(Expr_GeneralExpression)& Operand() const;
45   
46   //! Sets the operand used
47   //! Raises InvalidOperand if <exp> contains <me>.
48   Standard_EXPORT void SetOperand (const Handle(Expr_GeneralExpression)& exp);
49   
50   //! Returns the number of sub-expressions contained
51   //! in <me> ( >= 0)
52   Standard_EXPORT Standard_Integer NbSubExpressions() const Standard_OVERRIDE;
53   
54   //! Returns the <I>-th sub-expression of <me>.
55   //! Raises OutOfRange if <I> > NbSubExpressions(me)
56   Standard_EXPORT const Handle(Expr_GeneralExpression)& SubExpression (const Standard_Integer I) const Standard_OVERRIDE;
57   
58   //! Does <me> contains NamedUnknown ?
59   Standard_EXPORT Standard_Boolean ContainsUnknowns() const Standard_OVERRIDE;
60   
61   //! Tests if <exp> is contained in <me>.
62   Standard_EXPORT Standard_Boolean Contains (const Handle(Expr_GeneralExpression)& exp) const Standard_OVERRIDE;
63   
64   //! Replaces all occurences of <var> with <with> in <me>
65   //! Raises InvalidOperand if <with> contains <me>.
66   Standard_EXPORT void Replace (const Handle(Expr_NamedUnknown)& var, const Handle(Expr_GeneralExpression)& with) Standard_OVERRIDE;
67   
68   //! Returns a GeneralExpression after replacement of
69   //! NamedUnknowns by an associated expression, and after
70   //! values computation.
71   Standard_EXPORT Handle(Expr_GeneralExpression) Simplified() const Standard_OVERRIDE;
72
73
74
75
76   DEFINE_STANDARD_RTTIEXT(Expr_UnaryExpression,Expr_GeneralExpression)
77
78 protected:
79
80   
81   //! Sets the operand used during creation
82   Standard_EXPORT void CreateOperand (const Handle(Expr_GeneralExpression)& exp);
83
84
85
86 private:
87
88
89   Handle(Expr_GeneralExpression) myOperand;
90
91
92 };
93
94
95 #include <Expr_UnaryExpression.lxx>
96
97
98
99
100
101 #endif // _Expr_UnaryExpression_HeaderFile