NetCDF-C++ 4.3.1
ncFile.h
1#include <string>
2#include "ncGroup.h"
3#include "netcdf.h"
4
5#ifndef NcFileClass
6#define NcFileClass
7
8
10namespace netCDF
11{
12
18 class NcFile : public NcGroup
19 {
20 public:
21
23 {
27 newFile
28 };
29
31 {
36 };
37
38
40 NcFile();
41
48 NcFile(const std::string& filePath, int ncFileFlags);
49
50
60 NcFile(const std::string& filePath, FileMode fMode);
61
67 void create(const std::string& filePath, int ncFileFlags);
68
74 void open(const std::string& filePath, int ncFileFlags);
75
76
86 void open(const std::string& filePath, FileMode fMode);
87
95 NcFile(const std::string& filePath, FileMode fMode, FileFormat fFormat);
103 void open(const std::string& filePath, FileMode fMode, FileFormat fFormat);
104
106 void close();
107
109 virtual ~NcFile(); //closes file and releases all resources
110
112 void sync();
113
115 void set_Fill(int fillmode, int *old_modep);
116
118 void redef();
119
121 void enddef();
122
123
124 private:
125 /* Do not allow definition of NcFile involving copying any NcFile or NcGroup.
126 Because the destructor closes the file and releases al resources such
127 an action could leave NcFile objects in an invalid state */
128 NcFile& operator =(const NcGroup & rhs);
129 NcFile& operator =(const NcFile & rhs);
130 NcFile(const NcGroup& rhs);
131 NcFile(const NcFile& rhs);
132 };
133
134}
135
136
137#endif
Class represents a netCDF root group.
Definition: ncFile.h:19
NcFile()
Constructor generates a null object.
Definition: ncFile.cpp:41
NcFile(const std::string &filePath, int ncFileFlags)
Opens a netCDF file.
void sync()
Synchronize an open netcdf dataset to disk.
Definition: ncFile.cpp:167
void enddef()
Leave define mode, used for classic model.
Definition: ncFile.cpp:182
void open(const std::string &filePath, FileMode fMode)
Opens a netCDF file.
void set_Fill(int fillmode, int *old_modep)
Elect a fill parameter different that the one currently being used.
Definition: ncFile.cpp:171
NcFile(const std::string &filePath, FileMode fMode)
Opens a netCDF file.
@ newFile
Create new file, fail if already exists.
Definition: ncFile.h:27
@ read
File exists, open read-only.
Definition: ncFile.h:24
@ write
File exists, open for writing.
Definition: ncFile.h:25
@ replace
Create new file, even if already exists.
Definition: ncFile.h:26
void open(const std::string &filePath, int ncFileFlags)
Opens a netCDF file.
void open(const std::string &filePath, FileMode fMode, FileFormat fFormat)
Creates a netCDF file of a specified format.
void close()
Close a file before destructor call.
Definition: ncFile.cpp:30
void create(const std::string &filePath, int ncFileFlags)
Create a netCDF file.
Definition: ncFile.cpp:114
NcFile(const std::string &filePath, FileMode fMode, FileFormat fFormat)
Creates a netCDF file of a specified format.
virtual ~NcFile()
destructor
Definition: ncFile.cpp:15
void redef()
Redefine variable.
Definition: ncFile.cpp:177
@ classic
Classic format, classic data model.
Definition: ncFile.h:32
@ classic64
64-bit offset format, classic data model
Definition: ncFile.h:33
@ nc4
(default) netCDF-4/HDF5 format, enhanced data model
Definition: ncFile.h:34
@ nc4classic
netCDF-4/HDF5 format, classic data model
Definition: ncFile.h:35
Class represents a netCDF group.
Definition: ncGroup.h:28
C++ API for netCDF4.
Definition: ncAtt.h:10

Return to the Main Unidata NetCDF page.
Generated on Wed Nov 10 2021 15:25:08 for NetCDF-C++. NetCDF is a Unidata library.