functor.hpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef __XIOS_CFunctor__
  2. #define __XIOS_CFunctor__
  3. /// XIOS headers ///
  4. #include "xios_spl.hpp"
  5. #include "exception.hpp"
  6. #include "array_new.hpp"
  7. namespace xios
  8. {
  9. namespace func
  10. {
  11. /// ////////////////////// Déclarations ////////////////////// ///
  12. class CFunctor : public CObject
  13. {
  14. /// Définition de type ///
  15. typedef CObject SuperClass;
  16. public :
  17. enum ETimeType { once, instant, centered } ;
  18. /// Accesseurs ///
  19. CArray<double,1> getDataOutput(void) const;
  20. /// Opérateur ///
  21. CArray<double,1> operator ()(const CArray<double,1>& dinput);
  22. virtual ETimeType timeType(void) = 0 ;
  23. /// Destructeur ///
  24. virtual ~CFunctor(void);
  25. //Traitement ///
  26. virtual void final(void);
  27. protected :
  28. /// Traitement ///
  29. virtual void apply(const CArray<double,1>& dinput, CArray<double,1>& doutput) = 0;
  30. /// Autres ///
  31. virtual StdString toString(void) const;
  32. virtual void fromString(const StdString & str);
  33. /// Constructeurs ///
  34. CFunctor(void); // Not implemented.
  35. CFunctor(const StdString & id, CArray<double,1>& doutput);
  36. CFunctor(const StdString & id, CArray<double,1>& doutput, double missingValue);
  37. CFunctor(const CFunctor & functor); // Not implemented.
  38. CFunctor(const CFunctor * const functor); // Not implemented.
  39. protected :
  40. /// Propriétés privées ///
  41. CArray<double,1>& doutput;
  42. /// Propriétés protégées ///
  43. int nbcall;
  44. bool hasMissingValue ;
  45. double missingValue ;
  46. CArray<int,1> nbcalls ;
  47. }; // class CFunctor
  48. } // namespace func
  49. } // namespace xios
  50. //#include "functor_type.hpp"
  51. #endif // __XIOS_CFunctor__