My Project  1.10.8
H5Object.h
1 // C++ informative line for the emacs editor: -*- C++ -*-
2 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3  * Copyright by The HDF Group. *
4  * Copyright by the Board of Trustees of the University of Illinois. *
5  * All rights reserved. *
6  * *
7  * This file is part of HDF5. The full HDF5 copyright notice, including *
8  * terms governing use, modification, and redistribution, is contained in *
9  * the COPYING file, which can be found at the root of the source code *
10  * distribution tree, or in https://www.hdfgroup.org/licenses. *
11  * If you do not have access to either file, you may request a copy from *
12  * help@hdfgroup.org. *
13  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
14 
15 #ifndef H5Object_H
16 #define H5Object_H
17 
18 namespace H5 {
19 
40 // Inheritance: H5Location -> IdComponent
41 
42 // Define the operator function pointer for H5Aiterate().
43 typedef void (*attr_operator_t)(H5Object &loc, const H5std_string attr_name, void *operator_data);
44 
45 // Define the operator function pointer for H5Ovisit2().
46 typedef int (*visit_operator_t)(H5Object &obj, const H5std_string attr_name, const H5O_info_t *oinfo,
47  void *operator_data);
48 
49 // User data for attribute iteration
51  public:
53  void * opData;
54  H5Object * location; // Consider changing to H5Location
55 };
56 
57 // User data for visit iteration
59  public:
61  void * opData;
63 };
64 
65 class H5_DLLCPP H5Object : public H5Location {
66  public:
67  // Creates an attribute for the specified object
68  // PropList is currently not used, so always be default.
69  Attribute createAttribute(const char *name, const DataType &type, const DataSpace &space,
70  const PropList &create_plist = PropList::DEFAULT) const;
71  Attribute createAttribute(const H5std_string &name, const DataType &type, const DataSpace &space,
72  const PropList &create_plist = PropList::DEFAULT) const;
73 
74  // Given its name, opens the attribute that belongs to an object at
75  // this location.
76  Attribute openAttribute(const char *name) const;
77  Attribute openAttribute(const H5std_string &name) const;
78 
79  // Given its index, opens the attribute that belongs to an object at
80  // this location.
81  Attribute openAttribute(const unsigned int idx) const;
82 
83  // Iterate user's function over the attributes of this object.
84  int iterateAttrs(attr_operator_t user_op, unsigned *idx = NULL, void *op_data = NULL);
85 
86  // Recursively visit elements reachable from this object.
87  void visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data,
88  unsigned int fields);
89 
90  // Returns the object header version of an object
91  unsigned objVersion() const;
92 
93  // Determines the number of attributes belong to this object.
94  int getNumAttrs() const;
95 
96  // Checks whether the named attribute exists for this object.
97  bool attrExists(const char *name) const;
98  bool attrExists(const H5std_string &name) const;
99 
100  // Renames the named attribute to a new name.
101  void renameAttr(const char *oldname, const char *newname) const;
102  void renameAttr(const H5std_string &oldname, const H5std_string &newname) const;
103 
104  // Removes the named attribute from this object.
105  void removeAttr(const char *name) const;
106  void removeAttr(const H5std_string &name) const;
107 
108  // Returns an identifier.
109  virtual hid_t getId() const H5_OVERRIDE = 0;
110 
111  // Gets the name of this HDF5 object, i.e., Group, DataSet, or
112  // DataType.
113  ssize_t getObjName(char *obj_name, size_t buf_size = 0) const;
114  ssize_t getObjName(H5std_string &obj_name, size_t len = 0) const;
115  H5std_string getObjName() const;
116 
117 #ifndef DOXYGEN_SHOULD_SKIP_THIS
118 
119  protected:
120  // Default constructor
121  H5Object();
122 
123  // Sets the identifier of this object to a new value. - this one
124  // doesn't increment reference count
125  virtual void p_setId(const hid_t new_id) H5_OVERRIDE = 0;
126 
127  // Noop destructor.
128  virtual ~H5Object() H5_OVERRIDE;
129 
130 #endif // DOXYGEN_SHOULD_SKIP_THIS
131 
132 }; // end of H5Object
133 } // namespace H5
134 
135 #endif // H5Object_H
Class Attribute operates on HDF5 attributes.
Definition: H5Attribute.h:29
Class DataSpace inherits from IdComponent and provides wrappers for the HDF5's dataspaces.
Definition: H5DataSpace.h:25
Class DataType provides generic operations on HDF5 datatypes.
Definition: H5DataType.h:28
H5Location is an abstract base class, added in version 1.8.12.
Definition: H5Location.h:31
Class H5Object is a bridge between H5Location and DataSet, DataType, and Group.
Definition: H5Object.h:65
virtual hid_t getId() const H5_OVERRIDE=0
Class PropList inherits from IdComponent and provides wrappers for the HDF5 generic property list.
Definition: H5PropList.h:25
static const PropList & DEFAULT
Default property list.
Definition: H5PropList.h:28
Definition: H5Object.h:50
void * opData
Definition: H5Object.h:53
H5Object * location
Definition: H5Object.h:54
attr_operator_t op
Definition: H5Object.h:52
Definition: H5Object.h:58
void * opData
Definition: H5Object.h:61
visit_operator_t op
Definition: H5Object.h:60
H5Object * obj
Definition: H5Object.h:62
Definition: H5AbstractDs.cpp:34
int(* visit_operator_t)(H5Object &obj, const H5std_string attr_name, const H5O_info_t *oinfo, void *operator_data)
Definition: H5Object.h:46
void(* attr_operator_t)(H5Object &loc, const H5std_string attr_name, void *operator_data)
Definition: H5Object.h:43


The HDF Group Help Desk:
  Copyright by The HDF Group
and the Board of Trustees of the University of Illinois