File: ncOpaqueType.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 (68 lines) | stat: -rw-r--r-- 1,643 bytes parent folder | download | duplicates (5)
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
#include "ncOpaqueType.h"
#include "ncGroup.h"
#include "ncCheck.h"
#include "ncException.h"
#include <netcdf.h>
using namespace std;
using namespace netCDF;
using namespace netCDF::exceptions;

// Class represents a netCDF variable.
using namespace netCDF;
  
// assignment operator
NcOpaqueType& NcOpaqueType::operator=(const NcOpaqueType& rhs)
{
  // assign base class parts
  NcType::operator=(rhs);    
  return *this;
}
  
// assignment operator
NcOpaqueType& NcOpaqueType::operator=(const NcType& rhs)
{
  if (&rhs != this) {
    // check the rhs is the base of an Opaque type
    if(getTypeClass() != NC_OPAQUE) 	throw NcException("The NcType object must be the base of an Opaque type.",__FILE__,__LINE__);
    // assign base class parts
    NcType::operator=(rhs);
  }
  return *this;
}

// The copy constructor.
NcOpaqueType::NcOpaqueType(const NcOpaqueType& rhs): 
  NcType(rhs)
{
}


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


// constructor
NcOpaqueType::NcOpaqueType(const NcGroup& grp, const string& name) :
  NcType(grp,name)
{}
  
  
// constructor
NcOpaqueType::NcOpaqueType(const NcType& ncType) :
  NcType(ncType)
{
  // check the nctype object is the base of a Opaque type
  if(getTypeClass() != NC_OPAQUE) 	throw NcException("The NcType object must be the base of an Opaque type.",__FILE__,__LINE__);
}
  
// Returns the size of the opaque type in bytes.
size_t  NcOpaqueType::getTypeSize() const
{
  char* charName;
  charName=NULL;
  size_t sizep;
  ncCheck(nc_inq_opaque(groupId,myId,charName,&sizep),__FILE__,__LINE__);
  return sizep;
}