[591] | 1 | #ifndef __XIOS_CArray__ |
---|
| 2 | #define __XIOS_CArray__ |
---|
[219] | 3 | |
---|
| 4 | /// boost headers /// |
---|
| 5 | #include <boost/cstdint.hpp> |
---|
| 6 | #include <boost/multi_array.hpp> |
---|
| 7 | |
---|
[591] | 8 | /// XIOS headers /// |
---|
| 9 | #include "xios_spl.hpp" |
---|
[300] | 10 | #include "buffer_in.hpp" |
---|
| 11 | #include "buffer_out.hpp" |
---|
[219] | 12 | |
---|
[300] | 13 | |
---|
[335] | 14 | namespace xios |
---|
[219] | 15 | { |
---|
[300] | 16 | template<size_t numDims> |
---|
[352] | 17 | inline detail::multi_array::extent_gen<numDims> getExtentNull(void) { return getExtentNull<numDims-1>()[0];} |
---|
[300] | 18 | |
---|
| 19 | template<> |
---|
[352] | 20 | inline detail::multi_array::extent_gen<1> getExtentNull<1>(void) { return extents[0]; } |
---|
[300] | 21 | |
---|
[219] | 22 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
[352] | 23 | |
---|
| 24 | template <typename ValueType, StdSize NumDims, typename Allocator = std::allocator<ValueType> > |
---|
| 25 | class CArray : public boost::multi_array<ValueType, NumDims, Allocator> |
---|
[219] | 26 | { |
---|
| 27 | /// Définition de type /// |
---|
| 28 | typedef boost::multi_array<ValueType, NumDims, Allocator> SuperClass; |
---|
| 29 | |
---|
| 30 | public: |
---|
| 31 | |
---|
| 32 | typedef ValueType ValType; |
---|
| 33 | |
---|
| 34 | /// Constructeurs /// |
---|
[352] | 35 | // template <typename ExtentList> |
---|
| 36 | // explicit CArray(const ExtentList & sizes); |
---|
| 37 | template <typename ExtentList> CArray(const ExtentList & sizes) |
---|
| 38 | : boost::multi_array<ValueType, NumDims, Allocator> |
---|
| 39 | (sizes, boost::fortran_storage_order()) |
---|
| 40 | { /* Ne rien faire de plus */ } |
---|
[219] | 41 | |
---|
[352] | 42 | |
---|
[300] | 43 | explicit CArray(); |
---|
| 44 | |
---|
[352] | 45 | // template <typename ExtentList> |
---|
| 46 | // CArray(const ExtentList & sizes, const boost::general_storage_order<NumDims> & store); |
---|
| 47 | template <typename ExtentList> CArray(const ExtentList & sizes, const boost::general_storage_order<NumDims> & store) |
---|
| 48 | : boost::multi_array<ValueType, NumDims, Allocator> (sizes, store) |
---|
| 49 | { /* Ne rien faire de plus */ } |
---|
[219] | 50 | |
---|
| 51 | CArray(const CArray & array); // NEVER IMPLEMENTED. |
---|
| 52 | CArray(const CArray * const array); // NEVER IMPLEMENTED. |
---|
| 53 | |
---|
| 54 | public: |
---|
[300] | 55 | |
---|
[219] | 56 | /// Flux /// |
---|
| 57 | template <typename U, StdSize V, typename W> |
---|
| 58 | friend StdOStream & operator << |
---|
| 59 | (StdOStream & os, const CArray<U, V, W> & array); |
---|
| 60 | |
---|
| 61 | template <typename U, StdSize V, typename W> |
---|
| 62 | friend StdIStream & operator >> |
---|
| 63 | (StdIStream & is, CArray<U, V, W> & array); |
---|
| 64 | |
---|
| 65 | public: |
---|
| 66 | |
---|
| 67 | void toBinary (StdOStream & os) const; |
---|
| 68 | void fromBinary(StdIStream & is); |
---|
| 69 | |
---|
[300] | 70 | size_t getSize(void) const ; |
---|
| 71 | bool toBuffer (CBufferOut& buffer) const; |
---|
| 72 | bool fromBuffer(CBufferIn& buffer); |
---|
| 73 | |
---|
| 74 | |
---|
[219] | 75 | /// Destructeur /// |
---|
| 76 | virtual ~CArray(void); |
---|
| 77 | |
---|
| 78 | }; // class CArray |
---|
| 79 | |
---|
| 80 | ///--------------------------------------------------------------- |
---|
| 81 | |
---|
[335] | 82 | } // namespace xios |
---|
[219] | 83 | |
---|
[352] | 84 | //#include "array_impl.hpp" |
---|
[219] | 85 | #include "array_mac.hpp" |
---|
[352] | 86 | namespace xios |
---|
| 87 | { |
---|
| 88 | template <typename ValueType> void FromBinary(StdIStream & is, ARRAY(ValueType, 1) & array) ; |
---|
| 89 | template <typename ValueType> void FromBinary(StdIStream & is, ARRAY(ValueType, 2) & array) ; |
---|
| 90 | template <typename ValueType> void FromBinary(StdIStream & is, ARRAY(ValueType, 3) & array) ; |
---|
| 91 | } |
---|
[591] | 92 | #endif // __XIOS_CArray__ |
---|