Back to index

salome-med  6.5.0
InterpKernelFunction.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef __INTERPKERNELFUNCTION_HXX__
00021 #define __INTERPKERNELFUNCTION_HXX__
00022 
00023 #include "INTERPKERNELDefines.hxx"
00024 #include "InterpKernelException.hxx"
00025 
00026 #include <vector>
00027 
00028 namespace INTERP_KERNEL
00029 {
00030   class Value;
00031   class Function;
00032 
00033   class INTERPKERNEL_EXPORT FunctionsFactory
00034   {
00035   public:
00036     static Function *buildFuncFromString(const char *type, int nbOfParams) throw(INTERP_KERNEL::Exception);
00037     static Function *buildUnaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception);
00038     //static Function *buildUnaryFuncFromString(char type) throw(INTERP_KERNEL::Exception);
00039     static Function *buildBinaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception);
00040     static Function *buildBinaryFuncFromString(char type) throw(INTERP_KERNEL::Exception);
00041     static Function *buildTernaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception);
00042   };
00043 
00044   class INTERPKERNEL_EXPORT Function
00045   {
00046   public:
00047     virtual ~Function();
00048     virtual int getNbInputParams() const = 0;
00049     virtual void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception) = 0;
00050     virtual void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception) = 0;
00051     virtual const char *getRepr() const = 0;
00052     virtual bool isACall() const = 0;
00053   };
00054 
00055   class INTERPKERNEL_EXPORT UnaryFunction : public Function
00056   { 
00057   public:
00058     int getNbInputParams() const;
00059   };
00060 
00061   class INTERPKERNEL_EXPORT IdentityFunction : public UnaryFunction
00062   {
00063   public:
00064     ~IdentityFunction();
00065     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00066     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00067     const char *getRepr() const;
00068     bool isACall() const;
00069   public:
00070     static const char REPR[];
00071   };
00072 
00073   class INTERPKERNEL_EXPORT PositiveFunction : public UnaryFunction
00074   {
00075   public:
00076     ~PositiveFunction();
00077     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00078     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00079     const char *getRepr() const;
00080     bool isACall() const;
00081   public:
00082     static const char REPR[];
00083   };
00084 
00085   class INTERPKERNEL_EXPORT NegateFunction : public UnaryFunction
00086   {
00087   public:
00088     ~NegateFunction();
00089     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00090     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00091     const char *getRepr() const;
00092     bool isACall() const;
00093   public:
00094     static const char REPR[];
00095   };
00096 
00097   class INTERPKERNEL_EXPORT CosFunction : public UnaryFunction
00098   {
00099   public:
00100     ~CosFunction();
00101     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00102     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00103     const char *getRepr() const;
00104     bool isACall() const;
00105   public:
00106     static const char REPR[];
00107   };
00108 
00109   class INTERPKERNEL_EXPORT SinFunction : public UnaryFunction
00110   {
00111   public:
00112     ~SinFunction();
00113     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00114     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00115     const char *getRepr() const;
00116     bool isACall() const;
00117   public:
00118     static const char REPR[];
00119   };
00120 
00121   class INTERPKERNEL_EXPORT TanFunction : public UnaryFunction
00122   {
00123   public:
00124     ~TanFunction();
00125     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00126     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00127     const char *getRepr() const;
00128     bool isACall() const;
00129   public:
00130     static const char REPR[];
00131   };
00132 
00133   class INTERPKERNEL_EXPORT SqrtFunction : public UnaryFunction
00134   {
00135   public:
00136     ~SqrtFunction();
00137     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00138     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00139     const char *getRepr() const;
00140     bool isACall() const;
00141   public:
00142     static const char REPR[];
00143   };
00144 
00145   class INTERPKERNEL_EXPORT AbsFunction : public UnaryFunction
00146   {
00147   public:
00148     ~AbsFunction();
00149     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00150     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00151     const char *getRepr() const;
00152     bool isACall() const;
00153   public:
00154     static const char REPR[];
00155   };
00156 
00157   class INTERPKERNEL_EXPORT ExpFunction : public UnaryFunction
00158   {
00159   public:
00160     ~ExpFunction();
00161     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00162     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00163     const char *getRepr() const;
00164     bool isACall() const;
00165   public:
00166     static const char REPR[];
00167   };
00168 
00169   class INTERPKERNEL_EXPORT LnFunction : public UnaryFunction
00170   {
00171   public:
00172     ~LnFunction();
00173     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00174     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00175     const char *getRepr() const;
00176     bool isACall() const;
00177   public:
00178     static const char REPR[];
00179   };
00180 
00181   class INTERPKERNEL_EXPORT LogFunction : public UnaryFunction
00182   {
00183   public:
00184     ~LogFunction();
00185     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00186     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00187     const char *getRepr() const;
00188     bool isACall() const;
00189   public:
00190     static const char REPR[];
00191   };
00192 
00193   class INTERPKERNEL_EXPORT Log10Function : public UnaryFunction
00194   {
00195   public:
00196     ~Log10Function();
00197     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00198     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00199     const char *getRepr() const;
00200     bool isACall() const;
00201   public:
00202     static const char REPR[];
00203   };
00204 
00205   class INTERPKERNEL_EXPORT BinaryFunction : public Function
00206   {
00207   public:
00208     int getNbInputParams() const;
00209   };
00210 
00211   class PlusFunction : public BinaryFunction
00212   {
00213   public:
00214     ~PlusFunction();
00215     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00216     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00217     const char *getRepr() const;
00218     bool isACall() const;
00219   public:
00220     static const char REPR[];
00221   };
00222 
00223   class INTERPKERNEL_EXPORT MinusFunction : public BinaryFunction
00224   {
00225   public:
00226     ~MinusFunction();
00227     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00228     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00229     const char *getRepr() const;
00230     bool isACall() const;
00231   public:
00232     static const char REPR[];
00233   };
00234 
00235   class INTERPKERNEL_EXPORT MultFunction : public BinaryFunction
00236   {
00237   public:
00238     ~MultFunction();
00239     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00240     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00241     const char *getRepr() const;
00242     bool isACall() const;
00243   public:
00244     static const char REPR[];
00245   };
00246   
00247   class INTERPKERNEL_EXPORT DivFunction : public BinaryFunction
00248   {
00249   public:
00250     ~DivFunction();
00251     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00252     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00253     const char *getRepr() const;
00254     bool isACall() const;
00255   public:
00256     static const char REPR[];
00257   };
00258 
00259   class INTERPKERNEL_EXPORT PowFunction : public BinaryFunction
00260   {
00261   public:
00262     ~PowFunction();
00263     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00264     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00265     const char *getRepr() const;
00266     bool isACall() const;
00267   public:
00268     static const char REPR[];
00269   };
00270 
00271   class INTERPKERNEL_EXPORT MaxFunction : public BinaryFunction
00272   {
00273   public:
00274     ~MaxFunction();
00275     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00276     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00277     const char *getRepr() const;
00278     bool isACall() const;
00279   public:
00280     static const char REPR[];
00281   };
00282 
00283   class INTERPKERNEL_EXPORT MinFunction : public BinaryFunction
00284   {
00285   public:
00286     ~MinFunction();
00287     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00288     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00289     const char *getRepr() const;
00290     bool isACall() const;
00291   public:
00292     static const char REPR[];
00293   };
00294 
00295   class INTERPKERNEL_EXPORT GreaterThanFunction : public BinaryFunction
00296   {
00297   public:
00298     ~GreaterThanFunction();
00299     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00300     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00301     const char *getRepr() const;
00302     bool isACall() const;
00303   public:
00304     static const char REPR[];
00305   };
00306 
00307   class INTERPKERNEL_EXPORT LowerThanFunction : public BinaryFunction
00308   {
00309   public:
00310     ~LowerThanFunction();
00311     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00312     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00313     const char *getRepr() const;
00314     bool isACall() const;
00315   public:
00316     static const char REPR[];
00317   };
00318 
00319   class INTERPKERNEL_EXPORT TernaryFunction : public Function
00320   {
00321   public:
00322     int getNbInputParams() const;
00323   };
00324 
00325   class INTERPKERNEL_EXPORT IfFunction : public TernaryFunction
00326   {
00327   public:
00328     ~IfFunction();
00329     void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
00330     void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
00331     const char *getRepr() const;
00332     bool isACall() const;
00333   public:
00334     static const char REPR[];
00335   };
00336 }
00337 
00338 #endif