MISR Toolkit  1.5.1
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 COPYING file, which can be found at the root of the source code *
10  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
11  * If you do not have access to either file, you may request a copy from *
12  * help@hdfgroup.org. *
13  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
14 
15 #ifndef __IdComponent_H
16 #define __IdComponent_H
17 
18 namespace H5 {
19 
28  public:
29 
30  // Increment reference counter.
31  void incRefCount(const hid_t obj_id) const;
32  void incRefCount() const;
33 
34  // Decrement reference counter.
35  void decRefCount(const hid_t obj_id) const;
36  void decRefCount() const;
37 
38  // Get the reference counter to this identifier.
39  int getCounter(const hid_t obj_id) const;
40  int getCounter() const;
41 
42  // Returns an HDF5 object type, given the object id.
43  static H5I_type_t getHDFObjType(const hid_t obj_id);
44 
45  // Returns an HDF5 object type of this object.
46  H5I_type_t getHDFObjType() const;
47 
48  // Checks if the given ID is valid.
49  static bool isValid(hid_t an_id);
50 
51  // Assignment operator.
52  IdComponent& operator=(const IdComponent& rhs);
53 
54  // Sets the identifier of this object to a new value.
55  void setId(const hid_t new_id);
56 
57  // *** Deprecation warning ***
58  // The following two constructors are no longer appropriate after the
59  // data member "id" had been moved to the sub-classes.
60  // The copy constructor is a noop and is removed in 1.8.15 and the
61  // other will be removed from 1.10 release, and then from 1.8 if its
62  // removal does not raise any problems in two 1.10 releases.
63 
64  // Creates an object to hold an HDF5 identifier.
65  // IdComponent(const hid_t h5_id); - removed in 1.8.19
66 
67 #ifndef DOXYGEN_SHOULD_SKIP_THIS
68 
69  // Copy constructor: makes copy of the original IdComponent object.
70  // IdComponent(const IdComponent& original); - removed from 1.8.15
71 
72  // Gets the identifier of this object.
73  virtual hid_t getId () const = 0;
74 
75  // For subclasses to throw appropriate exception, used in H5Location,
76  // H5CommonFG, and H5Object.
77  virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const {};
78 
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 #ifndef DOXYGEN_SHOULD_SKIP_THIS
96 
97  protected:
98 
99  // Default constructor.
100  IdComponent();
101 
102  // Gets the name of the file, in which an HDF5 object belongs.
103  H5std_string p_get_file_name() const;
104 
105  // Verifies that the given id is valid.
106  static bool p_valid_id(const hid_t obj_id);
107 
108  // Sets the identifier of this object to a new value. - this one
109  // doesn't increment reference count
110  virtual void p_setId(const hid_t new_id) = 0;
111 
112  // This flag is used to decide whether H5dont_atexit should be called
113  static bool H5dontAtexit_called;
114 
115  private:
116  // This flag indicates whether H5Library::initH5cpp has been called
117  // to register various terminating functions with atexit()
118  static bool H5cppinit;
119 
120 #endif // DOXYGEN_SHOULD_SKIP_THIS
121 
122 }; // end class IdComponent
123 } // namespace H5
124 
125 #endif // __IdComponent_H
#define H5_DLLCPP
Definition: H5api_adpt.h:262
Class IdComponent provides wrappers of the C functions that operate on an HDF5 identifier.
Definition: H5IdComponent.h:27
H5I_type_t
Definition: H5Ipublic.h:34
static bool H5dontAtexit_called
#define H5std_string
Definition: H5Exception.h:25
int hid_t
Definition: H5Ipublic.h:54
static bool H5cppinit
virtual H5std_string fromClass() const
Returns this class name.
Definition: H5IdComponent.h:88
virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const
Definition: H5IdComponent.h:77

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:52