echelon  0.8.0
slice.hpp
1 // Copyright (c) 2012-2014 Christopher Hinz
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #ifndef ECHELON_SLICE_HPP
7 #define ECHELON_SLICE_HPP
8 
9 #include <echelon/hdf5/slice.hpp>
10 
11 #include <echelon/range.hpp>
12 
13 #include <cassert>
14 #include <vector>
15 #include <tuple>
16 
17 namespace echelon
18 {
19 
22 class slice
23 {
24 public:
25  explicit slice(hdf5::slice native_slice_);
26 
36  template <typename T>
37  void operator<<=(const T& source)
38  {
39  native_slice_ <<= source;
40  }
41 
50  template <typename T>
51  friend void operator<<=(T& sink, const slice& source)
52  {
53  sink <<= source.native_slice_;
54  }
55 
56  template <typename T>
57  friend void operator<<=(const hdf5::array_slice<T>& sink, const slice& source)
58  {
59  sink <<= source.native_slice_;
60  }
61 
64  const std::vector<hsize_t>& shape() const;
65 
66 private:
67  hdf5::slice native_slice_;
68 };
69 }
70 
71 #endif
echelon&#39;s core namespace
Definition: attribute.cpp:10
A slice (rectangular portion) of an HDF5 dataset.
Definition: hdf5/slice.hpp:27
const std::vector< hsize_t > & shape() const
The shape of the slice.
Definition: slice.cpp:17
void operator<<=(const T &source)
Writes the content of a data source into the slice.
Definition: slice.hpp:37
friend void operator<<=(T &sink, const slice &source)
Reads the content of the slice into a data sink.
Definition: slice.hpp:51
A slice (rectangular portion) of an HDF5 dataset.
Definition: slice.hpp:22