Salome HOME
Get relevant changes from V7_dev branch (copyright update, adm files etc)
[tools/medcoupling.git] / src / INTERP_KERNEL / ExprEval / InterpKernelFunction.hxx
index f49c7594303c42938b811afe329a78610ecfe7f7..2c4ac0bbf62099514858ce2d414966159a76174d 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -34,12 +34,12 @@ namespace INTERP_KERNEL
   class INTERPKERNEL_EXPORT FunctionsFactory
   {
   public:
-    static Function *buildFuncFromString(const char *type, int nbOfParams) throw(INTERP_KERNEL::Exception);
-    static Function *buildUnaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception);
-    //static Function *buildUnaryFuncFromString(char type) throw(INTERP_KERNEL::Exception);
-    static Function *buildBinaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception);
-    static Function *buildBinaryFuncFromString(char type) throw(INTERP_KERNEL::Exception);
-    static Function *buildTernaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception);
+    static Function *buildFuncFromString(const char *type, int nbOfParams);
+    static Function *buildUnaryFuncFromString(const char *type);
+    //static Function *buildUnaryFuncFromString(char type);
+    static Function *buildBinaryFuncFromString(const char *type);
+    static Function *buildBinaryFuncFromString(char type);
+    static Function *buildTernaryFuncFromString(const char *type);
   };
 
   class INTERPKERNEL_EXPORT Function
@@ -47,10 +47,13 @@ namespace INTERP_KERNEL
   public:
     virtual ~Function();
     virtual int getNbInputParams() const = 0;
-    virtual void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception) = 0;
-    virtual void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual void operate(std::vector<Value *>& stck) const = 0;
+    virtual void operateX86(std::vector<std::string>& asmb) const = 0;
+    virtual void operateStackOfDouble(std::vector<double>& stck) const = 0;
+    virtual void operateStackOfDoubleSafe(std::vector<double>& stck) const { operateStackOfDouble(stck); }
     virtual const char *getRepr() const = 0;
     virtual bool isACall() const = 0;
+    virtual Function *deepCopy() const = 0;
   };
 
   class INTERPKERNEL_EXPORT UnaryFunction : public Function
@@ -63,10 +66,12 @@ namespace INTERP_KERNEL
   {
   public:
     ~IdentityFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    IdentityFunction *deepCopy() const { return new IdentityFunction; }
   public:
     static const char REPR[];
   };
@@ -75,10 +80,12 @@ namespace INTERP_KERNEL
   {
   public:
     ~PositiveFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    PositiveFunction *deepCopy() const { return new PositiveFunction; }
   public:
     static const char REPR[];
   };
@@ -87,10 +94,12 @@ namespace INTERP_KERNEL
   {
   public:
     ~NegateFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    NegateFunction *deepCopy() const { return new NegateFunction; }
   public:
     static const char REPR[];
   };
@@ -99,10 +108,12 @@ namespace INTERP_KERNEL
   {
   public:
     ~CosFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    CosFunction *deepCopy() const { return new CosFunction; }
   public:
     static const char REPR[];
   };
@@ -111,10 +122,12 @@ namespace INTERP_KERNEL
   {
   public:
     ~SinFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    SinFunction *deepCopy() const { return new SinFunction; }
   public:
     static const char REPR[];
   };
@@ -123,10 +136,98 @@ namespace INTERP_KERNEL
   {
   public:
     ~TanFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    TanFunction *deepCopy() const { return new TanFunction; }
+  public:
+    static const char REPR[];
+  };
+
+  class INTERPKERNEL_EXPORT ACosFunction : public UnaryFunction
+  {
+  public:
+    ~ACosFunction();
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
+    void operateStackOfDoubleSafe(std::vector<double>& stck) const;
+    const char *getRepr() const;
+    bool isACall() const;
+    ACosFunction *deepCopy() const { return new ACosFunction; }
+  public:
+    static const char REPR[];
+  };
+
+  class INTERPKERNEL_EXPORT ASinFunction : public UnaryFunction
+  {
+  public:
+    ~ASinFunction();
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
+    void operateStackOfDoubleSafe(std::vector<double>& stck) const;
+    const char *getRepr() const;
+    bool isACall() const;
+    ASinFunction *deepCopy() const { return new ASinFunction; }
+  public:
+    static const char REPR[];
+  };
+
+  class INTERPKERNEL_EXPORT ATanFunction : public UnaryFunction
+  {
+  public:
+    ~ATanFunction();
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
+    const char *getRepr() const;
+    bool isACall() const;
+    ATanFunction *deepCopy() const { return new ATanFunction; }
+  public:
+    static const char REPR[];
+  };
+
+  class INTERPKERNEL_EXPORT CoshFunction : public UnaryFunction
+  {
+  public:
+    ~CoshFunction();
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
+    const char *getRepr() const;
+    bool isACall() const;
+    CoshFunction *deepCopy() const { return new CoshFunction; }
+  public:
+    static const char REPR[];
+  };
+
+  class INTERPKERNEL_EXPORT SinhFunction : public UnaryFunction
+  {
+  public:
+    ~SinhFunction();
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
+    const char *getRepr() const;
+    bool isACall() const;
+    SinhFunction *deepCopy() const { return new SinhFunction; }
+  public:
+    static const char REPR[];
+  };
+
+  class INTERPKERNEL_EXPORT TanhFunction : public UnaryFunction
+  {
+  public:
+    ~TanhFunction();
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
+    const char *getRepr() const;
+    bool isACall() const;
+    TanhFunction *deepCopy() const { return new TanhFunction; }
   public:
     static const char REPR[];
   };
@@ -135,10 +236,13 @@ namespace INTERP_KERNEL
   {
   public:
     ~SqrtFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operate(std::vector<Value *>& stck) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
+    void operateStackOfDoubleSafe(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    SqrtFunction *deepCopy() const { return new SqrtFunction; }
   public:
     static const char REPR[];
   };
@@ -147,10 +251,12 @@ namespace INTERP_KERNEL
   {
   public:
     ~AbsFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    AbsFunction *deepCopy() const { return new AbsFunction; }
   public:
     static const char REPR[];
   };
@@ -159,10 +265,12 @@ namespace INTERP_KERNEL
   {
   public:
     ~ExpFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    ExpFunction *deepCopy() const { return new ExpFunction; }
   public:
     static const char REPR[];
   };
@@ -171,10 +279,13 @@ namespace INTERP_KERNEL
   {
   public:
     ~LnFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
+    void operateStackOfDoubleSafe(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    LnFunction *deepCopy() const { return new LnFunction; }
   public:
     static const char REPR[];
   };
@@ -183,10 +294,13 @@ namespace INTERP_KERNEL
   {
   public:
     ~LogFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
+    void operateStackOfDoubleSafe(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    LogFunction *deepCopy() const { return new LogFunction; }
   public:
     static const char REPR[];
   };
@@ -195,10 +309,13 @@ namespace INTERP_KERNEL
   {
   public:
     ~Log10Function();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
+    void operateStackOfDoubleSafe(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    Log10Function *deepCopy() const { return new Log10Function; }
   public:
     static const char REPR[];
   };
@@ -213,10 +330,12 @@ namespace INTERP_KERNEL
   {
   public:
     ~PlusFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    PlusFunction *deepCopy() const { return new PlusFunction; }
   public:
     static const char REPR[];
   };
@@ -225,10 +344,12 @@ namespace INTERP_KERNEL
   {
   public:
     ~MinusFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    MinusFunction *deepCopy() const { return new MinusFunction; }
   public:
     static const char REPR[];
   };
@@ -237,10 +358,12 @@ namespace INTERP_KERNEL
   {
   public:
     ~MultFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    MultFunction *deepCopy() const { return new MultFunction; }
   public:
     static const char REPR[];
   };
@@ -249,10 +372,13 @@ namespace INTERP_KERNEL
   {
   public:
     ~DivFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
+    void operateStackOfDoubleSafe(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    DivFunction *deepCopy() const { return new DivFunction; }
   public:
     static const char REPR[];
   };
@@ -261,10 +387,13 @@ namespace INTERP_KERNEL
   {
   public:
     ~PowFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
+    void operateStackOfDoubleSafe(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    PowFunction *deepCopy() const { return new PowFunction; }
   public:
     static const char REPR[];
   };
@@ -273,10 +402,12 @@ namespace INTERP_KERNEL
   {
   public:
     ~MaxFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    MaxFunction *deepCopy() const { return new MaxFunction; }
   public:
     static const char REPR[];
   };
@@ -285,10 +416,12 @@ namespace INTERP_KERNEL
   {
   public:
     ~MinFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    MinFunction *deepCopy() const { return new MinFunction; }
   public:
     static const char REPR[];
   };
@@ -297,10 +430,12 @@ namespace INTERP_KERNEL
   {
   public:
     ~GreaterThanFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    GreaterThanFunction *deepCopy() const { return new GreaterThanFunction; }
   public:
     static const char REPR[];
   };
@@ -309,10 +444,12 @@ namespace INTERP_KERNEL
   {
   public:
     ~LowerThanFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    LowerThanFunction *deepCopy() const { return new LowerThanFunction; }
   public:
     static const char REPR[];
   };
@@ -327,10 +464,13 @@ namespace INTERP_KERNEL
   {
   public:
     ~IfFunction();
-    void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
-    void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+    void operate(std::vector<Value *>& stck) const;
+    void operateX86(std::vector<std::string>& asmb) const;
+    void operateStackOfDouble(std::vector<double>& stck) const;
+    void operateStackOfDoubleSafe(std::vector<double>& stck) const;
     const char *getRepr() const;
     bool isACall() const;
+    IfFunction *deepCopy() const { return new IfFunction; }
   public:
     static const char REPR[];
   };