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; |
---|
27 | class H5_DLLCPP IdComponent { |
---|
28 | public: |
---|
29 | // Increment reference counter. |
---|
30 | void incRefCount(const hid_t obj_id) const; |
---|
31 | void incRefCount() const; |
---|
32 | |
---|
33 | // Decrement reference counter. |
---|
34 | void decRefCount(const hid_t obj_id) const; |
---|
35 | void decRefCount() const; |
---|
36 | |
---|
37 | // Get the reference counter to this identifier. |
---|
38 | int getCounter(const hid_t obj_id) const; |
---|
39 | int getCounter() const; |
---|
40 | |
---|
41 | // Returns an HDF5 object type, given the object id. |
---|
42 | static H5I_type_t getHDFObjType(const hid_t obj_id); |
---|
43 | |
---|
44 | // Assignment operator. |
---|
45 | IdComponent& operator=( const IdComponent& rhs ); |
---|
46 | |
---|
47 | // Opens the HDF5 object referenced. |
---|
48 | hid_t p_dereference(void* ref); |
---|
49 | |
---|
50 | // Gets the identifier of this object. |
---|
51 | virtual hid_t getId () const = 0; |
---|
52 | |
---|
53 | // Sets the identifier of this object to a new value. |
---|
54 | virtual void setId(const hid_t new_id) = 0; |
---|
55 | |
---|
56 | // Creates an object to hold an HDF5 identifier. |
---|
57 | IdComponent( const hid_t h5_id ); |
---|
58 | |
---|
59 | // Copy constructor: makes copy of the original IdComponent object. |
---|
60 | IdComponent( const IdComponent& original ); |
---|
61 | |
---|
62 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
---|
63 | // Pure virtual function for there are various H5*close for the |
---|
64 | // subclasses. |
---|
65 | virtual void close() = 0; |
---|
66 | |
---|
67 | // Makes and returns the string "<class-name>::<func_name>"; |
---|
68 | // <class-name> is returned by fromClass(). |
---|
69 | H5std_string inMemFunc(const char* func_name) const; |
---|
70 | |
---|
71 | // Returns this class name. |
---|
72 | virtual H5std_string fromClass() const { return("IdComponent");} |
---|
73 | |
---|
74 | #endif // DOXYGEN_SHOULD_SKIP_THIS |
---|
75 | |
---|
76 | // Destructor |
---|
77 | virtual ~IdComponent(); |
---|
78 | |
---|
79 | protected: |
---|
80 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
---|
81 | |
---|
82 | // Default constructor. |
---|
83 | IdComponent(); |
---|
84 | |
---|
85 | // Gets the name of the file, in which an HDF5 object belongs. |
---|
86 | H5std_string p_get_file_name() const; |
---|
87 | |
---|
88 | // Verifies that the given id is valid. |
---|
89 | static bool p_valid_id(const hid_t obj_id); |
---|
90 | |
---|
91 | #endif // DOXYGEN_SHOULD_SKIP_THIS |
---|
92 | |
---|
93 | }; // end class IdComponent |
---|
94 | |
---|
95 | #ifndef H5_NO_NAMESPACE |
---|
96 | } |
---|
97 | #endif |
---|
98 | #endif |
---|