Field3D

Scoped object - Opens attribute by name and closes it on destruction. More...

#include <Hdf5Util.h>

Inheritance diagram for Hdf5Util::H5ScopedAopen:
Hdf5Util::H5Base

Public Member Functions

 H5ScopedAopen (hid_t location, const std::string &name)
 
 H5ScopedAopen (hid_t location, const std::string &name, hid_t aapl_id)
 
 ~H5ScopedAopen ()
 
- Public Member Functions inherited from Hdf5Util::H5Base
 H5Base ()
 
hid_t id () const
 Query the hid_t value. More...
 
 operator hid_t ()
 Implicit cast to hid_t. More...
 

Additional Inherited Members

- Protected Attributes inherited from Hdf5Util::H5Base
hid_t m_id
 

Detailed Description

Scoped object - Opens attribute by name and closes it on destruction.

Definition at line 113 of file Hdf5Util.h.

Constructor & Destructor Documentation

◆ H5ScopedAopen() [1/2]

Hdf5Util::H5ScopedAopen::H5ScopedAopen ( hid_t  location,
const std::string &  name 
)
inline

Definition at line 116 of file Hdf5Util.h.

117  {
118  GlobalLock lock(g_hdf5Mutex);
119  m_id = H5Aopen(location, name.c_str(), H5P_DEFAULT);
120  if (m_id < 0)
121  throw Exc::MissingAttributeException("Couldn't open attribute " + name);
122  }

References g_hdf5Mutex, and Hdf5Util::H5Base::m_id.

◆ H5ScopedAopen() [2/2]

Hdf5Util::H5ScopedAopen::H5ScopedAopen ( hid_t  location,
const std::string &  name,
hid_t  aapl_id 
)
inline

Definition at line 123 of file Hdf5Util.h.

124  {
125  GlobalLock lock(g_hdf5Mutex);
126  m_id = H5Aopen(location, name.c_str(), aapl_id);
127  if (m_id < 0)
128  throw Exc::MissingAttributeException("Couldn't open attribute " + name);
129  }

References g_hdf5Mutex, and Hdf5Util::H5Base::m_id.

◆ ~H5ScopedAopen()

Hdf5Util::H5ScopedAopen::~H5ScopedAopen ( )
inline

Definition at line 130 of file Hdf5Util.h.

131  {
132  GlobalLock lock(g_hdf5Mutex);
133  if (m_id >= 0)
134  H5Aclose(m_id);
135  }

References g_hdf5Mutex, and Hdf5Util::H5Base::m_id.


The documentation for this class was generated from the following file:
g_hdf5Mutex
FIELD3D_NAMESPACE_OPEN FIELD3D_API boost::recursive_mutex g_hdf5Mutex
Definition: Hdf5Util.cpp:67
GlobalLock
boost::recursive_mutex::scoped_lock GlobalLock
Definition: Hdf5Util.h:78
Hdf5Util::H5Base::m_id
hid_t m_id
Definition: Hdf5Util.h:106