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