H5Object_misc.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c), 2017, Adrien Devresse <adrien.devresse@epfl.ch>
3  *
4  * Distributed under the Boost Software License, Version 1.0.
5  * (See accompanying file LICENSE_1_0.txt or copy at
6  * http://www.boost.org/LICENSE_1_0.txt)
7  *
8  */
9 #ifndef H5OBJECT_MISC_HPP
10 #define H5OBJECT_MISC_HPP
11 
12 #include "../H5Exception.hpp"
13 #include "../H5Object.hpp"
14 
15 #include <iostream>
16 
17 namespace HighFive {
18 
19 inline Object::Object() : _hid(H5I_INVALID_HID) {}
20 
21 inline Object::Object(const Object& other) : _hid(other._hid) {
22  if (other.isValid() && H5Iinc_ref(_hid) < 0) {
23  throw ObjectException("Reference counter increase failure");
24  }
25 }
26 
27 inline Object& Object::operator=(const Object& other) {
28  if (this != &other) {
29  if (_hid != H5I_INVALID_HID)
30  H5Idec_ref(_hid);
31 
32  _hid = other._hid;
33  if (other.isValid() && H5Iinc_ref(_hid) < 0) {
34  throw ObjectException("Reference counter increase failure");
35  }
36  }
37  return *this;
38 }
39 
40 inline Object::~Object() {
41  if (isValid() && H5Idec_ref(_hid) < 0) {
42  std::cerr << "HighFive::~Object: reference counter decrease failure"
43  << std::endl;
44  }
45 }
46 
47 inline bool Object::isValid() const {
48  return (_hid != H5I_INVALID_HID) && (H5Iis_valid(_hid) != false);
49 }
50 
51 inline hid_t Object::getId() const { return _hid; }
52 }
53 
54 #endif // H5OBJECT_MISC_HPP
HighFive::Object::getId
hid_t getId() const
getId
Definition: H5Object_misc.hpp:51
HighFive::Object
Definition: H5Object.hpp:21
HighFive::ObjectException
Exception specific to HighFive Object interface.
Definition: H5Exception.hpp:74
HighFive::Object::_hid
hid_t _hid
Definition: H5Object.hpp:48
HighFive::Object::isValid
bool isValid() const
isValid
Definition: H5Object_misc.hpp:47
HighFive::Object::operator=
Object & operator=(const Object &other)
Definition: H5Object_misc.hpp:27
HighFive::Object::Object
Object()
Definition: H5Object_misc.hpp:19
HighFive::Object::~Object
~Object()
Definition: H5Object_misc.hpp:40
HighFive
Definition: H5Annotate_traits.hpp:14


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:23