RISA
Memory.h
Go to the documentation of this file.
1 /*
2  * This file is part of the GLADOS-library.
3  *
4  * Copyright (C) 2016 Helmholtz-Zentrum Dresden-Rossendorf
5  *
6  * GLADOS is free software: You can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * GLADOS 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 Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with GLADOS. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Date: 30 November 2016
20  * Authors: Tobias Frust <t.frust@hzdr.de>
21  *
22  */
23 
24 #ifndef MEMORY_H_
25 #define MEMORY_H_
26 
27 #include <algorithm>
28 #include <cstddef>
29 #include <memory>
30 
31 #include "../Memory.h"
32 
33 namespace glados
34 {
35  namespace def
36  {
38  {
39  protected:
40  ~copy_policy() = default;
41 
42  /* 1D copies */
43  template <class Dest, class Src>
44  inline auto copy(Dest& dest, const Src& src, std::size_t size) -> void
45  {
46  std::copy(src.get(), src.get() + size, dest.get());
47  }
48 
49  /* 2D copies */
50  template <class Dest, class Src>
51  inline auto copy(Dest& dest, const Src& src, std::size_t width, std::size_t height) -> void
52  {
53  std::copy(src.get(), src.get() + width * height, dest.get());
54  }
55 
56  /* 3D copies */
57  template <class Dest, class Src>
58  inline auto copy(Dest& dest, const Src& src, std::size_t width, std::size_t height, std::size_t depth) -> void
59  {
60  std::copy(src.get(), src.get() + width * height * depth, dest.get());
61  }
62  };
63 
66  }
67 }
68 
69 
70 
71 #endif /* MEMORY_H_ */
auto copy(Dest &dest, const Src &src, std::size_t size) -> void
Definition: Memory.h:44
auto copy(Dest &dest, const Src &src, std::size_t width, std::size_t height) -> void
Definition: Memory.h:51
auto copy(Dest &dest, const Src &src, std::size_t width, std::size_t height, std::size_t depth) -> void
Definition: Memory.h:58