This file is indexed.

/usr/include/ncGroup.h is in libnetcdf-c++4-dev 4.2.1-3.

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
#include <string>
#include <vector>
#include <set>
#include <map>
#include "ncType.h"
#include "ncEnumType.h"
#include "ncGroupAtt.h"



#ifndef NcGroupClass
#define NcGroupClass


namespace netCDF
{
  class NcVar;          // forward declaration.
  class NcDim;          // forward declaration.
  class NcVlenType;     // forward declaration.
  class NcCompoundType; // forward declaration.
  class NcOpaqueType;   // forward declaration.

  /*! Class represents a netCDF group. */
  class NcGroup
  {	
    
  public:
    
    /*!
      The enumeration list contains the options for selecting groups (used for returned set of NcGroup objects).
    */
    enum GroupLocation
      {
	ChildrenGrps,              //!< Select from the set of children in the current group.
	ParentsGrps,               //!< Select from set of parent groups (excludes the current group).
	ChildrenOfChildrenGrps,    //!< Select from set of all children of children in the current group.
	AllChildrenGrps,           //!< Select from set of all children of the current group and beneath.
	ParentsAndCurrentGrps,     //!< Select from set of parent groups(includes the current group).
	AllGrps                    //!< Select from set of parent groups, current groups and all the children beneath.
      };
    
    /*!
      The enumeration list contains the options for selecting groups.
    */
    enum Location
      {
	Current,            //!< Select from contents of current group.
	Parents,            //!< Select from contents of parents groups.
	Children,           //!< Select from contents of children groups.
	ParentsAndCurrent,  //!< Select from contents of current and parents groups.
	ChildrenAndCurrent, //!< Select from contents of current and child groups.
	All                 //!< Select from contents of current, parents and child groups.
      };
    

    /*! assignment operator  */
    NcGroup& operator=(const NcGroup& rhs);
    
    /*! Constructor generates a \ref isNull "null object". */
    NcGroup();

    //* constructor */
    NcGroup(int groupId);

    /*! The copy constructor. */
    NcGroup(const NcGroup& rhs);

    /*! destructor  */
    virtual ~NcGroup();
    
    /*! equivalence operator */
    bool operator==(const NcGroup& rhs) const;     
    
    /*!  != operator */
    bool operator!=(const NcGroup& rhs) const;     

    /*! comparator operator  */
    friend bool operator<(const NcGroup& lhs,const NcGroup& rhs);
    
    /*! comparator operator  */
    friend bool operator>(const NcGroup& lhs,const NcGroup& rhs);
    
    // /////////////
    // NcGroup-related methods
    // /////////////
    
    /*! Gets the group name. */
    /*!
      Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
      \param fullName If true then the full name is returned with subgroups separated by a forward slash "/" (default is false)
      \return         The group name.
    */
    std::string getName(bool fullName=false) const;

    /*! 
      Gets the parent group.
      Method will throw an netCDF::exceptions::NcNullgrp exception if the  group is null (ie NcGroup::isNull()=true).
      If the current root is the parent group, then return a null group.
    */
    NcGroup getParentGroup() const ;

    /*! 
      Gets the group id.
      Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
    */
    int  getId() const;
    
    /*! 
      Gets the number of  NcGroup objects.
      Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
      \param location Enumeration type controlling the groups to search.
      \return         Number of groups.
    */
    int getGroupCount(NcGroup::GroupLocation location=ChildrenGrps) const;

    /*! 
      Gets the collection of NcGroup objects.
      Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
      \param location Enumeration type controlling the groups to search.
      \return         A STL multimap object, containing pairs of <attribute name, NcGroup object> entities.
    */
    std::multimap<std::string,NcGroup> getGroups(NcGroup::GroupLocation location=ChildrenGrps) const;


    /*! 
      Gets NcGroup objects with a given name.
      Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
      \param name     Name of group.
      \param location Enumeration type controlling the groups to search.
      \return         Set of NcGroup objects with given name.
    */
    std::set<NcGroup> getGroups(const std::string& name,NcGroup::GroupLocation location=ChildrenGrps) const;

    /*!
      Gets the named child NcGroup object.
      Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
      \param name  Group name.
      \param location   Enumeration type controlling the groups to search.
      \return      An NcGroup object. If there are multiple objects indentied with the same name, 
      the object closest to the current group is returned. If no valid object is found , 
      a \ref NcGroup::isNull "null node" is returned.
    */
    NcGroup getGroup(const std::string& name,NcGroup::GroupLocation location=ChildrenGrps) const;

    /*! 
      Adds a new child netCDF group object.
      Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
      \param   name     Variable name.
      \return  NcGroup  The NcGroup object for this new netCDF group.
    */
    NcGroup addGroup(const std::string& name) const;


    /*! Returns true if this object is null (i.e. it has no contents); otherwise returns false. */
    bool isNull() const  {return nullObject;}

    /*! Returns true if this is the root group, otherwise returns false. */
    bool isRootGroup() const;

    // /////////////
    // NcVar-related accessors
    // /////////////

    /*! 
      Gets the number of NcVar objects in this group.
      \param location Enumeration type controlling the groups to search.
      \return         Number of variables.
    */
    int getVarCount(NcGroup::Location location=Current) const;

    /*!
      Get the collection of NcVar objects.
      \param location Enumeration type controlling the groups to search.
      \return         A STL multimap object, containing pairs of <attribute name, NcVar object> entities.
    */
   std::multimap<std::string,NcVar> getVars(NcGroup::Location location=Current) const;

   /*! 
     Gets all NcVar objects with a given name.
      \param name     Name of attribute
      \param location Enumeration type controlling the groups to search.
      \return         Set of NcVar objects.
    */
    std::set<NcVar> getVars(const std::string& name,NcGroup::Location location=Current) const;
    
    /*! 
      Gets the named NcVar object..
      \param name     Variable name.
      \param location Enumeration type controlling the groups to search.
      \return         A NcVar object. If there are multiple objects indentied with the 
      same name, the object closest  to the current group is returned.  
      If no valid object is found , a \ref NcVar::isNull "null node" is returned.
     */
    NcVar getVar(const std::string& name,NcGroup::Location location=Current) const;

    /*!
      Adds a new netCDF variable.
      The NcType and NcDim objects must be non-null, and be defined in either the current group or a parent group.
      An NcNullType exception is thrown if the NcType object is invalid.
      An NcNullDim exception is thrown if the NcDim object is invalid.
      \param    name     Variable name.
      \param   typeName  Type name.
      \param   dimName   Dimension name.
      \return            The NcVar object for this new netCDF variable.
    */
    NcVar addVar(const std::string& name, const std::string& typeName, const std::string& dimName) const;

    /*! 
      Adds a new netCDF variable.
      The NcType and NcDim objects must be non-null, and be defined in either the current group or a parent group.
      An NcNullType exception is thrown if the NcType object is invalid.
      An NcNullDim exception is thrown if the NcDim object is invalid.
      \param    name      Variable name.
      \param    ncType    NcType object.
      \param    ncDim     NcDim object.
      \return             The NcVar object for this new netCDF variable.
    */
    NcVar addVar(const std::string& name, const NcType& ncType, const NcDim& ncDim) const;

    /*! 
      Adds a new netCDF multi-dimensional variable.
      The NcType and NcDim objects must be non-null, and be defined in either the current group or a parent group.
      An NcNullType exception is thrown if the NcType object is invalid.
      An NcNullDim exception is thrown if the NcDim object is invalid.
      \param   name     Variable name.
      \param   typeName Type name.
      \param   dimNames Vector of dimension names.
      \return           The NcVar object for this new netCDF variable.
    */
    NcVar addVar(const std::string& name, const std::string& typeName, const std::vector<std::string>& dimNames) const;
    

    /*! 
      Adds a new multi-dimensional netCDF variable.
      The NcType and NcDim objects must be non-null, and be defined in either the current group or a parent group.
      An NcNullType exception is thrown if the NcType object is invalid.
      An NcNullDim exception is thrown if any of the the NcDim objects are invalid.
      \param    name        Variable name.
      \param    ncType      NcType object.
      \param    ncDimvector Vector of NcDim objects.
      \return               The NcVar object for this new netCDF variable.
    */
    NcVar addVar(const std::string& name, const NcType& ncType, const std::vector<NcDim>& ncDimVector) const;

    // /////////////
    // NcGroupAtt-related methods
    // /////////////

    /*! 
      Gets the number of group attributes.
      \param location Enumeration type controlling the groups to search.
      \return         Number of attributes.
    */
    int getAttCount(NcGroup::Location location=Current) const;

    /*! 
      Gets the collection of NcGroupAtt objects.
      \param location Enumeration type controlling the groups to search.
      \return         A STL multimap object, containing pairs of <attribute name, NcGroupAtt object> entities.
    */
    std::multimap<std::string,NcGroupAtt> getAtts(NcGroup::Location location=Current) const;
    
    /*! 
    Gets all NcGroupAtt objects with a given name.
      \param name     Name of attribute
      \param location Enumeration type controlling the groups to search.
      \return         Set of NcGroupAtt objects.
    */
    std::set<NcGroupAtt> getAtts(const std::string& name,NcGroup::Location location=Current) const;
    
    /*! 
      Gets the named NcGroupAtt object.
      \param name     Name of attribute
      \param location Enumeration type controlling the groups to search.
      \return         A NcGroupAtt object. If there are multiple objects indentied with the 
      same name, the object closest  to the current group is returned.  If no valid object is found , 
      a \ref NcGroupAtt::isNull "null node" is returned.
    */
    NcGroupAtt getAtt(const std::string& name,NcGroup::Location location=Current) const;
    

    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, size_t len, const char** dataValues) const ;

    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const std::string& dataValues) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, short datumValue) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, int datumValue) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, long datumValue) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, float datumValue) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, double datumValue) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, unsigned short datumValue) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, unsigned int datumValue) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, unsigned long long datumValue) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, long long datumValue) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const unsigned char* dataValues) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const signed char* dataValues) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const short* dataValues) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const int* dataValues) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const long* dataValues) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const float* dataValues) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const double* dataValues) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const unsigned short* dataValues) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const unsigned int* dataValues) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const unsigned long long* dataValues) const ;
    /*! \overload
     */ 
    NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const long long* dataValues) const ;
    /*! 
      Creates a new NetCDF group 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 NcGroupAtt object for this new netCDF attribute.
    */
    NcGroupAtt putAtt(const std::string& name, const NcType& type, size_t len, const void* dataValues) const ;



    // /////////////
    // NcDim-related methods
    // /////////////

    /*! 
      Gets the number of NcDim objects.
      \param location Enumeration type controlling the groups to search.
      \return         Number of dimensions.
    */
    int getDimCount(NcGroup::Location location=Current) const;
    
    /*! 
      Gets the collection of NcDim objects.
      \param location Enumeration type controlling the groups to search.
      \return         A STL multimap object, containing pairs of <attribute name, NcDim object> entities.
    */
    std::multimap<std::string,NcDim> getDims(NcGroup::Location location=Current) const;
    
    /*! 
      Gets NcDim objects with a given name.
      \param name     Name of dimension.
      \param location Enumeration type controlling the groups to search.
      \return         Set of NcDim objects with given name.
    */
    std::set<NcDim> getDims(const std::string& name,NcGroup::Location location=Current) const;

    /*! 
      Gets the named NcDim object.
      \param name       Name of dimension.
      \param location   Enumeration type controlling the groups to search.
      \return           An NcDim object. If there are multiple objects indentied with the same name, 
      the object closest to the current group is returned. If no valid object is found , a \ref NcDim::isNull "null node" is returned.
    */
    NcDim getDim(const std::string& name,NcGroup::Location location=Current) const;

    /*! 
      Adds a new netCDF dimension.
      \param The name of new dimension.
      \param Length of dimension; that is, number of values for this dimension as an index to variables 
      that use it.
      \return   The NcDim object for this new netCDF dimension.
    */
    NcDim addDim(const std::string& name, size_t dimSize) const;

    /*! 
      Adds a new unlimited netCDF dimension.
      \param The name of new dimension.
      \return   The NcDim object for this new netCDF dimension.
    */
    NcDim addDim(const std::string& name) const;

    // /////////////
    // NcType-related methods
    // /////////////

    /*! 
      Gets the number of type objects.
      \param location Enumeration type controlling the groups to search.
      \return         Number of types.
    */
    int getTypeCount(NcGroup::Location location=Current) const;
    
    
    /*! 
      Gets the number of type objects with a given enumeration type.
      \param enumType The enumeration value of the object type.
      \param location Enumeration type controlling the groups to search.
      \return         Number of types of the given enumeration type.
    */
    int getTypeCount(NcType::ncType enumType, NcGroup::Location location=Current) const;
    
    
    /*! 
      Gets the collection of NcType objects.
      \param location Enumeration type controlling the groups to search.
      \return         A STL multimap object, on return contains pairs of <Type name, NcType object> entities.
                      For atomic types, the type returned is the CDL name.
    */
    std::multimap<std::string,NcType> getTypes(NcGroup::Location location=Current) const;

  
    /*! 
      Gets the collection of NcType objects with a given name.
      \param name     Name of type. For atomic types, the CDL name is expected. This is consistent with the 
                         string returned from NcType::getName().
      \param location Enumeration type controlling the groups to search.
      \return         Set of  NcType objects.
    */
    std::set<NcType> getTypes(const std::string& name, NcGroup::Location location=Current) const;

    /*! 
      Gets the collection of NcType objects with a given data type.
      \param enumType Enumeration type specifying the data type.
      \param location Enumeration type controlling the groups to search.
      \return         Set of Nctype objects.
    */
    std::set<NcType> getTypes(NcType::ncType enumType, NcGroup::Location location=Current) const;


    /*! 
      Gets the collection of NcType objects with a given name and data type.
      \param name     Name of type. For atomic types, the CDL name is expected. This is consistent with the 
                         string returned from NcType::getName().
      \param enumType Enumeration type specifying the data type.
      \param location Enumeration type controlling the groups to search.
      \return         Set of Nctype objects.
    */
    std::set<NcType> getTypes(const std::string& name, NcType::ncType enumType, NcGroup::Location location=Current) const;


    /*! 
      Gets the NcType object with a given name.
      \param name     Name of type. For atomic types, the CDL name is expected. This is consistent with the 
                         string returned from NcType::getName().
      \param location Enumeration type controlling the groups to search.
      \return         NcType object. If there are multiple objects indentied with the same name, 
      the object closest to the current group is returned.  If no valid object is found , a \ref NcType::isNull "null node" is returned.

    */
    NcType getType(const std::string& name, NcGroup::Location location=Current) const;
    
    
    /*! 
      Adds a new netCDF enum type.
      \param name        Name of type. For atomic types, the CDL name is expected. This is consistent with the 
                         string returned from NcType::getName().
      \param enumType    The enumeration value of the object type.
      \return            The NcEnumType object for this new netCDF enum type.
    */
    NcEnumType addEnumType(const std::string& name,NcEnumType::ncEnumType basetype) const;


    /*! 
      Adds a new netCDF Vlen type.
      \param name        Name of type.
      \param basetype    A NcType object to be used for the basetype.
      \return            The NcVlenType object for this new netCDF vlen type.
    */
    NcVlenType addVlenType(const std::string& name,NcType& basetype) const;


    /*! 
      Adds a new netCDF Opaque type.
      \param name     Name of type.
      \param size     The size of the new type in bytes.
      \return         The NcOpaqueType object for this new netCDF opaque type..
    */
    NcOpaqueType addOpaqueType(const std::string& name, size_t size) const;


    /*! 
      Adds a new netCDF UserDefined type.
      \param name     Name of type.
      \param size     The size of the new type in bytes.
      \return         The new NcCompoundType object for this new netCDF userDefined type.
    */
    NcCompoundType addCompoundType(const std::string& name, size_t size) const; 


    /*! 
      Gets a collection of  coordinate variables.
      Coordinate variable have  an NcDim and NcVar object with the same name defined in the same group.
      \par
      The method returns STL map object containing a coordinate variables in the current group  and optionally
      in the parent and child groups. It is expected that within each group, the names of dimensions are unique and
      the the names of variables are unique. However, if this is not the case, this method will still work correctly.
      
      \param location Enumeration type controlling the groups to search.
      \return         The NcVar dimension variable. If no valid object is found , a \ref NcVar::isNull "null node" is returned.
    */
    std::map<std::string,NcGroup> getCoordVars(NcGroup::Location location=Current) const;

    /*! 
      Gets the NcDim and NcVar object pair for a named coordinate variable.
      Coordinate variable have  an NcDim and NcVar object with the same name defined in the same group.
      \par
      The method returns two objects for the named coordinate variable. The method searches first in the current 
      group and optionally in the parent and child group and returns the first instance found.
      \param location Enumeration type controlling the groups to search.
      \return         The set of names of dimension variables. 
    */
    void getCoordVar(std::string& coordVarName, NcDim& ncDim, NcVar& ncVar, NcGroup::Location location=Current) const;


  protected:
    
    /*! assignment operator  */
    /* NcGroup& operator=(const NcGroup& rhs); */
    
    bool nullObject;

    int myId;	
    
  };

}
#endif