1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SALOME_EvalSet.hxx
23 // Author : Peter KURNEV
27 #ifndef SALOME_EvalSet_Header_File
28 #define SALOME_EvalSet_Header_File
31 #include <SALOME_Eval.hxx>
32 #include <SALOME_EvalVariant.hxx>
35 #pragma warning(disable : 4786)
39 typedef std::list<SALOME_EvalSet*> SALOME_ListOfEvalSet;
41 //=======================================================================
42 //class : SALOME_EvalSet
44 //=======================================================================
49 virtual ~SALOME_EvalSet();
51 virtual SALOME_String name() const = 0;
52 virtual void operationList( SALOME_StringList& ) const = 0;
53 virtual void bracketsList( SALOME_StringList&, bool open ) const = 0;
54 virtual bool createValue( const SALOME_String&, SALOME_EvalVariant& ) const;
55 virtual int priority( const SALOME_String&, bool isBin ) const = 0;
56 virtual SALOME_EvalExprError isValid(const SALOME_String&, const SALOME_EvalVariantType, const SALOME_EvalVariantType) const = 0;
57 virtual SALOME_EvalExprError calculate(const SALOME_String&, SALOME_EvalVariant&, SALOME_EvalVariant&) const = 0;
59 static bool contains( const SALOME_ListOfEvalSet&, const SALOME_EvalSet* );
60 static void insert( SALOME_ListOfEvalSet& aL, const int aIndex, SALOME_EvalSet* pS );
63 //=======================================================================
64 //class : SALOME_EvalSetBase
66 //=======================================================================
67 class SALOME_EvalSetBase : public SALOME_EvalSet
71 virtual ~SALOME_EvalSetBase();
73 virtual void operationList( SALOME_StringList& ) const;
74 virtual void bracketsList ( SALOME_StringList&, bool open ) const;
76 virtual SALOME_EvalExprError isValid( const SALOME_String&, const SALOME_EvalVariantType a, const SALOME_EvalVariantType b) const;
79 void addTypes( const SALOME_ListOfEvalVariantType& );
80 void addOperations( const SALOME_StringList& );
83 SALOME_StringList myOpers;
84 SALOME_ListOfEvalVariantType myTypes;
87 //=======================================================================
88 //class : SALOME_EvalSetArithmetic
90 //=======================================================================
91 class SALOME_EvalSetArithmetic : public SALOME_EvalSetBase
94 SALOME_EvalSetArithmetic();
95 virtual ~SALOME_EvalSetArithmetic();
97 virtual bool createValue( const SALOME_String&, SALOME_EvalVariant& ) const;
98 virtual int priority( const SALOME_String&, bool isBin ) const;
99 virtual SALOME_EvalExprError calculate(const SALOME_String&, SALOME_EvalVariant&, SALOME_EvalVariant& ) const;
101 static SALOME_String Name();
102 virtual SALOME_String name() const;
105 //=======================================================================
106 //class : SALOME_EvalSetLogic
108 //=======================================================================
109 class SALOME_EvalSetLogic : public SALOME_EvalSetBase
112 SALOME_EvalSetLogic();
114 virtual ~SALOME_EvalSetLogic();
116 virtual bool createValue( const SALOME_String&, SALOME_EvalVariant& ) const;
117 virtual int priority( const SALOME_String&, bool isBin ) const;
118 virtual SALOME_EvalExprError calculate( const SALOME_String&, SALOME_EvalVariant&, SALOME_EvalVariant& ) const;
120 static SALOME_String Name();
121 virtual SALOME_String name() const;
124 int intValue(const SALOME_EvalVariant& ) const;
127 //=======================================================================
128 //class : SALOME_EvalSetMath
130 //=======================================================================
131 class SALOME_EvalSetMath : public SALOME_EvalSetBase
134 SALOME_EvalSetMath();
135 virtual ~SALOME_EvalSetMath();
137 virtual bool createValue( const SALOME_String&, SALOME_EvalVariant& ) const;
138 virtual int priority( const SALOME_String&, bool isBin ) const;
139 virtual SALOME_EvalExprError calculate(const SALOME_String&, SALOME_EvalVariant&, SALOME_EvalVariant& ) const;
141 static SALOME_String Name();
142 virtual SALOME_String name() const;
145 //=======================================================================
146 //class : SALOME_EvalSetString
148 //=======================================================================
149 class SALOME_EvalSetString : public SALOME_EvalSetBase
152 SALOME_EvalSetString();
153 virtual ~SALOME_EvalSetString();
155 virtual bool createValue( const SALOME_String&, SALOME_EvalVariant& ) const;
156 virtual int priority( const SALOME_String&, bool isBin ) const;
157 virtual SALOME_EvalExprError calculate(const SALOME_String&, SALOME_EvalVariant&, SALOME_EvalVariant& ) const;
159 static SALOME_String Name();
160 virtual SALOME_String name() const;
163 //=======================================================================
164 //class : SALOME_EvalSetSets
166 //=======================================================================
167 class SALOME_EvalSetSets : public SALOME_EvalSetBase
170 typedef SALOME_ListOfEvalVariant ValueSet;
173 SALOME_EvalSetSets();
174 virtual ~SALOME_EvalSetSets();
176 virtual int priority( const SALOME_String&, bool isBin ) const;
177 virtual SALOME_EvalExprError calculate(const SALOME_String&, SALOME_EvalVariant&, SALOME_EvalVariant& ) const;
178 virtual SALOME_EvalExprError isValid( const SALOME_String&, const SALOME_EvalVariantType, const SALOME_EvalVariantType ) const;
179 virtual void bracketsList( SALOME_StringList&, bool open ) const;
181 static SALOME_String Name();
182 virtual SALOME_String name() const;
184 static void add ( ValueSet&, const SALOME_EvalVariant& );
185 static void add ( ValueSet&, const ValueSet& );
186 static void remove( ValueSet&, const SALOME_EvalVariant& );
187 static void remove( ValueSet&, const ValueSet& );
190 //=======================================================================
191 //class : SALOME_EvalSetConst
193 //=======================================================================
194 class SALOME_EvalSetConst : public SALOME_EvalSet
197 SALOME_EvalSetConst();
198 virtual ~SALOME_EvalSetConst();
200 static SALOME_String Name();
201 virtual SALOME_String name() const;
203 virtual bool createValue( const SALOME_String&, SALOME_EvalVariant& ) const;
204 virtual void operationList( SALOME_StringList& ) const;
205 virtual void bracketsList( SALOME_StringList&, bool open ) const;
206 virtual int priority( const SALOME_String&, bool isBin ) const;
207 virtual SALOME_EvalExprError isValid( const SALOME_String&, const SALOME_EvalVariantType, const SALOME_EvalVariantType ) const;
208 virtual SALOME_EvalExprError calculate( const SALOME_String&, SALOME_EvalVariant&, SALOME_EvalVariant& ) const;