1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
21 #ifndef __INTERPKERNELVALUE_HXX__
22 #define __INTERPKERNELVALUE_HXX__
24 #include "INTERPKERNELDefines.hxx"
25 #include "InterpKernelException.hxx"
26 #include "InterpKernelUnit.hxx"
28 namespace INTERP_KERNEL
30 class INTERPKERNEL_EXPORT Value
33 virtual Value *newInstance() const = 0;
35 virtual void setDouble(double val) throw(INTERP_KERNEL::Exception) = 0;
36 virtual void setVarname(int fastPos, const std::string& var) throw(INTERP_KERNEL::Exception) = 0;
38 virtual void positive() throw(INTERP_KERNEL::Exception) = 0;
39 virtual void negate() throw(INTERP_KERNEL::Exception) = 0;
40 virtual void sqrt() throw(INTERP_KERNEL::Exception) = 0;
41 virtual void cos() throw(INTERP_KERNEL::Exception) = 0;
42 virtual void sin() throw(INTERP_KERNEL::Exception) = 0;
43 virtual void tan() throw(INTERP_KERNEL::Exception) = 0;
44 virtual void acos() throw(INTERP_KERNEL::Exception) = 0;
45 virtual void asin() throw(INTERP_KERNEL::Exception) = 0;
46 virtual void atan() throw(INTERP_KERNEL::Exception) = 0;
47 virtual void cosh() throw(INTERP_KERNEL::Exception) = 0;
48 virtual void sinh() throw(INTERP_KERNEL::Exception) = 0;
49 virtual void tanh() throw(INTERP_KERNEL::Exception) = 0;
50 virtual void abs() throw(INTERP_KERNEL::Exception) = 0;
51 virtual void exp() throw(INTERP_KERNEL::Exception) = 0;
52 virtual void ln() throw(INTERP_KERNEL::Exception) = 0;
53 virtual void log10() throw(INTERP_KERNEL::Exception) = 0;
55 virtual Value *plus(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
56 virtual Value *minus(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
57 virtual Value *mult(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
58 virtual Value *div(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
59 virtual Value *pow(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
60 virtual Value *max(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
61 virtual Value *min(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
62 virtual Value *greaterThan(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
63 virtual Value *lowerThan(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
65 virtual Value *ifFunc(const Value *the, const Value *els) const throw(INTERP_KERNEL::Exception) = 0;
68 class INTERPKERNEL_EXPORT ValueDouble : public Value
72 Value *newInstance() const;
73 void setDouble(double val) throw(INTERP_KERNEL::Exception);
74 void setVarname(int fastPos, const std::string& var) throw(INTERP_KERNEL::Exception);
76 double getData() const { return _data; }
77 void positive() throw(INTERP_KERNEL::Exception);
78 void negate() throw(INTERP_KERNEL::Exception);
79 void sqrt() throw(INTERP_KERNEL::Exception);
80 void cos() throw(INTERP_KERNEL::Exception);
81 void sin() throw(INTERP_KERNEL::Exception);
82 void tan() throw(INTERP_KERNEL::Exception);
83 void acos() throw(INTERP_KERNEL::Exception);
84 void asin() throw(INTERP_KERNEL::Exception);
85 void atan() throw(INTERP_KERNEL::Exception);
86 void cosh() throw(INTERP_KERNEL::Exception);
87 void sinh() throw(INTERP_KERNEL::Exception);
88 void tanh() throw(INTERP_KERNEL::Exception);
89 void abs() throw(INTERP_KERNEL::Exception);
90 void exp() throw(INTERP_KERNEL::Exception);
91 void ln() throw(INTERP_KERNEL::Exception);
92 void log10() throw(INTERP_KERNEL::Exception);
94 Value *plus(const Value *other) const throw(INTERP_KERNEL::Exception);
95 Value *minus(const Value *other) const throw(INTERP_KERNEL::Exception);
96 Value *mult(const Value *other) const throw(INTERP_KERNEL::Exception);
97 Value *div(const Value *other) const throw(INTERP_KERNEL::Exception);
98 Value *pow(const Value *other) const throw(INTERP_KERNEL::Exception);
99 Value *max(const Value *other) const throw(INTERP_KERNEL::Exception);
100 Value *min(const Value *other) const throw(INTERP_KERNEL::Exception);
101 Value *greaterThan(const Value *other) const throw(INTERP_KERNEL::Exception);
102 Value *lowerThan(const Value *other) const throw(INTERP_KERNEL::Exception);
104 Value *ifFunc(const Value *the, const Value *els) const throw(INTERP_KERNEL::Exception);
106 ValueDouble(double val);
107 static const ValueDouble *checkSameType(const Value *val) throw(INTERP_KERNEL::Exception);
112 class INTERPKERNEL_EXPORT ValueUnit : public Value
116 Value *newInstance() const;
117 void setDouble(double val) throw(INTERP_KERNEL::Exception);
118 void setVarname(int fastPos, const std::string& var) throw(INTERP_KERNEL::Exception);
120 DecompositionInUnitBase getData() const { return _data; }
121 void positive() throw(INTERP_KERNEL::Exception);
122 void negate() throw(INTERP_KERNEL::Exception);
123 void sqrt() throw(INTERP_KERNEL::Exception);
124 void cos() throw(INTERP_KERNEL::Exception);
125 void sin() throw(INTERP_KERNEL::Exception);
126 void tan() throw(INTERP_KERNEL::Exception);
127 void acos() throw(INTERP_KERNEL::Exception);
128 void asin() throw(INTERP_KERNEL::Exception);
129 void atan() throw(INTERP_KERNEL::Exception);
130 void cosh() throw(INTERP_KERNEL::Exception);
131 void sinh() throw(INTERP_KERNEL::Exception);
132 void tanh() throw(INTERP_KERNEL::Exception);
133 void abs() throw(INTERP_KERNEL::Exception);
134 void exp() throw(INTERP_KERNEL::Exception);
135 void ln() throw(INTERP_KERNEL::Exception);
136 void log10() throw(INTERP_KERNEL::Exception);
138 Value *plus(const Value *other) const throw(INTERP_KERNEL::Exception);
139 Value *minus(const Value *other) const throw(INTERP_KERNEL::Exception);
140 Value *mult(const Value *other) const throw(INTERP_KERNEL::Exception);
141 Value *div(const Value *other) const throw(INTERP_KERNEL::Exception);
142 Value *pow(const Value *other) const throw(INTERP_KERNEL::Exception);
143 Value *max(const Value *other) const throw(INTERP_KERNEL::Exception);
144 Value *min(const Value *other) const throw(INTERP_KERNEL::Exception);
145 Value *greaterThan(const Value *other) const throw(INTERP_KERNEL::Exception);
146 Value *lowerThan(const Value *other) const throw(INTERP_KERNEL::Exception);
148 Value *ifFunc(const Value *the, const Value *els) const throw(INTERP_KERNEL::Exception);
150 ValueUnit(const DecompositionInUnitBase& unit);
151 static void unsupportedOp(const char *type) throw(INTERP_KERNEL::Exception);
152 static const ValueUnit *checkSameType(const Value *val) throw(INTERP_KERNEL::Exception);
154 DecompositionInUnitBase _data;
157 class INTERPKERNEL_EXPORT ValueDoubleExpr : public Value
160 ValueDoubleExpr(int szDestData, const double *srcData);
162 double *getData() const { return _dest_data; }
163 Value *newInstance() const;
164 void setDouble(double val) throw(INTERP_KERNEL::Exception);
165 void setVarname(int fastPos, const std::string& var) throw(INTERP_KERNEL::Exception);
167 void positive() throw(INTERP_KERNEL::Exception);
168 void negate() throw(INTERP_KERNEL::Exception);
169 void sqrt() throw(INTERP_KERNEL::Exception);
170 void cos() throw(INTERP_KERNEL::Exception);
171 void sin() throw(INTERP_KERNEL::Exception);
172 void tan() throw(INTERP_KERNEL::Exception);
173 void acos() throw(INTERP_KERNEL::Exception);
174 void asin() throw(INTERP_KERNEL::Exception);
175 void atan() throw(INTERP_KERNEL::Exception);
176 void cosh() throw(INTERP_KERNEL::Exception);
177 void sinh() throw(INTERP_KERNEL::Exception);
178 void tanh() throw(INTERP_KERNEL::Exception);
179 void abs() throw(INTERP_KERNEL::Exception);
180 void exp() throw(INTERP_KERNEL::Exception);
181 void ln() throw(INTERP_KERNEL::Exception);
182 void log10() throw(INTERP_KERNEL::Exception);
184 Value *plus(const Value *other) const throw(INTERP_KERNEL::Exception);
185 Value *minus(const Value *other) const throw(INTERP_KERNEL::Exception);
186 Value *mult(const Value *other) const throw(INTERP_KERNEL::Exception);
187 Value *div(const Value *other) const throw(INTERP_KERNEL::Exception);
188 Value *pow(const Value *other) const throw(INTERP_KERNEL::Exception);
189 Value *max(const Value *other) const throw(INTERP_KERNEL::Exception);
190 Value *min(const Value *other) const throw(INTERP_KERNEL::Exception);
191 Value *greaterThan(const Value *other) const throw(INTERP_KERNEL::Exception);
192 Value *lowerThan(const Value *other) const throw(INTERP_KERNEL::Exception);
194 Value *ifFunc(const Value *the, const Value *els) const throw(INTERP_KERNEL::Exception);
198 const double *_src_data;