HDF5 C++ API  1.8.18
 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 files COPYING and Copyright.html. COPYING can be found at the root *
10  * of the source code distribution tree; Copyright.html can be found at the *
11  * root level of an installed copy of the electronic HDF5 document set and *
12  * is linked from the top-level documents page. It can also be found at *
13  * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
14  * access to either file, you may request a copy from help@hdfgroup.org. *
15  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
16 
17 #ifndef __IdComponent_H
18 #define __IdComponent_H
19 
20 // IdComponent represents an HDF5 object that has an identifier.
21 
22 namespace H5 {
23 
24 class DataSpace;
32 class H5_DLLCPP IdComponent {
33  public:
34 
35  // Increment reference counter.
36  void incRefCount(const hid_t obj_id) const;
37  void incRefCount() const;
38 
39  // Decrement reference counter.
40  void decRefCount(const hid_t obj_id) const;
41  void decRefCount() const;
42 
43  // Get the reference counter to this identifier.
44  int getCounter(const hid_t obj_id) const;
45  int getCounter() const;
46 
47  // Returns an HDF5 object type, given the object id.
48  static H5I_type_t getHDFObjType(const hid_t obj_id);
49 
50  // Returns an HDF5 object type of this object.
51  H5I_type_t getHDFObjType() const;
52 
53  // Assignment operator.
54  IdComponent& operator=( const IdComponent& rhs );
55 
56  // Sets the identifier of this object to a new value.
57  void setId(const hid_t new_id);
58 
59  // *** Deprecation warning ***
60  // The following two constructors are no longer appropriate after the
61  // data member "id" had been moved to the sub-classes.
62  // The copy constructor is a noop and is removed in 1.8.15 and the
63  // other will be removed from 1.10 release, and then from 1.8 if its
64  // removal does not raise any problems in two 1.10 releases.
65 
66  // Creates an object to hold an HDF5 identifier.
67  IdComponent( const hid_t h5_id );
68 
69 #ifndef DOXYGEN_SHOULD_SKIP_THIS
70 
71  // Copy constructor: makes copy of the original IdComponent object.
72  // IdComponent( const IdComponent& original ); - removed from 1.8.15
73 
74  // Gets the identifier of this object.
75  virtual hid_t getId () const = 0;
76 
77  // Pure virtual function for there are various H5*close for the
78  // subclasses.
79  virtual void close() = 0;
80 
81  // Makes and returns the string "<class-name>::<func_name>";
82  // <class-name> is returned by fromClass().
83  H5std_string inMemFunc(const char* func_name) const;
84 
86  virtual H5std_string fromClass() const { return("IdComponent");}
87 
88 #endif // DOXYGEN_SHOULD_SKIP_THIS
89 
90  // Destructor
91  virtual ~IdComponent();
92 
93 #ifndef DOXYGEN_SHOULD_SKIP_THIS
94 
95  protected:
96 
97  // Default constructor.
98  IdComponent();
99 
100  // Gets the name of the file, in which an HDF5 object belongs.
101  H5std_string p_get_file_name() const;
102 
103  // Verifies that the given id is valid.
104  static bool p_valid_id(const hid_t obj_id);
105 
106  // Sets the identifier of this object to a new value. - this one
107  // doesn't increment reference count
108  virtual void p_setId(const hid_t new_id) = 0;
109 
110  // This flag is used to decide whether H5dont_atexit should be called
111  static bool H5dontAtexit_called;
112 
113  private:
114  // This flag indicates whether H5Library::initH5cpp has been called
115  // to register various terminating functions with atexit()
116  static bool H5cppinit;
117 
118 #endif // DOXYGEN_SHOULD_SKIP_THIS
119 
120 }; // end class IdComponent
121 
122 }
123 #endif // __IdComponent_H
Class IdComponent provides wrappers of the C functions that operate on an HDF5 identifier.
Definition: H5IdComponent.h:32


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