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