All Classes Namespaces Functions Variables Typedefs Friends Pages
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://support.hdfgroup.org/ftp/HDF5/releases. *
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,
44  const H5std_string attr_name,
45  void *operator_data);
46 
47 // Define the operator function pointer for H5Ovisit3().
48 typedef int (*visit_operator_t)(H5Object& obj,
49  const H5std_string attr_name,
50  const H5O_info2_t *oinfo,
51  void *operator_data);
52 
53 // User data for attribute iteration
55  public:
57  void* opData;
58  H5Object* location; // Consider changing to H5Location
59 };
60 
61 // User data for visit iteration
63  public:
65  void* opData;
67 };
68 
69 class H5_DLLCPP H5Object : public H5Location {
70  public:
71  // Creates an attribute for the specified object
72  // PropList is currently not used, so always be default.
73  Attribute createAttribute(const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
74  Attribute createAttribute(const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
75 
76  // Given its name, opens the attribute that belongs to an object at
77  // this location.
78  Attribute openAttribute(const char* name) const;
79  Attribute openAttribute(const H5std_string& name) const;
80 
81  // Given its index, opens the attribute that belongs to an object at
82  // this location.
83  Attribute openAttribute(const unsigned int idx) const;
84 
85  // Iterate user's function over the attributes of this object.
86  int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL);
87 
88  // Recursively visit elements reachable from this object.
89  void visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data, unsigned int fields);
90 
91  // Returns the object header version of an object
92  unsigned objVersion() const;
93 
94  // Determines the number of attributes belong to this object.
95  int getNumAttrs() const;
96 
97  // Checks whether the named attribute exists for this object.
98  bool attrExists(const char* name) const;
99  bool attrExists(const H5std_string& name) const;
100 
101  // Renames the named attribute to a new name.
102  void renameAttr(const char* oldname, const char* newname) const;
103  void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
104 
105  // Removes the named attribute from this object.
106  void removeAttr(const char* name) const;
107  void removeAttr(const H5std_string& name) const;
108 
109  // Returns an identifier.
110  virtual hid_t getId() const = 0;
111 
112  // Gets the name of this HDF5 object, i.e., Group, DataSet, or
113  // DataType.
114  ssize_t getObjName(char *obj_name, size_t buf_size = 0) const;
115  ssize_t getObjName(H5std_string& obj_name, size_t len = 0) const;
116  H5std_string getObjName() const;
117 
118 
119 #ifndef DOXYGEN_SHOULD_SKIP_THIS
120 
121  protected:
122  // Default constructor
123  H5Object();
124 
125  // Sets the identifier of this object to a new value. - this one
126  // doesn't increment reference count
127  virtual void p_setId(const hid_t new_id) = 0;
128 
129  // Noop destructor.
130  virtual ~H5Object();
131 
132 #endif // DOXYGEN_SHOULD_SKIP_THIS
133 
134 }; // end of H5Object
135 } // namespace H5
136 
137 #endif // __H5Object_H
void * opData
Definition: H5Object.h:65
int(* visit_operator_t)(H5Object &obj, const H5std_string attr_name, const H5O_info2_t *oinfo, void *operator_data)
Definition: H5Object.h:48
Class DataSpace inherits from IdComponent and provides wrappers for the HDF5's dataspaces.
Definition: H5DataSpace.h:25
Class Attribute operates on HDF5 attributes.
Definition: H5Attribute.h:29
Class DataType provides generic operations on HDF5 datatypes.
Definition: H5DataType.h:28
Class H5Object is a bridge between H5Location and DataSet, DataType, and Group.
Definition: H5Object.h:69
H5Location is an abstract base class, added in version 1.8.12.
Definition: H5Location.h:31
void * opData
Definition: H5Object.h:57
visit_operator_t op
Definition: H5Object.h:64
Definition: H5Object.h:62
void(* attr_operator_t)(H5Object &loc, const H5std_string attr_name, void *operator_data)
Definition: H5Object.h:43
class H5_DLLCPP H5Object
Definition: H5Attribute.cpp:44
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:54
attr_operator_t op
Definition: H5Object.h:56
H5Object * obj
Definition: H5Object.h:66
H5Object * location
Definition: H5Object.h:58


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