libpniio
file_imp.hpp
Go to the documentation of this file.
1 //
2 // (c) Copyright 2014 DESY, Eugen Wintersberger <eugen.wintersberger@desy.de>
3 //
4 // This file is part of libpniio.
5 //
6 // libpniio is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // libpniio is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with libpniio. If not, see <http://www.gnu.org/licenses/>.
18 //************************************************************************
19 //
20 // Created on: Jul 16, 2014
21 // Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
22 //
23 
24 #pragma once
25 
26 extern "C"{
27 #include <hdf5.h>
28 }
29 
30 #include "object_imp.hpp"
31 
32 namespace pni{
33 namespace io{
34 namespace nx{
35 namespace h5{
36 
37  //forward declaration of group implemenation
38  class group_imp;
39 
49  class file_imp
50  {
51  private:
54  public:
55  //===============constructors and destructors======================
59  explicit file_imp() noexcept;
60 
61  //-----------------------------------------------------------------
72  explicit file_imp(object_imp &&o);
73 
74  //=====================factory methods=============================
90  static file_imp open(const pni::core::string &n,bool ro=true);
91 
92  //-----------------------------------------------------------------
111  static file_imp create(const pni::core::string &path,bool ow=false,
112  ssize_t ssize=0);
113 
114  //====================misc methods=================================
121  void close();
122 
123  //-----------------------------------------------------------------
130  void flush() const;
131 
132  //-----------------------------------------------------------------
142  bool is_readonly() const;
143 
144  //-----------------------------------------------------------------
153  bool is_valid() const;
154 
155  //----------------------------------------------------------------
167  group_imp root() const;
168 
169 
170  };
171 
172 
173 //end of namespace
174 }
175 }
176 }
177 }
static file_imp open(const pni::core::string &n, bool ro=true)
open an existing file
Definition: file_imp.cpp:90
file_imp() noexcept
default constructor
Definition: file_imp.cpp:56
HDF5 group object.
Definition: group_imp.hpp:47
static file_imp create(const pni::core::string &path, bool ow=false, ssize_t ssize=0)
create a new file
Definition: file_imp.cpp:119
Definition: cbf_reader.hpp:41
group_imp root() const
get root
Definition: file_imp.cpp:190
basic HDF5 ID wrapper
Definition: object_imp.hpp:59
void flush() const
flush the file
Definition: file_imp.cpp:161
HDF5 file implementation.
Definition: file_imp.hpp:49
bool is_valid() const
check object validity
Definition: file_imp.cpp:169
bool is_readonly() const
return true if file is read-only
Definition: file_imp.cpp:175
object_imp _object
the HDF5 object
Definition: file_imp.hpp:53
void close()
close the file
Definition: file_imp.cpp:70