IODA Bundle
Writer.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 1996-2012 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 ///
12 /// \file Writer.h
13 ///
14 /// @author Piotr Kuchta, Feb 2009
15 
16 #ifndef ODAWRITER_H
17 #define ODAWRITER_H
18 
19 #include "odc/IteratorProxy.h"
21 
22 namespace eckit { class PathName; }
23 namespace eckit { class DataHandle; }
24 
25 namespace odc {
26 
28 
29 template <typename ITERATOR = DefaultWritingIterator>
30 class Writer
31 {
32  enum { DEFAULT_ROWS_BUFFER_SIZE = 10000 };
33 public:
34  typedef ITERATOR iterator_class;
36 
37  Writer(const eckit::PathName& path);
38  Writer(eckit::DataHandle &, bool openDataHandle=true);
39  Writer(eckit::DataHandle *, bool openDataHandle=true, bool deleteDataHandle=false);
40  Writer();
41  virtual ~Writer();
42 
43  iterator begin(bool openDataHandle=true);
44 
45  eckit::DataHandle& dataHandle() { return *dataHandle_; }
46 
47  ITERATOR* createWriteIterator(eckit::PathName, bool append = false);
48 
49  unsigned long rowsBufferSize() { return rowsBufferSize_; }
50  Writer& rowsBufferSize(unsigned long n) { rowsBufferSize_ = n; }
51 
52  const eckit::PathName path() { return path_; }
53 
54 private:
55 // No copy allowed
56  Writer(const Writer&);
58 
59  const eckit::PathName path_;
60  eckit::DataHandle* dataHandle_;
61  unsigned long rowsBufferSize_;
62 
65 };
66 
67 } // namespace odc
68 
69 #endif
Writer & rowsBufferSize(unsigned long n)
Definition: Writer.h:50
ITERATOR iterator_class
Definition: Writer.h:34
IteratorProxy< ITERATOR, Writer > iterator
Definition: Writer.h:35
bool deleteDataHandle_
Definition: Writer.h:64
Writer & operator=(const Writer &)
virtual ~Writer()
Definition: Writer.cc:89
bool openDataHandle_
Definition: Writer.h:63
eckit::DataHandle & dataHandle()
Definition: Writer.h:45
const eckit::PathName path_
Definition: Writer.h:59
iterator begin(bool openDataHandle=true)
Definition: Writer.cc:92
unsigned long rowsBufferSize_
Definition: Writer.h:61
const eckit::PathName path()
Definition: Writer.h:52
eckit::DataHandle * dataHandle_
Definition: Writer.h:60
ITERATOR * createWriteIterator(eckit::PathName, bool append=false)
Definition: Writer.cc:108
unsigned long rowsBufferSize()
Definition: Writer.h:49
@ DEFAULT_ROWS_BUFFER_SIZE
Definition: Writer.h:32
Writer(const Writer &)
Definition: ColumnInfo.h:23
WriterBufferingIterator DefaultWritingIterator
Definition: Writer.h:27