NetCDF-C++ 4.3.2
Loading...
Searching...
No Matches
ncGroupAtt.cpp
1#include "ncGroupAtt.h"
2#include "ncGroup.h"
3#include "ncCheck.h"
4#include <netcdf.h>
5using namespace std;
6
7
8namespace netCDF {
9 // Global comparator operator ==============
10 // comparator operator
11 bool operator<(const NcGroupAtt& lhs,const NcGroupAtt& rhs)
12 {
13 return false;
14 }
15
16 // comparator operator
17 bool operator>(const NcGroupAtt& lhs,const NcGroupAtt& rhs)
18 {
19 return true;
20 }
21}
22
23
24using namespace netCDF;
25
26// assignment operator
28{
29 NcAtt::operator=(rhs); // assign base class parts
30 return *this;
31}
32
35 NcAtt(rhs) // invoke base class copy constructor
36{}
37
38
39// Constructor generates a null object.
41 NcAtt() // invoke base class constructor
42{}
43
44// equivalence operator (doesn't bother compaing varid's of each object).
46{
47 if(nullObject)
48 return nullObject == rhs.isNull();
49 else
50 return myName == rhs.myName && groupId == rhs.groupId;
51}
52
53// Constructor for an existing global attribute.
54NcGroupAtt::NcGroupAtt(const NcGroup& grp, const int index):
55 NcAtt(false)
56{
57 groupId = grp.getId();
58 varId = NC_GLOBAL;
59 // get the name of this attribute
60 char attName[NC_MAX_NAME+1];
61 ncCheck(nc_inq_attname(groupId,varId, index, attName),__FILE__,__LINE__);
62 ncCheck(nc_inq_attname(groupId,varId,index,attName),__FILE__,__LINE__);
63 myName = attName;
64}
65
NcAtt & operator=(const NcAtt &rhs)
assignment operator
Definition ncAtt.cpp:14
NcAtt()
Constructor generates a null object.
Definition ncAtt.cpp:24
bool isNull() const
Returns true if this object is null (i.e.
Definition ncAtt.h:103
NcGroupAtt & operator=(const NcGroupAtt &rhs)
assignment operator
bool operator==(const NcGroupAtt &rhs)
equivalence operator
friend bool operator<(const NcGroupAtt &lhs, const NcGroupAtt &rhs)
comparator operator
friend bool operator>(const NcGroupAtt &lhs, const NcGroupAtt &rhs)
comparator operator
NcGroupAtt()
Constructor generates a null object.
Class represents a netCDF group.
Definition ncGroup.h:26
int getId() const
Gets the group id.
Definition ncGroup.cpp:144
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.