HDF5 C++ API  1.8.15
 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  // Increment reference counter.
37  void incRefCount(const hid_t obj_id) const;
38  void incRefCount() const;
39 
40  // Decrement reference counter.
41  void decRefCount(const hid_t obj_id) const;
42  void decRefCount() const;
43 
44  // Get the reference counter to this identifier.
45  int getCounter(const hid_t obj_id) const;
46  int getCounter() const;
47 
48  // Returns an HDF5 object type, given the object id.
49  static H5I_type_t getHDFObjType(const hid_t obj_id);
50 
51  // Returns an HDF5 object type of this object.
52  H5I_type_t getHDFObjType() const;
53 
54  // Assignment operator.
55  IdComponent& operator=( const IdComponent& rhs );
56 
57 #ifndef DOXYGEN_SHOULD_SKIP_THIS
58  // Gets the identifier of this object.
59  virtual hid_t getId () const = 0;
60 #endif // DOXYGEN_SHOULD_SKIP_THIS
61 
62  // Sets the identifier of this object to a new value.
63  void setId(const hid_t new_id);
64 
65  // *** Deprecation warning ***
66  // The following two constructors are no longer appropriate after the
67  // data member "id" had been moved to the sub-classes.
68  // The copy constructor is a noop and is removed in 1.8.15 and the
69  // other will be removed from 1.10 release, and then from 1.8 if its
70  // removal does not raise any problems in two 1.10 releases.
71 
72  // Creates an object to hold an HDF5 identifier.
73  IdComponent( const hid_t h5_id );
74 
75  // Copy constructor: makes copy of the original IdComponent object.
76  // IdComponent( const IdComponent& original );
77 
78 #ifndef DOXYGEN_SHOULD_SKIP_THIS
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  protected:
96 #ifndef DOXYGEN_SHOULD_SKIP_THIS
97 
98  // Default constructor.
99  IdComponent();
100 
101  // Gets the name of the file, in which an HDF5 object belongs.
102  H5std_string p_get_file_name() const;
103 
104  // Verifies that the given id is valid.
105  static bool p_valid_id(const hid_t obj_id);
106 
107  // Sets the identifier of this object to a new value. - this one
108  // doesn't increment reference count
109  virtual void p_setId(const hid_t new_id) = 0;
110  //virtual void p_setId(const hid_t new_id);
111 
112 #endif // DOXYGEN_SHOULD_SKIP_THIS
113 
114 }; // end class IdComponent
115 
116 #ifndef H5_NO_NAMESPACE
117 }
118 #endif
119 #endif // __IdComponent_H
Class IdComponent provides wrappers of the C functions that operate on an HDF5 identifier.
Definition: H5IdComponent.h:34