HDF5 C++ API  1.10.1
 All Classes Namespaces Functions Variables Typedefs Friends Pages
H5IdComponent.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 __IdComponent_H
16 #define __IdComponent_H
17 
18 namespace H5 {
19 
27 class H5_DLLCPP IdComponent {
28  public:
29 
30  // Increment reference counter.
31  void incRefCount(const hid_t obj_id) const;
32  void incRefCount() const;
33 
34  // Decrement reference counter.
35  void decRefCount(const hid_t obj_id) const;
36  void decRefCount() const;
37 
38  // Get the reference counter to this identifier.
39  int getCounter(const hid_t obj_id) const;
40  int getCounter() const;
41 
42  // Returns an HDF5 object type, given the object id.
43  static H5I_type_t getHDFObjType(const hid_t obj_id);
44 
45  // Returns an HDF5 object type of this object.
46  H5I_type_t getHDFObjType() const;
47 
48  // Returns the number of members in a type.
49  static hsize_t getNumMembers(H5I_type_t type);
50 
51  // Checks if the given ID is valid.
52  static bool isValid(hid_t an_id);
53 
54  // Determines if an type exists.
55  static bool typeExists(H5I_type_t type);
56 
57  // Assignment operator.
58  IdComponent& operator=(const IdComponent& rhs);
59 
60  // Sets the identifier of this object to a new value.
61  void setId(const hid_t new_id);
62 
63  // *** Deprecation warning ***
64  // The following two constructors are no longer appropriate after the
65  // data member "id" had been moved to the sub-classes.
66  // The copy constructor is a noop and is removed in 1.8.15 and the
67  // other will be removed from 1.10 release, and then from 1.8 if its
68  // removal does not raise any problems in two 1.10 releases.
69 
70  // Creates an object to hold an HDF5 identifier.
71  // IdComponent(const hid_t h5_id); - removed from 1.10.1
72 
73 #ifndef DOXYGEN_SHOULD_SKIP_THIS
74 
75  // Copy constructor: makes copy of the original IdComponent object.
76  // IdComponent(const IdComponent& original); - removed from 1.8.15
77 
78  // Gets the identifier of this object.
79  virtual hid_t getId () const = 0;
80 
81  // Pure virtual function for there are various H5*close for the
82  // subclasses.
83  virtual void close() = 0;
84 
85  // Makes and returns the string "<class-name>::<func_name>";
86  // <class-name> is returned by fromClass().
87  H5std_string inMemFunc(const char* func_name) const;
88 
90  virtual H5std_string fromClass() const { return("IdComponent");}
91 
92 #endif // DOXYGEN_SHOULD_SKIP_THIS
93 
94  // Destructor
95  virtual ~IdComponent();
96 
97 #ifndef DOXYGEN_SHOULD_SKIP_THIS
98 
99  protected:
100  // Default constructor.
101  IdComponent();
102 
103  // Gets the name of the file, in which an HDF5 object belongs.
104  H5std_string p_get_file_name() const;
105 
106  // Verifies that the given id is valid.
107  static bool p_valid_id(const hid_t obj_id);
108 
109  // Sets the identifier of this object to a new value. - this one
110  // doesn't increment reference count
111  virtual void p_setId(const hid_t new_id) = 0;
112 
113  // This flag is used to decide whether H5dont_atexit should be called
114  static bool H5dontAtexit_called;
115 
116  private:
117  // This flag indicates whether H5Library::initH5cpp has been called
118  // to register various terminating functions with atexit()
119  static bool H5cppinit;
120 
121 #endif // DOXYGEN_SHOULD_SKIP_THIS
122 
123 }; // end class IdComponent
124 } // namespace H5
125 
126 #endif // __IdComponent_H
Class IdComponent provides wrappers of the C functions that operate on an HDF5 identifier.
Definition: H5IdComponent.h:27


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