libpniio
selection.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: Aug 1, 2014
21 // Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
22 //
23 #pragma once
24 
25 #include "type_imp.hpp"
26 
27 
28 namespace pni{
29 namespace io{
30 namespace nx{
31 namespace h5{
32 
37  class selection
38  {
39  private:
46 
47  public:
48  //----------------------------------------------------------------
49  // Constructors
50  //----------------------------------------------------------------
54  selection() noexcept;
55 
56  //----------------------------------------------------------------
62  selection(size_t n);
63 
64  //----------------------------------------------------------------
65  // Data access methods
66  //----------------------------------------------------------------
70  const type_imp::index_vector_type &offset() const noexcept;
71 
72  //----------------------------------------------------------------
83  void offset(const type_imp::index_vector_type &offset);
84 
85  //----------------------------------------------------------------
93  void offset(type_imp::index_type value) noexcept;
94 
95  //----------------------------------------------------------------
107  void offset(size_t index,size_t value);
108 
109  //----------------------------------------------------------------
113  const type_imp::index_vector_type &stride() const noexcept;
114 
115  //----------------------------------------------------------------
126  void stride(const type_imp::index_vector_type &value);
127 
128  //----------------------------------------------------------------
136  void stride(type_imp::index_type value) noexcept;
137 
138  //----------------------------------------------------------------
150  void stride(size_t index,type_imp::index_type value);
151 
152  //----------------------------------------------------------------
156  const type_imp::index_vector_type &count() const noexcept;
157 
158  //----------------------------------------------------------------
169  void count(const type_imp::index_vector_type &value);
170 
171  //----------------------------------------------------------------
179  void count(type_imp::index_type value) noexcept;
180 
181  //----------------------------------------------------------------
193  void count(size_t index,type_imp::index_type value);
194 
195  //----------------------------------------------------------------
206  void update(const type_imp::selection_vector_type &s);
207 
208  };
209 
219  size_t effective_rank(const selection &s) noexcept;
220 
221  //------------------------------------------------------------------------
232  type_imp::index_vector_type effective_shape(const selection &s);
233 
234  //------------------------------------------------------------------------
244  size_t size(const selection &s) noexcept;
245 
246  //------------------------------------------------------------------------
255  selection create_selection(const type_imp::selection_vector_type &s);
256 
257  //------------------------------------------------------------------------
267  type_imp::selection_vector_type create_slice_vector(const selection &s);
268 
269 
270 
271 //end of namespace
272 }
273 }
274 }
275 }
276 
size_t effective_rank(const selection &s) noexcept
get effective rank
Definition: selection.cpp:163
selection() noexcept
default constructor
Definition: selection.cpp:36
const type_imp::index_vector_type & offset() const noexcept
get reference to offset vector
Definition: selection.cpp:55
void update(const type_imp::selection_vector_type &s)
update selection
Definition: selection.cpp:144
const type_imp::index_vector_type & stride() const noexcept
get refeference to stride vector
Definition: selection.cpp:87
provide implementation specific types
Definition: type_imp.hpp:46
size_t size(const selection &s) noexcept
get selection size
Definition: selection.cpp:181
type_imp::selection_vector_type create_slice_vector(const selection &s)
Definition: selection.cpp:201
type_imp::index_vector_type _count
buffer for count values
Definition: selection.hpp:45
type_imp::index_vector_type _offset
buffer for offset values
Definition: selection.hpp:41
Definition: cbf_reader.hpp:41
type_imp::index_vector_type _stride
buffer for stride values
Definition: selection.hpp:43
describe a selection in an HDF5 file
Definition: selection.hpp:37
selection create_selection(const type_imp::selection_vector_type &s)
Definition: selection.cpp:192
type_imp::index_vector_type effective_shape(const selection &s)
get effective shape
Definition: selection.cpp:171
std::vector< index_type > index_vector_type
container type for counters
Definition: type_imp.hpp:52
const type_imp::index_vector_type & count() const noexcept
get reference to count vector
Definition: selection.cpp:119