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

Last change on this file since 983 was 591, checked in by rlacroix, 9 years ago

Remove leftovers from the XMLIO age.

  • 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: 3.0 KB
Line 
1#ifndef __XIOS_CArray__
2#define __XIOS_CArray__
3
4/// boost headers ///
5#include <boost/cstdint.hpp>
6#include <boost/shared_ptr.hpp>
7#include <boost/multi_array.hpp>
8
9/// XIOS headers ///
10#include "xios_spl.hpp"
11#include "buffer_in.hpp"
12#include "buffer_out.hpp"
13
14
15namespace xios
16{
17   template<size_t numDims>
18   inline detail::multi_array::extent_gen<numDims> getExtentNull(void) { return getExtentNull<numDims-1>()[0];}
19   
20   template<>
21   inline detail::multi_array::extent_gen<1> getExtentNull<1>(void) { return extents[0]; }
22
23   /// ////////////////////// Déclarations ////////////////////// ///
24   
25   template <typename ValueType, StdSize  NumDims, typename Allocator = std::allocator<ValueType> >
26   class CArray : public boost::multi_array<ValueType, NumDims, Allocator>
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 ///
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 */ }
42
43
44         explicit CArray();
45
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 */ }
51
52         CArray(const CArray & array);       // NEVER IMPLEMENTED.
53         CArray(const CArray * const array); // NEVER IMPLEMENTED.
54
55      public:
56
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
71         size_t getSize(void) const ;
72         bool toBuffer  (CBufferOut& buffer) const;
73         bool fromBuffer(CBufferIn& buffer);
74
75
76         /// Destructeur ///
77         virtual ~CArray(void);
78
79   }; // class CArray
80
81   ///---------------------------------------------------------------
82
83} // namespace xios
84
85//#include "array_impl.hpp"
86#include "array_mac.hpp"
87namespace 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}
93#endif // __XIOS_CArray__
Note: See TracBrowser for help on using the repository browser.