VAPoR  0.1
NCBuf.h
Go to the documentation of this file.
1 
2 
3 #ifndef _NCBuf_h_
4 #define _NCBuf_h_
5 
6 #include <vector>
7 #include <sstream>
8 #include <vapor/MyBase.h>
9 
10 namespace VAPoR {
11 
12 class VDF_API NCBuf : public VetsUtil::MyBase {
13 public:
14 
15  NCBuf(
16  int ncid, int varid, int xtype, vector <size_t> dims, bool useCollective, int rank, size_t bufsize = 4*1024*1024
17  );
18 
19  ~NCBuf();
20 
21  int PutVara(
22  const size_t start[], const size_t count[],
23  const void *data
24  );
25 
26  int Flush();
27 
28 private:
29  int _ncid;
30  int _varid;
31  unsigned char *_buf;
32  size_t _bufsize; // size of _buf in bytes
33  size_t _bufcount; // num bytes in _buf
34  size_t *_start;
35  size_t *_count;
36  std::vector <size_t> _dims;
37  int _xtype;
38  size_t _elem_size;
39  bool _collective;
40  int _rank;
41 
42  bool contiguous(const size_t count[]);
43  void linearize(
44  const size_t start[], const size_t count[], size_t *lstart, size_t *lcount
45  );
46  void inc_count(size_t lcount);
47 
48  void delinearize(size_t lcount, size_t count[]);
49 
50  size_t max_reg( const size_t start[]);
51 
52 
53 };
54 
55 };
56 #endif
#define VDF_API
Definition: common.h:61
VetsUtil base class.
Definition: MyBase.h:68