1 /*
2 * @BEGIN LICENSE
3 *
4 * ambit: C++ library for the implementation of tensor product calculations
5 * through a clean, concise user interface.
6 *
7 * Copyright (c) 2014-2017 Ambit developers.
8 *
9 * The copyrights for code used from other parties are included in
10 * the corresponding files.
11 *
12 * This file is part of ambit.
13 *
14 * Ambit is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License as published by
16 * the Free Software Foundation, version 3.
17 *
18 * Ambit is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public License along
24 * with ambit; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 *
27 * @END LICENSE
28 */
29
30 //
31 // Created by Justin Turney on 1/8/16.
32 //
33
34 #include <ambit/io/hdf5/location.h>
35 #include <ambit/io/hdf5/group.h>
36
37 namespace ambit {
38
39 namespace io {
40
41 namespace hdf5 {
42
Location(hid_t id)43 Location::Location(hid_t id)
44 : id_(id)
45 {}
46
~Location()47 Location::~Location()
48 {}
49
id() const50 hid_t Location::id() const noexcept
51 {
52 return id_;
53 }
54
has_link(string const & name) const55 bool Location::has_link(string const& name) const
56 {
57 htri_t res = H5Lexists(id_, name.c_str(), H5P_DEFAULT);
58 assert(res >= 0);
59 return static_cast<bool>(res);
60 }
61
group(const string & name) const62 Group Location::group(const string& name) const
63 {
64 return Group(*this, name);
65 }
66
67 } // namespace hdf5
68
69 } // namespace io
70
71 } // namespace ambit
72