NetCDF-C++
4.3.2
Toggle main menu visibility
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>
6
using namespace
std;
7
using namespace
netCDF
;
8
using namespace
netCDF::exceptions
;
9
10
// Class represents a netCDF variable.
11
using namespace
netCDF
;
12
13
// assignment operator
14
NcOpaqueType
&
NcOpaqueType::operator=
(
const
NcOpaqueType
& rhs)
15
{
16
// assign base class parts
17
NcType::operator=
(rhs);
18
return
*
this
;
19
}
20
21
// assignment operator
22
NcOpaqueType
&
NcOpaqueType::operator=
(
const
NcType
& rhs)
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
28
NcType::operator=
(rhs);
29
}
30
return
*
this
;
31
}
32
33
// The copy constructor.
34
NcOpaqueType::NcOpaqueType
(
const
NcOpaqueType
& rhs):
35
NcType
(rhs)
36
{
37
}
38
39
40
// Constructor generates a null object.
41
NcOpaqueType::NcOpaqueType
() :
42
NcType
()
// invoke base class constructor
43
{}
44
45
46
// constructor
47
NcOpaqueType::NcOpaqueType
(
const
NcGroup
& grp,
const
string
& name) :
48
NcType
(grp,name)
49
{}
50
51
52
// constructor
53
NcOpaqueType::NcOpaqueType
(
const
NcType
&
ncType
) :
54
NcType
(
ncType
)
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.
61
size_t
NcOpaqueType::getTypeSize
()
const
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
}
netCDF::NcGroup
Class represents a netCDF group.
Definition
ncGroup.h:26
netCDF::NcOpaqueType::operator=
NcOpaqueType & operator=(const NcOpaqueType &rhs)
assignment operator
Definition
ncOpaqueType.cpp:14
netCDF::NcOpaqueType::getTypeSize
size_t getTypeSize() const
Returns the size of the opaque type in bytes.
Definition
ncOpaqueType.cpp:61
netCDF::NcOpaqueType::NcOpaqueType
NcOpaqueType()
Constructor generates a null object.
Definition
ncOpaqueType.cpp:41
netCDF::NcType
Base class inherited by NcOpaque, NcVlen, NcCompound and NcEnum classes.
Definition
ncType.h:15
netCDF::NcType::groupId
int groupId
the group Id
Definition
ncType.h:155
netCDF::NcType::getTypeClass
ncType getTypeClass() const
The type class returned as enumeration type.
Definition
ncType.cpp:111
netCDF::NcType::NcType
NcType()
Constructor generates a null object.
Definition
ncType.cpp:43
netCDF::NcType::myId
nc_type myId
the type Id
Definition
ncType.h:152
netCDF::NcType::operator=
NcType & operator=(const NcType &rhs)
assignment operator
Definition
ncType.cpp:26
netCDF::NcType::ncType
ncType
List of netCDF types that can be represented.
Definition
ncType.h:26
netCDF::exceptions::NcException
Base object is thrown if a netCDF exception is encountered.
Definition
ncException.h:24
netCDF::exceptions
Exception classes.
Definition
ncException.h:16
netCDF
C++ API for netCDF4.
Definition
ncAtt.h:10
netCDF::ncCheck
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.