My Project  1.10.11
H5IdComponent.h
1 // C++ informative line for the emacs editor: -*- C++ -*-
2 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3  * Copyright by The HDF Group. *
4  * All rights reserved. *
5  * *
6  * This file is part of HDF5. The full HDF5 copyright notice, including *
7  * terms governing use, modification, and redistribution, is contained in *
8  * the COPYING file, which can be found at the root of the source code *
9  * distribution tree, or in https://www.hdfgroup.org/licenses. *
10  * If you do not have access to either file, you may request a copy from *
11  * help@hdfgroup.org. *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 #ifndef H5IdComponent_H
15 #define H5IdComponent_H
16 
17 namespace H5 {
18 
26 class H5_DLLCPP IdComponent {
27  public:
28  // Increment reference counter.
29  void incRefCount(const hid_t obj_id) const;
30  void incRefCount() const;
31 
32  // Decrement reference counter.
33  void decRefCount(const hid_t obj_id) const;
34  void decRefCount() const;
35 
36  // Get the reference counter to this identifier.
37  int getCounter(const hid_t obj_id) const;
38  int getCounter() const;
39 
40  // Returns an HDF5 object type, given the object id.
41  static H5I_type_t getHDFObjType(const hid_t obj_id);
42 
43  // Returns an HDF5 object type of this object.
44  H5I_type_t getHDFObjType() const;
45 
46  // Returns the number of members in a type.
47  static hsize_t getNumMembers(H5I_type_t type);
48 
49  // Checks if the given ID is valid.
50  static bool isValid(hid_t an_id);
51 
52  // Determines if an type exists.
53  static bool typeExists(H5I_type_t type);
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 #ifndef DOXYGEN_SHOULD_SKIP_THIS
62 
63  // Gets the identifier of this object.
64  virtual hid_t getId() const = 0;
65 
66  // Pure virtual function for there are various H5*close for the
67  // subclasses.
68  virtual void close() = 0;
69 
70  // Makes and returns the string "<class-name>::<func_name>";
71  // <class-name> is returned by fromClass().
72  H5std_string inMemFunc(const char *func_name) const;
73 
75  virtual H5std_string
76  fromClass() const
77  {
78  return ("IdComponent");
79  }
80 
81 #endif // DOXYGEN_SHOULD_SKIP_THIS
82 
83  // Destructor
84  virtual ~IdComponent();
85 
86 #ifndef DOXYGEN_SHOULD_SKIP_THIS
87 
88  protected:
89  // Default constructor.
90  IdComponent();
91 
92  // Gets the name of the file, in which an HDF5 object belongs.
93  H5std_string p_get_file_name() const;
94 
95  // Verifies that the given id is valid.
96  static bool p_valid_id(const hid_t obj_id);
97 
98  // Sets the identifier of this object to a new value. - this one
99  // doesn't increment reference count
100  virtual void p_setId(const hid_t new_id) = 0;
101 
102  // This flag is used to decide whether H5dont_atexit should be called
103  static bool H5dontAtexit_called;
104 
105  private:
106  // This flag indicates whether H5Library::initH5cpp has been called
107  // to register various terminating functions with atexit()
108  static bool H5cppinit;
109 
110 #endif // DOXYGEN_SHOULD_SKIP_THIS
111 
112 }; // end class IdComponent
113 } // namespace H5
114 
115 #endif // H5IdComponent_H
H5::Exception
Exception provides wrappers of HDF5 error handling functions.
Definition: H5Exception.h:27
H5::IdComponentException
Definition: H5Exception.h:165
H5::IdComponent::incRefCount
void incRefCount() const
Increment reference counter for the id of this object.
Definition: H5IdComponent.cpp:54
H5::IdComponent::typeExists
static bool typeExists(H5I_type_t type)
Queries if a given type is currently registered with the library.
Definition: H5IdComponent.cpp:246
H5::IdComponent::operator=
IdComponent & operator=(const IdComponent &rhs)
Assignment operator.
Definition: H5IdComponent.cpp:277
H5::FileIException
Definition: H5Exception.h:88
H5::IdComponent::decRefCount
void decRefCount() const
Decrement reference counter for the id of this object.
Definition: H5IdComponent.cpp:85
H5::IdComponent::getCounter
int getCounter() const
Returns the reference counter for the id of this object.
Definition: H5IdComponent.cpp:116
H5::IdComponent::~IdComponent
virtual ~IdComponent()
Noop destructor.
Definition: H5IdComponent.cpp:329
H5::H5Library::initH5cpp
static void initH5cpp(void)
Initializes C++ library and registers terminating functions at exit. Only for the library functions,...
Definition: H5Library.cpp:172
H5::Exception::getDetailMsg
H5std_string getDetailMsg() const
Returns the detailed message set at the time the exception is thrown.
Definition: H5Exception.cpp:264
H5::IdComponent
Class IdComponent provides wrappers of the C functions that operate on an HDF5 identifier.
Definition: H5IdComponent.h:26
H5::IdComponent::setId
void setId(const hid_t new_id)
Sets the identifier of this object to a new value.
Definition: H5IdComponent.cpp:315
H5
Definition: H5AbstractDs.cpp:33
H5::IdComponent::isValid
static bool isValid(hid_t an_id)
Checks if the given ID is valid.
Definition: H5IdComponent.cpp:211
H5::IdComponent::getHDFObjType
H5I_type_t getHDFObjType() const
Returns the type of the object. It is an overloaded function of the above function.
Definition: H5IdComponent.cpp:163
H5::IdComponent::getNumMembers
static hsize_t getNumMembers(H5I_type_t type)
Returns the number of members of the given type.
Definition: H5IdComponent.cpp:191


The HDF Group Help Desk:
  Copyright by The HDF Group