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