NetCDF-C++ 4.3.2
Loading...
Searching...
No Matches
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
29
37
38
40 NcFile();
41
47
48 NcFile(const std::string& filePath, const int ncFileFlags);
49
50
60 NcFile(const std::string& filePath, const FileMode fMode);
61
67 void create(const std::string& filePath, const int ncFileFlags);
68
74 void open(const std::string& filePath, int ncFileFlags);
75
76
86 void open(const std::string& filePath, const FileMode fMode);
87
95 NcFile(const std::string& filePath, const FileMode fMode, const FileFormat fFormat);
103 void open(const std::string& filePath, const FileMode fMode, const 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 std::string getPath() const;
124
125
126 private:
127 /* Do not allow definition of NcFile involving copying any NcFile or NcGroup.
128 Because the destructor closes the file and releases al resources such
129 an action could leave NcFile objects in an invalid state */
130 NcFile& operator =(const NcGroup & rhs);
131 NcFile& operator =(const NcFile & rhs);
132 NcFile(const NcGroup& rhs);
133 NcFile(const NcFile& rhs);
134 };
135
136}
137
138
139#endif
NcFile()
Constructor generates a null object.
Definition ncFile.cpp:39
void sync()
Synchronize an open netcdf dataset to disk.
Definition ncFile.cpp:161
void enddef()
Leave define mode, used for classic model.
Definition ncFile.cpp:176
void set_Fill(int fillmode, int *old_modep)
Elect a fill parameter different that the one currently being used.
Definition ncFile.cpp:165
NcFile(const std::string &filePath, const FileMode fMode)
Opens a netCDF file.
void create(const std::string &filePath, const int ncFileFlags)
Create a netCDF file.
Definition ncFile.cpp:110
void open(const std::string &filePath, const FileMode fMode, const FileFormat fFormat)
Creates a netCDF file of a specified format.
@ 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 close()
Close a file before destructor call.
Definition ncFile.cpp:29
NcFile(const std::string &filePath, const FileMode fMode, const FileFormat fFormat)
Creates a netCDF file of a specified format.
void redef()
Redefine variable.
Definition ncFile.cpp:171
@ 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
void open(const std::string &filePath, const FileMode fMode)
Opens a netCDF file.
NcFile(const std::string &filePath, const int ncFileFlags)
Opens a netCDF file.
NcGroup()
Constructor generates a null object.
Definition ncGroup.cpp:52
C++ API for netCDF4.
Definition ncAtt.h:10

Return to the Main Unidata NetCDF page.
Generated on for NetCDF-C++. NetCDF is a Unidata library.