source: XIOS/dev/dev_olga/src/array.hpp @ 1627

Last change on this file since 1627 was 1542, checked in by oabramkina, 6 years ago

Replacing Boost's unordered_map and shared_pointer by its STL counterparts.

Two notes for Curie:

  • one can see the content of unordered_map with ddt only if XIOS has been compiled with gnu
  • XIOS will not compile any more with pgi (all available versions use old STL which are not up to the c++11 norms)
  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 2.9 KB
Line 
1#ifndef __XIOS_CArray__
2#define __XIOS_CArray__
3
4/// boost headers ///
5#include <boost/cstdint.hpp>
6#include <boost/multi_array.hpp>
7
8/// XIOS headers ///
9#include "xios_spl.hpp"
10#include "buffer_in.hpp"
11#include "buffer_out.hpp"
12
13
14namespace xios
15{
16   template<size_t numDims>
17   inline detail::multi_array::extent_gen<numDims> getExtentNull(void) { return getExtentNull<numDims-1>()[0];}
18   
19   template<>
20   inline detail::multi_array::extent_gen<1> getExtentNull<1>(void) { return extents[0]; }
21
22   /// ////////////////////// Déclarations ////////////////////// ///
23   
24   template <typename ValueType, StdSize  NumDims, typename Allocator = std::allocator<ValueType> >
25   class CArray : public boost::multi_array<ValueType, NumDims, Allocator>
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 ///
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 */ }
41
42
43         explicit CArray();
44
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 */ }
50
51         CArray(const CArray & array);       // NEVER IMPLEMENTED.
52         CArray(const CArray * const array); // NEVER IMPLEMENTED.
53
54      public:
55
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
70         size_t getSize(void) const ;
71         bool toBuffer  (CBufferOut& buffer) const;
72         bool fromBuffer(CBufferIn& buffer);
73
74
75         /// Destructeur ///
76         virtual ~CArray(void);
77
78   }; // class CArray
79
80   ///---------------------------------------------------------------
81
82} // namespace xios
83
84//#include "array_impl.hpp"
85#include "array_mac.hpp"
86namespace 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}
92#endif // __XIOS_CArray__
Note: See TracBrowser for help on using the repository browser.