File: ncVarAtt.cpp

package info (click to toggle)
netcdf-cxx 4.3.1-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,456 kB
  • sloc: cpp: 8,506; sh: 4,548; ansic: 4,251; xml: 173; makefile: 145
file content (70 lines) | stat: -rw-r--r-- 1,546 bytes parent folder | download | duplicates (3)
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
66
67
68
69
70
#include "ncVar.h"
#include "ncVarAtt.h"
#include "ncGroup.h"
#include "ncCheck.h"
#include <netcdf.h>
using namespace std;


namespace netCDF {
  //  Global comparator operator ==============
  // comparator operator
  bool operator<(const NcVarAtt& lhs,const NcVarAtt& rhs)
  {
    return false;
  }

  // comparator operator
  bool operator>(const NcVarAtt& lhs,const NcVarAtt& rhs)
  {
    return true;
  }
}


using namespace netCDF;


// assignment operator
NcVarAtt& NcVarAtt::operator=(const NcVarAtt & rhs)
{
  NcAtt::operator=(rhs);    // assign base class parts
  return *this;
}

//! The copy constructor.
NcVarAtt::NcVarAtt(const NcVarAtt& rhs):
  NcAtt(rhs) // invoke base class copy constructor
{}


// Constructor generates a null object.
NcVarAtt::NcVarAtt() :
  NcAtt()  // invoke base class constructor
{}


// Constructor for an existing local attribute.
NcVarAtt::NcVarAtt(const NcGroup& grp, const NcVar& ncVar, const int index):
  NcAtt(false)
{
  groupId =  grp.getId();
  varId = ncVar.getId();
  // 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;
}

// Query a variable attribute type
void NcVarAtt::inq_atttype(const char *name, nc_type *xtypep)
{
  ncCheck(nc_inq_atttype(groupId, varId, name, xtypep),__FILE__,__LINE__);
}


// Returns the NcVar parent object.
NcVar NcVarAtt::getParentVar() const {
  return NcVar(groupId,varId);
}