42cf5bc1 |
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_PolyExpression_HeaderFile |
18 | #define _Expr_PolyExpression_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Expr_SequenceOfGeneralExpression.hxx> |
24 | #include <Expr_GeneralExpression.hxx> |
25 | #include <Standard_Integer.hxx> |
26 | #include <Standard_Boolean.hxx> |
27 | class Standard_OutOfRange; |
28 | class Standard_NumericError; |
29 | class Expr_InvalidOperand; |
30 | class Expr_GeneralExpression; |
31 | class Expr_NamedUnknown; |
32 | |
33 | |
34 | class Expr_PolyExpression; |
35 | DEFINE_STANDARD_HANDLE(Expr_PolyExpression, Expr_GeneralExpression) |
36 | |
37 | |
38 | class Expr_PolyExpression : public Expr_GeneralExpression |
39 | { |
40 | |
41 | public: |
42 | |
43 | |
44 | //! returns the number of operands contained in <me> |
45 | Standard_EXPORT Standard_Integer NbOperands() const; |
46 | |
47 | //! Returns the <index>-th operand used in <me>. |
48 | //! An exception is raised if index is out of range |
49 | const Handle(Expr_GeneralExpression)& Operand (const Standard_Integer index) const; |
50 | |
51 | //! Sets the <index>-th operand used in <me>. |
52 | //! An exception is raised if <index> is out of range |
53 | //! Raises InvalidOperand if <exp> contains <me>. |
54 | Standard_EXPORT void SetOperand (const Handle(Expr_GeneralExpression)& exp, const Standard_Integer index); |
55 | |
56 | //! returns the number of sub-expressions contained |
57 | //! in <me> ( >= 2) |
79104795 |
58 | Standard_EXPORT Standard_Integer NbSubExpressions() const Standard_OVERRIDE; |
42cf5bc1 |
59 | |
60 | //! Returns the sub-expression denoted by <I> in <me> |
61 | //! Raises OutOfRange if <I> > NbSubExpressions(me) |
79104795 |
62 | Standard_EXPORT const Handle(Expr_GeneralExpression)& SubExpression (const Standard_Integer I) const Standard_OVERRIDE; |
42cf5bc1 |
63 | |
64 | //! Does <me> contains NamedUnknown ? |
79104795 |
65 | Standard_EXPORT Standard_Boolean ContainsUnknowns() const Standard_OVERRIDE; |
42cf5bc1 |
66 | |
67 | //! Tests if <exp> is contained in <me>. |
79104795 |
68 | Standard_EXPORT Standard_Boolean Contains (const Handle(Expr_GeneralExpression)& exp) const Standard_OVERRIDE; |
42cf5bc1 |
69 | |
70 | //! Replaces all occurences of <var> with <with> in <me> |
71 | //! Raises InvalidOperand if <with> contains <me>. |
79104795 |
72 | Standard_EXPORT void Replace (const Handle(Expr_NamedUnknown)& var, const Handle(Expr_GeneralExpression)& with) Standard_OVERRIDE; |
42cf5bc1 |
73 | |
74 | //! Returns a GeneralExpression after replacement of |
75 | //! NamedUnknowns by an associated expression and after |
76 | //! values computation. |
79104795 |
77 | Standard_EXPORT Handle(Expr_GeneralExpression) Simplified() const Standard_OVERRIDE; |
42cf5bc1 |
78 | |
79 | |
80 | |
81 | |
92efcf78 |
82 | DEFINE_STANDARD_RTTIEXT(Expr_PolyExpression,Expr_GeneralExpression) |
42cf5bc1 |
83 | |
84 | protected: |
85 | |
86 | |
87 | //! initialize an empty list of operands. |
88 | Standard_EXPORT Expr_PolyExpression(); |
89 | |
90 | //! Adds an operand to the list of <me>. |
91 | Standard_EXPORT void AddOperand (const Handle(Expr_GeneralExpression)& exp); |
92 | |
93 | //! Remove the operand denoted by <index> from the list of |
94 | //! <me>. |
95 | //! Raises exception if <index> is out of range or if |
96 | //! removing operand intend to leave only one or no |
97 | //! operand. |
98 | Standard_EXPORT void RemoveOperand (const Standard_Integer index); |
99 | |
100 | |
101 | |
102 | private: |
103 | |
104 | |
105 | Expr_SequenceOfGeneralExpression myOperands; |
106 | |
107 | |
108 | }; |
109 | |
110 | |
111 | #include <Expr_PolyExpression.lxx> |
112 | |
113 | |
114 | |
115 | |
116 | |
117 | #endif // _Expr_PolyExpression_HeaderFile |