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