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


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