/usr/include/ncVar.h is in libnetcdf-c++4-dev 4.3.0+ds-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 | #include <exception>
#include <string>
#include <typeinfo>
#include <map>
#include <vector>
#include "netcdf.h"
#include "ncVarAtt.h"
#include "ncGroup.h"
#include "ncByte.h"
#include "ncUbyte.h"
#include "ncChar.h"
#include "ncShort.h"
#include "ncUshort.h"
#include "ncInt.h"
#include "ncUint.h"
#include "ncInt64.h"
#include "ncUint64.h"
#include "ncFloat.h"
#include "ncDouble.h"
#include "ncString.h"
#ifndef NcVarClass
#define NcVarClass
namespace netCDF
{
// class NcGroup; // forward declaration.
class NcDim; // forward declaration.
// class NcVarAtt; // forward declaration.
class NcType; // forward declaration.
/*! Class represents a netCDF variable. */
class NcVar
{
public:
/*! Used for chunking specifications (see NcVar::setChunking, NcVar::getChunkingParameters). */
enum ChunkMode
{
/*!
Chunked storage is used for this variable.
*/
nc_CHUNKED = NC_CHUNKED,
/*! Contiguous storage is used for this variable. Variables with one or more unlimited
dimensions cannot use contiguous storage. If contiguous storage is turned on, the
chunkSizes parameter is ignored.
*/
nc_CONTIGUOUS = NC_CONTIGUOUS
};
/*!
Used to specifying the endianess of the data, (see NcVar::setEndianness, NcVar::getEndianness). By default this is NC_ENDIAN_NATIVE.
*/
enum EndianMode
{
nc_ENDIAN_NATIVE = NC_ENDIAN_NATIVE, //!< Native endian.
nc_ENDIAN_LITTLE = NC_ENDIAN_LITTLE, //!< Little endian.
nc_ENDIAN_BIG = NC_ENDIAN_BIG //!< Big endian.
};
/*! Used for checksum specification (see NcVar::setChecksum, NcVar::getChecksum). */
enum ChecksumMode
{
nc_NOCHECKSUM = NC_NOCHECKSUM, //!< No checksum (the default).
nc_FLETCHER32 = NC_FLETCHER32 //!< Selects the Fletcher32 checksum filter.
};
/*! destructor */
~NcVar(){};
/*! Constructor generates a \ref isNull "null object". */
NcVar ();
/*! Constructor for a variable .
The variable must already exist in the netCDF file. New netCDF variables can be added using NcGroup::addNcVar();
\param grp Parent NcGroup object.
\param varId Id of the is NcVar object.
*/
NcVar (const NcGroup& grp, const int& varId);
/*! assignment operator */
NcVar& operator =(const NcVar& rhs);
/*! equivalence operator */
bool operator==(const NcVar& rhs) const;
/*! != operator */
bool operator!=(const NcVar& rhs) const;
/*! The copy constructor. */
NcVar(const NcVar& ncVar);
/*! Name of this NcVar object.*/
std::string getName() const;
/*! Gets parent group. */
NcGroup getParentGroup() const;
/*! Returns the variable type. */
NcType getType() const;
/*! Rename the variable. */
void rename( const std::string& newname ) const;
/*! Get the variable id. */
int getId() const;
/*! Returns true if this object variable is not defined. */
bool isNull() const {return nullObject;}
/*! comparator operator */
friend bool operator<(const NcVar& lhs,const NcVar& rhs);
/*! comparator operator */
friend bool operator>(const NcVar& lhs,const NcVar& rhs);
/////////////////
// Information about Dimensions
/////////////////
/*! The the number of dimensions. */
int getDimCount() const ;
/*! Gets the i'th NcDim object. */
NcDim getDim(int i) const;
/*! Gets the set of NcDim objects. */
std::vector<NcDim> getDims() const;
/////////////////
// Information about Attributes
/////////////////
/*! Gets the number of attributes. */
int getAttCount() const;
/*! Gets attribute by name */
NcVarAtt getAtt(const std::string& name) const;
/*! Gets the set of attributes. */
std::map<std::string,NcVarAtt> getAtts() const;
/////////////////////////
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, size_t len, const char** dataValues) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const std::string& dataValues) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, size_t len, const unsigned char* dataValues) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, size_t len, const signed char* dataValues) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, short datumValue) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, int datumValue) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, long datumValue) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, float datumValue) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, double datumValue) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, unsigned short datumValue) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, unsigned int datumValue) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, unsigned long long datumValue) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, long long datumValue) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, size_t len, const short* dataValues) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, size_t len, const int* dataValues) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, size_t len, const long* dataValues) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, size_t len, const float* dataValues) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, size_t len, const double* dataValues) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, size_t len, const unsigned short* dataValues) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, size_t len, const unsigned int* dataValues) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, size_t len, const unsigned long long* dataValues) const ;
/*! \overload
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, size_t len, const long long* dataValues) const ;
/*!
Creates a new variable attribute or if already exisiting replaces it.
If you are writing a _Fill_Value_ attribute, and will tell the HDF5 layer to use
the specified fill value for that variable.
\par
Although it's possible to create attributes of all types, text and double attributes are adequate for most purposes.
\param name Name of attribute.
\param type The attribute type.
\param len The length of the attribute (number of Nctype repeats).
\param dataValues Data Values to put into the new attribute.
If the type of data values differs from the netCDF variable type, type conversion will occur.
(However, no type conversion is carried out for variables using the user-defined data types:
nc_Vlen, nc_Opaque, nc_Compound and nc_Enum.)
\return The NcVarAtt object for this new netCDF attribute.
*/
NcVarAtt putAtt(const std::string& name, const NcType& type, size_t len, const void* dataValues) const ;
////////////////////
// Chunking details
////////////////////
/*! Sets chunking parameters.
\param chunkMode Enumeration type. Allowable parameters are: "nc_CONTIGUOUS", "nc_CHUNKED"
\param chunksizes Shape of chunking, used if ChunkMode=nc_CHUNKED.
*/
void setChunking(ChunkMode chunkMode, std::vector<size_t>& chunksizes) const;
/*! Gets the chunking parameters
\param chunkMode On return contains either: "nc_CONTIGUOUS" or "nc_CHUNKED"
\param chunksizes On return contains shape of chunking, used if ChunkMode=nc_CHUNKED.
*/
void getChunkingParameters(ChunkMode& chunkMode, std::vector<size_t>& chunkSizes) const;
////////////////////
// Fill details
////////////////////
// Sets the fill parameters
/*!
\overload
*/
void setFill(bool fillMode,void* fillValue=NULL) const;
/*!
This is an overloaded member function, provided for convenience.
It differs from the above function in what argument(s) it accepts.
The function can be used for any type, including user-defined types.
\param fillMode Setting to true, turns on fill mode.
\param fillValue Pointer to fill value.
Must be the same type as the variable. Ignored if fillMode=.false.
*/
void setFill(bool fillMode,const void* fillValue=NULL) const;
/*! Sets the fill parameters
\param fillMode Setting to true, turns on fill mode.
\param fillValue Fill value for the variable.
Must be the same type as the variable. Ignored if fillMode=.false.
*/
template<class T>
void setFill(bool fillMode, T fillValue) const
{
ncCheck(nc_def_var_fill(groupId,myId,static_cast<int> (!fillMode),&fillValue),__FILE__,__LINE__);
}
/*!
This is an overloaded member function, provided for convenience.
It differs from the above function in what argument(s) it accepts.
The function can be used for any type, including user-defined types.
\param fillMode On return set to true if fill mode is enabled.
\param fillValue On return containts a pointer to fill value.
Must be the same type as the variable. Ignored if fillMode=.false.
*/
void getFillModeParameters(bool& fillMode, void* fillValue=NULL) const;
/*! Gets the fill parameters
\param On return set to true if fill mode is enabled.
\param On return is set to the fill value.
*/
template <class T> void getFillModeParameters(bool& fillMode,T& fillValue) const{
int fillModeInt;
ncCheck(nc_inq_var_fill(groupId,myId,&fillModeInt,&fillValue),__FILE__,__LINE__);
fillMode= static_cast<bool> (fillModeInt == 0);
}
////////////////////
// Compression details
////////////////////
/*! Sets the compression parameters
\param enableShuffleFilter Set to true to turn on shuffle filter.
\param enableDeflateFilter Set to true to turn on deflate filter.
\param deflateLevel The deflate level, must be 0 and 9.
*/
void setCompression(bool enableShuffleFilter, bool enableDeflateFilter, int deflateLevel) const;
/*! Gets the compression parameters
\param enableShuffleFilter On return set to true if the shuffle filter is enabled.
\param enableDeflateFilter On return set to true if the deflate filter is enabled.
\param deflateLevel On return set to the deflate level.
*/
void getCompressionParameters(bool& shuffleFilterEnabled, bool& deflateFilterEnabled, int& deflateLevel) const;
////////////////////
// Endianness details
////////////////////
/*! Sets the endianness of the variable.
\param Endianness enumeration type. Allowable parameters are: "nc_ENDIAN_NATIVE" (the default), "nc_ENDIAN_LITTLE", "nc_ENDIAN_BIG"
*/
void setEndianness(EndianMode endianMode) const;
/*! Gets the endianness of the variable.
\return Endianness enumeration type. Allowable parameters are: "nc_ENDIAN_NATIVE" (the default), "nc_ENDIAN_LITTLE", "nc_ENDIAN_BIG"
*/
EndianMode getEndianness() const;
////////////////////
// Checksum details
////////////////////
/*! Sets the checksum parameters of a variable.
\param ChecksumMode Enumeration type. Allowable parameters are: "nc_NOCHECKSUM", "nc_FLETCHER32".
*/
void setChecksum(ChecksumMode checksumMode) const;
/*! Gets the checksum parameters of the variable.
\return ChecksumMode Enumeration type. Allowable parameters are: "nc_NOCHECKSUM", "nc_FLETCHER32".
*/
ChecksumMode getChecksum() const;
////////////////////
// data reading
////////////////////
// Reads the entire data into the netCDF variable.
/*!
This is an overloaded member function, provided for convenience.
It differs from the above function in what argument(s) it accepts.
In addition, no data conversion is carried out. This means that
the type of the data in memory must match the type of the variable.
*/
void getVar(void* dataValues) const;
/*! \overload
*/
void getVar(char** dataValues) const;
/*! \overload
*/
void getVar(char* dataValues) const;
/*! \overload
*/
void getVar(unsigned char* dataValues) const;
/*! \overload
*/
void getVar(signed char* dataValues) const;
/*! \overload
*/
void getVar(short* dataValues) const;
/*! \overload
*/
void getVar(int* dataValues) const;
/*! \overload
*/
void getVar(long* dataValues) const;
/*! \overload
*/
void getVar(float* dataValues) const;
/*! \overload
*/
void getVar(double* dataValues) const;
/*! \overload
*/
void getVar(unsigned short* dataValues) const;
/*! \overload
*/
void getVar(unsigned int* dataValues) const;
/*! \overload
*/
void getVar(unsigned long long* dataValues) const;
/*!
Reads the entire data from an netCDF variable.
This is the simplest interface to use for reading the value of a scalar variable
or when all the values of a multidimensional variable can be read at once. The values
are read into consecutive locations with the last dimension varying fastest.
Take care when using the simplest forms of this interface with record variables when you
don't specify how many records are to be read. If you try to read all the values of a
record variable into an array but there are more records in the file than you assume,
more data will be read than you expect, which may cause a segmentation violation.
\param dataValues Pointer to the location into which the data value is read. If the type of
data value differs from the netCDF variable type, type conversion will occur.
(However, no type conversion is carried out for variables using the user-defined data types:
nc_Vlen, nc_Opaque, nc_Compound and nc_Enum.)
*/
void getVar(long long* dataValues) const;
//////////////////////
// Reads a single datum value from a variable of an open netCDF dataset.
/*!
This is an overloaded member function, provided for convenience.
It differs from the above function in what argument(s) it accepts.
In addition, no data conversion is carried out. This means that
the type of the data in memory must match the type of the variable.
*/
void getVar(const std::vector<size_t>& index, void* datumValue) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& index, char** datumValue) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& index, char* datumValue) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& index, unsigned char* datumValue) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& index, signed char* datumValue) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& index, short* datumValue) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& index, int* datumValue) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& index, long* datumValue) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& index, float* datumValue) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& index, double* datumValue) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& index, unsigned short* datumValue) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& index, unsigned int* datumValue) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& index, unsigned long long* datumValue) const;
/*! Reads a single datum value from a variable of an open netCDF dataset.
The value is converted from the external data type of the variable, if necessary.
\param index Vector specifying the index of the data value to be read.
The indices are relative to 0, so for example, the first data value of a two-dimensional
variable would have index (0,0). The elements of index must correspond to the variable's dimensions.
Hence, if the variable is a record variable, the first index is the record number.
\param datumValue Pointer to the location into which the data value is read. If the type of
data value differs from the netCDF variable type, type conversion will occur.
(However, no type conversion is carried out for variables using the user-defined data types:
nc_Vlen, nc_Opaque, nc_Compound and nc_Enum.)
*/
void getVar(const std::vector<size_t>& index, long long* datumValue) const;
//////////////////////
// Reads an array of values from a netCDF variable of an open netCDF dataset.
/*!
This is an overloaded member function, provided for convenience.
It differs from the above function in what argument(s) it accepts.
In addition, no data conversion is carried out. This means that
the type of the data in memory must match the type of the variable.
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, void* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, char** dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, char* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, unsigned char* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, signed char* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, short* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, int* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, long* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, float* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, double* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, unsigned short* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, unsigned int* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, unsigned long long* dataValues) const;
/*!
Reads an array of values from a netCDF variable of an open netCDF dataset.
The array is specified by giving a corner and a vector of edge lengths.
The values are read into consecutive locations with the last dimension varying fastest.
\param start
Vector specifying the index in the variable where the first of the data values will be read.
The indices are relative to 0, so for example, the first data value of a variable would have index (0, 0, ... , 0).
The length of start must be the same as the number of dimensions of the specified variable.
The elements of start correspond, in order, to the variable's dimensions. Hence, if the variable is a record variable,
the first index would correspond to the starting record number for reading the data values.
\param count
Vector specifying the edge lengths along each dimension of the block of data values to be read.
To read a single value, for example, specify count as (1, 1, ... , 1). The length of count is the number of
dimensions of the specified variable. The elements of count correspond, in order, to the variable's dimensions.
Hence, if the variable is a record variable, the first element of count corresponds to a count of the number of records to read.
Note: setting any element of the count array to zero causes the function to exit without error, and without doing anything.
\param dataValues Pointer to the location into which the data value is read. If the type of
data value differs from the netCDF variable type, type conversion will occur.
(However, no type conversion is carried out for variables using the user-defined data types:
nc_Vlen, nc_Opaque, nc_Compound and nc_Enum.)
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, long long* dataValues) const;
//////////////////////
// Reads a subsampled (strided) array section of values from a netCDF variable.
/*!
This is an overloaded member function, provided for convenience.
It differs from the above function in what argument(s) it accepts.
In addition, no data conversion is carried out. This means that
the type of the data in memory must match the type of the variable.
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, void* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, char** dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, char* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, unsigned char* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, signed char* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, short* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, int* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, long* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, float* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, double* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, unsigned short* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, unsigned int* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, unsigned long long* dataValues) const;
/*!
Reads a subsampled (strided) array section of values from a netCDF variable.
The subsampled array section is specified by giving a corner, a vector of edge lengths, and a stride vector.
The values are read with the last dimension of the netCDF variable varying fastest.
\param start
Vector specifying the index in the variable where the first of the data values will be read.
The indices are relative to 0, so for example, the first data value of a variable would have index (0, 0, ... , 0).
The length of start must be the same as the number of dimensions of the specified variable.
The elements of start correspond, in order, to the variable's dimensions. Hence, if the variable is a record variable,
the first index would correspond to the starting record number for reading the data values.
\param count
Vector specifying the edge lengths along each dimension of the block of data values to be read.
To read a single value, for example, specify count as (1, 1, ... , 1). The length of count is the number of
dimensions of the specified variable. The elements of count correspond, in order, to the variable's dimensions.
Hence, if the variable is a record variable, the first element of count corresponds to a count of the number of records to read.
Note: setting any element of the count array to zero causes the function to exit without error, and without doing anything.
\param stride
Vector specifying the interval between selected indices. The elements of the stride vector correspond, in order,
to the variable's dimensions. A value of 1 accesses adjacent values of the netCDF variable in the corresponding
dimension; a value of 2 accesses every other value of the netCDF variable in the corresponding dimension; and so
on. A NULL stride argument is treated as (1, 1, ... , 1).
\param dataValues Pointer to the location into which the data value is read. If the type of
data value differs from the netCDF variable type, type conversion will occur.
(However, no type conversion is carried out for variables using the user-defined data types:
nc_Vlen, nc_Opaque, nc_Compound and nc_Enum.)
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, long long* dataValues) const;
//////////////////////
// Reads a mapped array section of values from a netCDF variable.
/*!
This is an overloaded member function, provided for convenience.
It differs from the above function in what argument(s) it accepts.
In addition, no data conversion is carried out. This means that
the type of the data in memory must match the type of the variable.
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, const std::vector<ptrdiff_t>& imap, void* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, const std::vector<ptrdiff_t>& imap, char** dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, const std::vector<ptrdiff_t>& imap, char* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, const std::vector<ptrdiff_t>& imap, unsigned char* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, const std::vector<ptrdiff_t>& imap, signed char* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, const std::vector<ptrdiff_t>& imap, short* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, const std::vector<ptrdiff_t>& imap, int* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, const std::vector<ptrdiff_t>& imap, long* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, const std::vector<ptrdiff_t>& imap, float* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, const std::vector<ptrdiff_t>& imap, double* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, const std::vector<ptrdiff_t>& imap, unsigned short* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, const std::vector<ptrdiff_t>& imap, unsigned int* dataValues) const;
/*! \overload
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, const std::vector<ptrdiff_t>& imap, unsigned long long* dataValues) const;
/*!
Reads a mapped array section of values from a netCDF variable.
The mapped array section is specified by giving a corner, a vector of edge lengths, a stride vector, and an
index mapping vector. The index mapping vector is a vector of integers that specifies the mapping between the
dimensions of a netCDF variable and the in-memory structure of the internal data array. No assumptions are
made about the ordering or length of the dimensions of the data array.
\param start
Vector specifying the index in the variable where the first of the data values will be read.
The indices are relative to 0, so for example, the first data value of a variable would have index (0, 0, ... , 0).
The length of start must be the same as the number of dimensions of the specified variable.
The elements of start correspond, in order, to the variable's dimensions. Hence, if the variable is a record variable,
the first index would correspond to the starting record number for reading the data values.
\param count
Vector specifying the edge lengths along each dimension of the block of data values to be read.
To read a single value, for example, specify count as (1, 1, ... , 1). The length of count is the number of
dimensions of the specified variable. The elements of count correspond, in order, to the variable's dimensions.
Hence, if the variable is a record variable, the first element of count corresponds to a count of the number of records to read.
Note: setting any element of the count array to zero causes the function to exit without error, and without doing anything.
\param stride
Vector specifying the interval between selected indices. The elements of the stride vector correspond, in order,
to the variable's dimensions. A value of 1 accesses adjacent values of the netCDF variable in the corresponding
dimension; a value of 2 accesses every other value of the netCDF variable in the corresponding dimension; and so
on. A NULL stride argument is treated as (1, 1, ... , 1).
\param imap
Vector of integers that specifies the mapping between the dimensions of a netCDF variable and the in-memory
structure of the internal data array. imap[0] gives the distance between elements of the internal array corresponding
to the most slowly varying dimension of the netCDF variable. imap[n-1] (where n is the rank of the netCDF variable)
gives the distance between elements of the internal array corresponding to the most rapidly varying dimension of the
netCDF variable. Intervening imap elements correspond to other dimensions of the netCDF variable in the obvious way.
Distances between elements are specified in type-independent units of elements (the distance between internal elements
that occupy adjacent memory locations is 1 and not the element's byte-length as in netCDF 2).
\param dataValues Pointer to the location into which the data value is read. If the type of
data value differs from the netCDF variable type, type conversion will occur.
(However, no type conversion is carried out for variables using the user-defined data types:
nc_Vlen, nc_Opaque, nc_Compound and nc_Enum.)
*/
void getVar(const std::vector<size_t>& start, const std::vector<size_t>& count, const std::vector<ptrdiff_t>& stride, const std::vector<ptrdiff_t>& imap, long long* dataValues) const;
////////////////////
// data writing
////////////////////
// Writes the entire data into the netCDF variable.
/*!
This is an overloaded member function, provided for convenience.
It differs from the above function in what argument(s) it accepts.
In addition, no data conversion is carried out. This means that
the type of the data in memory must match the type of the variable.
*/
void putVar(const void* dataValues) const;
/*! \overload
*/
void putVar(const char** dataValues) const;
/*! \overload
*/
void putVar(const char* dataValues) const;
/*! \overload
*/
void putVar(const unsigned char* dataValues) const;
/*! \overload
*/
void putVar(const signed char* dataValues) const;
/*! \overload
*/
void putVar(const short* dataValues) const;
/*! \overload
*/
void putVar(const int* dataValues) const;
/*! \overload
*/
void putVar(const long* dataValues) const;
/*! \overload
*/
void putVar(const float* dataValues) const;
/*! \overload
*/
void putVar(const double* dataValues) const;
/*! \overload
*/
void putVar(const unsigned short* dataValues) const;
/*! \overload
*/
void putVar(const unsigned int* dataValues) const;
/*! \overload
*/
void putVar(const unsigned long long* dataValues) const;
/*!
Writes the entire data into the netCDF variable.
This is the simplest interface to use for writing a value in a scalar variable
or whenever all the values of a multidimensional variable can all be
written at once. The values to be written are associated with the
netCDF variable by assuming that the last dimension of the netCDF
variable varies fastest in the C interface.
Take care when using the simplest forms of this interface with
record variables when you don't specify how many records are to be
written. If you try to write all the values of a record variable
into a netCDF file that has no record data yet (hence has 0 records),
nothing will be written. Similarly, if you try to write all of a record
variable but there are more records in the file than you assume, more data
may be written to the file than you supply, which may result in a
segmentation violation.
\param dataValues The data values. The order in which the data will be written to the netCDF variable is with the last
dimension of the specified variable varying fastest. If the type of data values differs from the netCDF variable type, type conversion will occur.
(However, no type conversion is carried out for variables using the user-defined data types:
nc_Vlen, nc_Opaque, nc_Compound and nc_Enum.)
*/
void putVar(const long long* dataValues) const;
/////////////////////////
// Writes a single datum into the netCDF variable.
/*!
This is an overloaded member function, provided for convenience.
It differs from the above function in what argument(s) it accepts.
In addition, no data conversion is carried out. This means that
the type of the data in memory must match the type of the variable.
*/
void putVar(const std::vector<size_t>& index, const void* datumValue) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& index, const char** datumValue) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& index, const std::string& datumValue) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& index, const unsigned char* datumValue) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& index, const signed char* datumValue) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& index, const short datumValue) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& index, const int datumValue) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& index, const long datumValue) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& index, const float datumValue) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& index, const double datumValue) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& index, const unsigned short datumValue) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& index, const unsigned int datumValue) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& index, const unsigned long long datumValue) const;
/*!
Writes a single datum into the netCDF variable.
\param index Vector specifying the index where the data values will be written. The indices are relative to 0, so for example,
the first data value of a two-dimensional variable would have index (0,0). The elements of index must correspond to the variable's dimensions.
Hence, if the variable uses the unlimited dimension, the first index would correspond to the unlimited dimension.
\param datumValue The data value. If the type of data values differs from the netCDF variable type, type conversion will occur.
(However, no type conversion is carried out for variables using the user-defined data types:
nc_Vlen, nc_Opaque, nc_Compound and nc_Enum.)
*/
void putVar(const std::vector<size_t>& index, const long long datumValue) const;
/////////////////////////
// Writes an array of values into the netCDF variable.
/*!
This is an overloaded member function, provided for convenience.
It differs from the above function in what argument(s) it accepts.
In addition, no data conversion is carried out. This means that
the type of the data in memory must match the type of the variable.
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const void* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const char** dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const char* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const unsigned char* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const signed char* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const short* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const int* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const long* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const float* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const double* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const unsigned short* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const unsigned int* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const unsigned long long* dataValues) const;
/*!
Writes an array of values into the netCDF variable.
The portion of the netCDF variable to write is specified by giving a corner and a vector of edge lengths
that refer to an array section of the netCDF variable. The values to be written are associated with
the netCDF variable by assuming that the last dimension of the netCDF variable varies fastest.
\param startp Vector specifying the index where the first data values will be written. The indices are relative to 0, so for
example, the first data value of a variable would have index (0, 0, ... , 0). The elements of start correspond, in order, to the
variable's dimensions. Hence, if the variable is a record variable, the first index corresponds to the starting record number for writing the data values.
\param countp Vector specifying the number of indices selected along each dimension.
To write a single value, for example, specify count as (1, 1, ... , 1). The elements of
count correspond, in order, to the variable's dimensions. Hence, if the variable is a record
variable, the first element of count corresponds to a count of the number of records to write. Note: setting any element
of the count array to zero causes the function to exit without error, and without doing anything.
\param dataValues The data values. The order in which the data will be written to the netCDF variable is with the last
dimension of the specified variable varying fastest. If the type of data values differs from the netCDF variable
type, type conversion will occur. (However, no type conversion is
carried out for variables using the user-defined data types:
nc_Vlen, nc_Opaque, nc_Compound and nc_Enum.)
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const long long* dataValues) const;
////////////////
// Writes a set of subsampled array values into the netCDF variable.
/*!
This is an overloaded member function, provided for convenience.
It differs from the above function in what argument(s) it accepts.
In addition, no data conversion is carried out. This means that
the type of the data in memory must match the type of the variable.
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const void* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const char** dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const char* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const unsigned char* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const signed char* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const short* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const int* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const long* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const float* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const double* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const unsigned short* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const unsigned int* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const unsigned long long* dataValues) const;
/*!
Writes an array of values into the netCDF variable.
The subsampled array section is specified by giving a corner, a vector of counts, and a stride vector.
\param startp Vector specifying the index where the first data values will be written. The indices are relative to 0, so for
example, the first data value of a variable would have index (0, 0, ... , 0). The elements of start correspond, in order, to the
variable's dimensions. Hence, if the variable is a record variable, the first index corresponds to the starting record number for writing the data values.
\param countp Vector specifying the number of indices selected along each dimension.
To write a single value, for example, specify count as (1, 1, ... , 1). The elements of
count correspond, in order, to the variable's dimensions. Hence, if the variable is a record
variable, the first element of count corresponds to a count of the number of records to write. Note: setting any element
of the count array to zero causes the function to exit without error, and without doing anything.
\param stridep A vector of ptrdiff_t integers that specifies the sampling interval along each dimension of the netCDF variable.
The elements of the stride vector correspond, in order, to the netCDF variable's dimensions (stride[0] gives the sampling interval
along the most slowly varying dimension of the netCDF variable). Sampling intervals are specified in type-independent units of
elements (a value of 1 selects consecutive elements of the netCDF variable along the corresponding dimension, a value of 2 selects
every other element, etc.). A NULL stride argument is treated as (1, 1, ... , 1).
\param dataValues The data values. The order in which the data will be written to the netCDF variable is with the last
dimension of the specified variable varying fastest. If the type of data values differs from the netCDF variable type, type conversion will occur.
(However, no type conversion is carried out for variables using the user-defined data types: nc_Vlen, nc_Opaque, nc_Compound and nc_Enum.
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const long long* dataValues) const;
////////////////
// Writes a mapped array section of values into the netCDF variable.
/*!
This is an overloaded member function, provided for convenience.
It differs from the above function in what argument(s) it accepts.
In addition, no data conversion is carried out. This means that
the type of the data in memory must match the type of the variable.
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const std::vector<ptrdiff_t>& imapp, const void* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const std::vector<ptrdiff_t>& imapp, const char** dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const std::vector<ptrdiff_t>& imapp, const char* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const std::vector<ptrdiff_t>& imapp, const unsigned char* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const std::vector<ptrdiff_t>& imapp, const signed char* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const std::vector<ptrdiff_t>& imapp, const short* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const std::vector<ptrdiff_t>& imapp, const int* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const std::vector<ptrdiff_t>& imapp, const long* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const std::vector<ptrdiff_t>& imapp, const float* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const std::vector<ptrdiff_t>& imapp, const double* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const std::vector<ptrdiff_t>& imapp, const unsigned short* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const std::vector<ptrdiff_t>& imapp, const unsigned int* dataValues) const;
/*! \overload
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const std::vector<ptrdiff_t>& imapp, const unsigned long long* dataValues) const;
/*!
Writes a mapped array section of values into the netCDF variable.
The mapped array section is specified by giving a corner, a vector of counts, a stride vector, and an index mapping vector.
The index mapping vector is a vector of integers that specifies the mapping between the dimensions of a netCDF variable and the in-memory structure of the internal data array.
No assumptions are made about the ordering or length of the dimensions of the data array.
\param countp Vector specifying the number of indices selected along each dimension.
To write a single value, for example, specify count as (1, 1, ... , 1). The elements of
count correspond, in order, to the variable's dimensions. Hence, if the variable is a record
variable, the first element of count corresponds to a count of the number of records to write. Note: setting any element
of the count array to zero causes the function to exit without error, and without doing anything.
\param stridep A vector of ptrdiff_t integers that specifies the sampling interval along each dimension of the netCDF variable.
The elements of the stride vector correspond, in order, to the netCDF variable's dimensions (stride[0] gives the sampling interval
along the most slowly varying dimension of the netCDF variable). Sampling intervals are specified in type-independent units of
elements (a value of 1 selects consecutive elements of the netCDF variable along the corresponding dimension, a value of 2 selects
every other element, etc.). A NULL stride argument is treated as (1, 1, ... , 1).
\param imap Vector specifies the mapping between the dimensions of a netCDF variable and the in-memory structure of the internal data array.
The elements of the index mapping vector correspond, in order, to the netCDF variable's dimensions (imap[0] gives the distance between elements
of the internal array corresponding to the most slowly varying dimension of the netCDF variable). Distances between elements are
specified in type-independent units of elements (the distance between internal elements that occupy adjacent memory locations is
1 and not the element's byte-length as in netCDF 2). A NULL argument means the memory-resident values have the same structure as
the associated netCDF variable.
\param dataValues The data values. The order in which the data will be written to the netCDF variable is with the last
dimension of the specified variable varying fastest. If the type of data values differs from the netCDF variable type, type conversion will occur.
(However, no type conversion is carried out for variables using the user-defined data types: nc_Vlen, nc_Opaque, nc_Compound and nc_Enum.)
*/
void putVar(const std::vector<size_t>& startp, const std::vector<size_t>& countp, const std::vector<ptrdiff_t>& stridep, const std::vector<ptrdiff_t>& imapp, const long long* dataValues) const;
private:
bool nullObject;
int myId;
int groupId;
};
}
#endif
|