NetCDF-C++ 4.3.2
Loading...
Searching...
No Matches
ncOpaqueType.cpp
1#include "ncOpaqueType.h"
2#include "ncGroup.h"
3#include "ncCheck.h"
4#include "ncException.h"
5#include <netcdf.h>
6using namespace std;
7using namespace netCDF;
8using namespace netCDF::exceptions;
9
10// Class represents a netCDF variable.
11using namespace netCDF;
12
13// assignment operator
15{
16 // assign base class parts
18 return *this;
19}
20
21// assignment operator
23{
24 if (&rhs != this) {
25 // check the rhs is the base of an Opaque type
26 if(getTypeClass() != NC_OPAQUE) throw NcException("The NcType object must be the base of an Opaque type.",__FILE__,__LINE__);
27 // assign base class parts
29 }
30 return *this;
31}
32
33// The copy constructor.
35 NcType(rhs)
36{
37}
38
39
40// Constructor generates a null object.
42 NcType() // invoke base class constructor
43{}
44
45
46// constructor
47NcOpaqueType::NcOpaqueType(const NcGroup& grp, const string& name) :
48 NcType(grp,name)
49{}
50
51
52// constructor
55{
56 // check the nctype object is the base of a Opaque type
57 if(getTypeClass() != NC_OPAQUE) throw NcException("The NcType object must be the base of an Opaque type.",__FILE__,__LINE__);
58}
59
60// Returns the size of the opaque type in bytes.
62{
63 char* charName;
64 charName=NULL;
65 size_t sizep;
66 ncCheck(nc_inq_opaque(groupId,myId,charName,&sizep),__FILE__,__LINE__);
67 return sizep;
68}
Class represents a netCDF group.
Definition ncGroup.h:26
NcOpaqueType & operator=(const NcOpaqueType &rhs)
assignment operator
size_t getTypeSize() const
Returns the size of the opaque type in bytes.
NcOpaqueType()
Constructor generates a null object.
Base class inherited by NcOpaque, NcVlen, NcCompound and NcEnum classes.
Definition ncType.h:15
int groupId
the group Id
Definition ncType.h:155
ncType getTypeClass() const
The type class returned as enumeration type.
Definition ncType.cpp:111
NcType()
Constructor generates a null object.
Definition ncType.cpp:43
nc_type myId
the type Id
Definition ncType.h:152
NcType & operator=(const NcType &rhs)
assignment operator
Definition ncType.cpp:26
ncType
List of netCDF types that can be represented.
Definition ncType.h:26
Base object is thrown if a netCDF exception is encountered.
Definition ncException.h:24
Exception classes.
Definition ncException.h:16
C++ API for netCDF4.
Definition ncAtt.h:10
void ncCheck(int retCode, const char *file, int line)
Function checks error code and if necessary throws an exception.
Definition ncCheck.cpp:11

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