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
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.
17 #ifndef _Expr_BinaryExpression_HeaderFile
18 #define _Expr_BinaryExpression_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
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;
33 class Expr_BinaryExpression;
34 DEFINE_STANDARD_HANDLE(Expr_BinaryExpression, Expr_GeneralExpression)
36 //! Defines all binary expressions. The order of the two
37 //! operands is significant.
38 class Expr_BinaryExpression : public Expr_GeneralExpression
44 const Handle(Expr_GeneralExpression)& FirstOperand() const;
46 const Handle(Expr_GeneralExpression)& SecondOperand() const;
48 //! Sets first operand of <me>
49 //! Raises InvalidOperand if exp = me
50 Standard_EXPORT void SetFirstOperand (const Handle(Expr_GeneralExpression)& exp);
52 //! Sets second operand of <me>
53 //! Raises InvalidOperand if <exp> contains <me>.
54 Standard_EXPORT void SetSecondOperand (const Handle(Expr_GeneralExpression)& exp);
56 //! returns the number of sub-expressions contained
58 Standard_EXPORT Standard_Integer NbSubExpressions() const Standard_OVERRIDE;
60 //! returns the <I>-th sub-expression of <me>
61 //! raises OutOfRange if <I> > NbSubExpressions(me)
62 Standard_EXPORT const Handle(Expr_GeneralExpression)& SubExpression (const Standard_Integer I) const Standard_OVERRIDE;
64 //! Does <me> contain NamedUnknown ?
65 Standard_EXPORT Standard_Boolean ContainsUnknowns() const Standard_OVERRIDE;
67 //! Tests if <me> contains <exp>.
68 Standard_EXPORT Standard_Boolean Contains (const Handle(Expr_GeneralExpression)& exp) const Standard_OVERRIDE;
70 //! Replaces all occurrences of <var> with <with> in <me>.
71 //! Raises InvalidOperand if <with> contains <me>.
72 Standard_EXPORT void Replace (const Handle(Expr_NamedUnknown)& var, const Handle(Expr_GeneralExpression)& with) Standard_OVERRIDE;
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;
82 DEFINE_STANDARD_RTTIEXT(Expr_BinaryExpression,Expr_GeneralExpression)
87 //! Sets first operand of <me>
88 Standard_EXPORT void CreateFirstOperand (const Handle(Expr_GeneralExpression)& exp);
90 //! Sets second operand of <me>
91 //! Raises InvalidOperand if <exp> contains <me>.
92 Standard_EXPORT void CreateSecondOperand (const Handle(Expr_GeneralExpression)& exp);
99 Handle(Expr_GeneralExpression) myFirstOperand;
100 Handle(Expr_GeneralExpression) mySecondOperand;
106 #include <Expr_BinaryExpression.lxx>
112 #endif // _Expr_BinaryExpression_HeaderFile