HDF5 C++ API  1.8.13
 All Classes Namespaces Functions Variables Typedefs 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  // Creates an object to hold an HDF5 identifier.
66  IdComponent( const hid_t h5_id );
67 
68  // Copy constructor: makes copy of the original IdComponent object.
69  IdComponent( const IdComponent& original );
70 
71 #ifndef DOXYGEN_SHOULD_SKIP_THIS
72  // Pure virtual function for there are various H5*close for the
73  // subclasses.
74  virtual void close() = 0;
75 
76  // Makes and returns the string "<class-name>::<func_name>";
77  // <class-name> is returned by fromClass().
78  H5std_string inMemFunc(const char* func_name) const;
79 
81  virtual H5std_string fromClass() const { return("IdComponent");}
82 
83 #endif // DOXYGEN_SHOULD_SKIP_THIS
84 
85  // Destructor
86  virtual ~IdComponent();
87 
88  protected:
89 #ifndef DOXYGEN_SHOULD_SKIP_THIS
90 
91  // Default constructor.
92  IdComponent();
93 
94  // Gets the name of the file, in which an HDF5 object belongs.
95  H5std_string p_get_file_name() const;
96 
97  // Verifies that the given id is valid.
98  static bool p_valid_id(const hid_t obj_id);
99 
100  // Sets the identifier of this object to a new value. - this one
101  // doesn't increment reference count
102  virtual void p_setId(const hid_t new_id) = 0;
103 
104 #endif // DOXYGEN_SHOULD_SKIP_THIS
105 
106 }; // end class IdComponent
107 
108 #ifndef H5_NO_NAMESPACE
109 }
110 #endif
111 #endif // __IdComponent_H
Class IdComponent provides wrappers of the C functions that operate on an HDF5 identifier.
Definition: H5IdComponent.h:34