source: XMLIO_V2/dev/common/src/array.hpp @ 300

Last change on this file since 300 was 300, checked in by ymipsl, 12 years ago

nouvelle version de developpement de xios

  • nouvelle interface fortran
  • recodage complet de la couche de communication
  • et bien d'autres choses...

YM

File size: 2.2 KB
Line 
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
9/// xmlioserver headers ///
10#include "xmlioserver_spl.hpp"
11#include "buffer_in.hpp"
12#include "buffer_out.hpp"
13
14
15namespace xmlioserver
16{
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
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
40         explicit CArray();
41
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:
49
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
64         size_t getSize(void) const ;
65         bool toBuffer  (CBufferOut& buffer) const;
66         bool fromBuffer(CBufferIn& buffer);
67
68
69         /// Destructeur ///
70         virtual ~CArray(void);
71
72   }; // class CArray
73   
74
75   ///---------------------------------------------------------------
76
77} // namespace xmlioserver
78
79#include "array_impl.hpp"
80#include "array_mac.hpp"
81
82#endif // __XMLIO_CArray__
Note: See TracBrowser for help on using the repository browser.