Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-25 09:19:34

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_PolyExpression_HeaderFile
0018 #define _Expr_PolyExpression_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Expr_GeneralExpression.hxx>
0024 #include <NCollection_Sequence.hxx>
0025 #include <Standard_Integer.hxx>
0026 class Expr_NamedUnknown;
0027 
0028 class Expr_PolyExpression : public Expr_GeneralExpression
0029 {
0030 
0031 public:
0032   //! returns the number of operands contained in <me>
0033   Standard_EXPORT int NbOperands() const;
0034 
0035   //! Returns the <index>-th operand used in <me>.
0036   //! An exception is raised if index is out of range
0037   const occ::handle<Expr_GeneralExpression>& Operand(const int index) const;
0038 
0039   //! Sets the <index>-th operand used in <me>.
0040   //! An exception is raised if <index> is out of range
0041   //! Raises InvalidOperand if <exp> contains <me>.
0042   Standard_EXPORT void SetOperand(const occ::handle<Expr_GeneralExpression>& exp, const int index);
0043 
0044   //! returns the number of sub-expressions contained
0045   //! in <me> ( >= 2)
0046   Standard_EXPORT int NbSubExpressions() const override;
0047 
0048   //! Returns the sub-expression denoted by <I> in <me>
0049   //! Raises OutOfRange if <I> > NbSubExpressions(me)
0050   Standard_EXPORT const occ::handle<Expr_GeneralExpression>& SubExpression(
0051     const int I) const override;
0052 
0053   //! Does <me> contains NamedUnknown ?
0054   Standard_EXPORT bool ContainsUnknowns() const override;
0055 
0056   //! Tests if <exp> is contained in <me>.
0057   Standard_EXPORT bool Contains(const occ::handle<Expr_GeneralExpression>& exp) const override;
0058 
0059   //! Replaces all occurrences of <var> with <with> in <me>
0060   //! Raises InvalidOperand if <with> contains <me>.
0061   Standard_EXPORT void Replace(const occ::handle<Expr_NamedUnknown>&      var,
0062                                const occ::handle<Expr_GeneralExpression>& with) override;
0063 
0064   //! Returns a GeneralExpression after replacement of
0065   //! NamedUnknowns by an associated expression and after
0066   //! values computation.
0067   Standard_EXPORT occ::handle<Expr_GeneralExpression> Simplified() const override;
0068 
0069   DEFINE_STANDARD_RTTIEXT(Expr_PolyExpression, Expr_GeneralExpression)
0070 
0071 protected:
0072   //! initialize an empty list of operands.
0073   Standard_EXPORT Expr_PolyExpression();
0074 
0075   //! Adds an operand to the list of <me>.
0076   Standard_EXPORT void AddOperand(const occ::handle<Expr_GeneralExpression>& exp);
0077 
0078   //! Remove the operand denoted by <index> from the list of
0079   //! <me>.
0080   //! Raises exception if <index> is out of range or if
0081   //! removing operand intend to leave only one or no
0082   //! operand.
0083   Standard_EXPORT void RemoveOperand(const int index);
0084 
0085 private:
0086   NCollection_Sequence<occ::handle<Expr_GeneralExpression>> myOperands;
0087 };
0088 
0089 #include <Expr_PolyExpression.lxx>
0090 
0091 #endif // _Expr_PolyExpression_HeaderFile