NetCDF-C++  4.3.1-developer
ncFile.h
1 #include <string>
2 #include "ncGroup.h"
3 #include "netcdf.h"
4 
5 #ifndef NcFileClass
6 #define NcFileClass
7 
8 
10 namespace netCDF
11 {
12 
18  class NcFile : public NcGroup
19  {
20  public:
21 
22  enum FileMode
23  {
24  read,
28  };
29 
31  {
34  nc4,
36  };
37 
38 
40  NcFile();
41 
51  NcFile(const std::string& filePath, FileMode fMode);
61  void open(const std::string& filePath, FileMode fMode);
62 
70  NcFile(const std::string& filePath, FileMode fMode, FileFormat fFormat);
78  void open(const std::string& filePath, FileMode fMode, FileFormat fFormat);
79 
81  void close();
82 
84  virtual ~NcFile(); //closes file and releases all resources
85 
87  void sync();
88 
90  void enddef();
91 
92  private:
93  /* Do not allow definition of NcFile involving copying any NcFile or NcGroup.
94  Because the destructor closes the file and releases al resources such
95  an action could leave NcFile objects in an invalid state */
96  NcFile& operator =(const NcGroup & rhs);
97  NcFile& operator =(const NcFile & rhs);
98  NcFile(const NcGroup& rhs);
99  NcFile(const NcFile& rhs);
100  };
101 
102 }
103 
104 
105 #endif
netCDF-4/HDF5 format, classic data model
Definition: ncFile.h:35
File exists, open for writing.
Definition: ncFile.h:25
C++ API for netCDF4.
Definition: ncAtt.h:9
void open(const std::string &filePath, FileMode fMode)
Opens a netCDF file.
64-bit offset format, classic data model
Definition: ncFile.h:33
void enddef()
Leave define mode, used for classic model.
Definition: ncFile.cpp:131
NcFile()
Constructor generates a null object.
Definition: ncFile.cpp:41
virtual ~NcFile()
destructor
Definition: ncFile.cpp:15
Class represents a netCDF group.
Definition: ncGroup.h:27
Create new file, fail if already exists.
Definition: ncFile.h:27
Classic format, classic data model.
Definition: ncFile.h:32
void sync()
Synchronize an open netcdf dataset to disk.
Definition: ncFile.cpp:126
void close()
Close a file before destructor call.
Definition: ncFile.cpp:30
(default) netCDF-4/HDF5 format, enhanced data model
Definition: ncFile.h:34
File exists, open read-only.
Definition: ncFile.h:24
Create new file, even if already exists.
Definition: ncFile.h:26
Class represents a netCDF root group.
Definition: ncFile.h:18

Return to the Main Unidata NetCDF page.
Generated on Fri Nov 11 2016 15:28:29 for NetCDF-C++. NetCDF is a Unidata library.