Generative Fast Fourier Transforms (GFFT)  0.3
gfftcaller.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2014 by Vladimir Mirnyy *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  ***************************************************************************/
14 
15 #ifndef __caller_h
16 #define __caller_h
17 
18 #include "Typelist.h"
19 
25 namespace GFFT {
26 
27 
37 template<class TList>
38 struct Caller;
39 
40 template<class Head, class Tail>
41 struct Caller<Loki::Typelist<Head,Tail> >
42 {
43  template<typename T>
44  void apply(T* data) {
45  obj_.apply(data);
46  next_.apply(data);
47  }
48 
49  template<typename T>
50  void apply(const T* src, T* dst) {
51  obj_.apply(src, dst);
52  next_.apply(src, dst);
53  }
54 
55 private:
56  Head obj_;
57  Caller<Tail> next_;
58 };
59 
60 
61 
62 template<>
63 struct Caller<Loki::NullType>
64 {
65  template<typename T>
66  void apply(T*) { }
67 
68  template<typename T>
69  void apply(const T*, T*) { }
70 };
71 
72 
81 template<class TList>
82 struct StaticCaller;
83 
84 template<class Head, class Tail>
85 struct StaticCaller<Loki::Typelist<Head,Tail> >
86 {
87  template<typename T>
88  static void apply(T* data) {
89  Head::apply(data);
91  }
92 
93  template<typename T>
94  static void apply(const T* src, T* dst) {
95  Head::apply(src, dst);
96  StaticCaller<Tail>::apply(src, dst);
97  }
98 };
99 
100 template<>
101 struct StaticCaller<Loki::NullType>
102 {
103  template<typename T>
104  static void apply(T*) { }
105 
106  template<typename T>
107  static void apply(const T*, T*) { }
108 };
109 
110 } // namespace GFFT
111 
112 #endif /*__caller_h*/

Generated on Mon Feb 10 2014 for Generative Fast Fourier Transforms (GFFT) by DoxyGen 1.8.3.1