Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:57:42

0001 // Created on: 1991-01-10
0002 // Created by: Arnaud BOUZY
0003 // Copyright (c) 1991-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Expr_BinaryExpression_HeaderFile
0018 #define _Expr_BinaryExpression_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Expr_GeneralExpression.hxx>
0024 #include <Standard_Integer.hxx>
0025 class Expr_NamedUnknown;
0026 
0027 //! Defines all binary expressions. The order of the two
0028 //! operands is significant.
0029 class Expr_BinaryExpression : public Expr_GeneralExpression
0030 {
0031 
0032 public:
0033   const occ::handle<Expr_GeneralExpression>& FirstOperand() const;
0034 
0035   const occ::handle<Expr_GeneralExpression>& SecondOperand() const;
0036 
0037   //! Sets first operand of <me>
0038   //! Raises InvalidOperand if exp = me
0039   Standard_EXPORT void SetFirstOperand(const occ::handle<Expr_GeneralExpression>& exp);
0040 
0041   //! Sets second operand of <me>
0042   //! Raises InvalidOperand if <exp> contains <me>.
0043   Standard_EXPORT void SetSecondOperand(const occ::handle<Expr_GeneralExpression>& exp);
0044 
0045   //! returns the number of sub-expressions contained
0046   //! in <me> ( >= 0)
0047   Standard_EXPORT int NbSubExpressions() const override;
0048 
0049   //! returns the <I>-th sub-expression of <me>
0050   //! raises OutOfRange if <I> > NbSubExpressions(me)
0051   Standard_EXPORT const occ::handle<Expr_GeneralExpression>& SubExpression(
0052     const int I) const override;
0053 
0054   //! Does <me> contain NamedUnknown ?
0055   Standard_EXPORT bool ContainsUnknowns() const override;
0056 
0057   //! Tests if <me> contains <exp>.
0058   Standard_EXPORT bool Contains(const occ::handle<Expr_GeneralExpression>& exp) const override;
0059 
0060   //! Replaces all occurrences of <var> with <with> in <me>.
0061   //! Raises InvalidOperand if <with> contains <me>.
0062   Standard_EXPORT void Replace(const occ::handle<Expr_NamedUnknown>&      var,
0063                                const occ::handle<Expr_GeneralExpression>& with) override;
0064 
0065   //! Returns a GeneralExpression after replacement of
0066   //! NamedUnknowns by an associated expression and after
0067   //! values computation.
0068   Standard_EXPORT occ::handle<Expr_GeneralExpression> Simplified() const override;
0069 
0070   DEFINE_STANDARD_RTTIEXT(Expr_BinaryExpression, Expr_GeneralExpression)
0071 
0072 protected:
0073   //! Sets first operand of <me>
0074   Standard_EXPORT void CreateFirstOperand(const occ::handle<Expr_GeneralExpression>& exp);
0075 
0076   //! Sets second operand of <me>
0077   //! Raises InvalidOperand if <exp> contains <me>.
0078   Standard_EXPORT void CreateSecondOperand(const occ::handle<Expr_GeneralExpression>& exp);
0079 
0080 private:
0081   occ::handle<Expr_GeneralExpression> myFirstOperand;
0082   occ::handle<Expr_GeneralExpression> mySecondOperand;
0083 };
0084 
0085 #include <Expr_BinaryExpression.lxx>
0086 
0087 #endif // _Expr_BinaryExpression_HeaderFile