[152] | 1 | #ifndef __XMLIO_CFunctor__ |
---|
| 2 | #define __XMLIO_CFunctor__ |
---|
| 3 | |
---|
| 4 | /// xmlioserver headers /// |
---|
| 5 | #include "xmlioserver_spl.hpp" |
---|
| 6 | #include "exception.hpp" |
---|
| 7 | #include "array.hpp" |
---|
| 8 | |
---|
| 9 | namespace xmlioserver |
---|
| 10 | { |
---|
| 11 | namespace func |
---|
| 12 | { |
---|
| 13 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
| 14 | class CFunctor : private CObject |
---|
| 15 | { |
---|
| 16 | /// Définition de type /// |
---|
| 17 | typedef CObject SuperClass; |
---|
| 18 | typedef ARRAY(double, 1) DoubleArray; |
---|
| 19 | |
---|
| 20 | public : |
---|
| 21 | |
---|
| 22 | typedef enum func_type { SPATIAL = 0, TEMPORAL } CFuncType; |
---|
| 23 | typedef struct func_data |
---|
| 24 | { int timestep; } CFunData; |
---|
| 25 | |
---|
| 26 | /// Accesseurs /// |
---|
| 27 | CFuncType getType(void) const; |
---|
| 28 | StdSize getSize(void) const; |
---|
| 29 | |
---|
| 30 | const CFunData & getData(void) const; |
---|
| 31 | const std::vector<StdSize> & getShape(void) const; |
---|
| 32 | |
---|
| 33 | DoubleArray getDataOutput(void) const; |
---|
| 34 | |
---|
| 35 | /// Mutateur /// |
---|
| 36 | void resize(StdSize x, StdSize y = 1, StdSize z = 1); |
---|
| 37 | void resize(const std::vector<StdSize> & sizes); |
---|
| 38 | |
---|
| 39 | /// Opérateur /// |
---|
| 40 | DoubleArray operator ()(const DoubleArray dinput); |
---|
| 41 | |
---|
| 42 | /// Destructeur /// |
---|
| 43 | virtual ~CFunctor(void); |
---|
| 44 | |
---|
| 45 | protected : |
---|
| 46 | |
---|
| 47 | /// Traitement /// |
---|
| 48 | virtual void apply(const DoubleArray dinput, DoubleArray doutput, |
---|
| 49 | const std::vector<StdSize> size, const CFunData & data) = 0; |
---|
| 50 | |
---|
| 51 | /// Autres /// |
---|
| 52 | virtual StdString toString(void) const; |
---|
| 53 | virtual void fromString(const StdString & str); |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | /// Constructeurs /// |
---|
| 57 | CFunctor(void); // Not implemented. |
---|
| 58 | |
---|
| 59 | CFunctor(const StdString & id, DoubleArray doutput, |
---|
| 60 | const CFunData & data, CFuncType type = TEMPORAL); |
---|
| 61 | |
---|
| 62 | CFunctor(const StdString & id, DoubleArray doutput, |
---|
| 63 | const std::vector<StdSize> size, |
---|
| 64 | const CFunData & data, CFuncType type = TEMPORAL); |
---|
| 65 | |
---|
| 66 | CFunctor(const CFunctor & functor); // Not implemented. |
---|
| 67 | CFunctor(const CFunctor * const functor); // Not implemented. |
---|
| 68 | |
---|
| 69 | private : |
---|
| 70 | |
---|
| 71 | /// Propriétés privées /// |
---|
| 72 | DoubleArray doutput; |
---|
| 73 | std::vector<StdSize> size; |
---|
| 74 | CFunData data; CFuncType type; |
---|
| 75 | |
---|
| 76 | }; // class CFunctor |
---|
| 77 | } // namespace func |
---|
| 78 | } // namespace xmlioserver |
---|
| 79 | |
---|
[157] | 80 | #include "functor_type.hpp" |
---|
[152] | 81 | |
---|
| 82 | #endif // __XMLIO_CFunctor__ |
---|