Pothos  0.2.1-g9f04573d
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
CallRegistryImpl.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 #include <Pothos/Config.hpp>
15 #include <functional> //std::ref
16 
17 namespace Pothos {
18 
19 template <typename ReturnType, typename ClassType, typename InstanceType>
20 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)())
21 {
22  Callable call(method);
23  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
24  this->registerCallable(name, call);
25 }
26 
27 template <typename ReturnType, typename ClassType, typename InstanceType>
28 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)() const)
29 {
30  Callable call(method);
31  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
32  this->registerCallable(name, call);
33 }
34 
35 template <typename A0, typename ReturnType, typename ClassType, typename InstanceType>
36 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0))
37 {
38  Callable call(method);
39  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
40  this->registerCallable(name, call);
41 }
42 
43 template <typename A0, typename ReturnType, typename ClassType, typename InstanceType>
44 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0) const)
45 {
46  Callable call(method);
47  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
48  this->registerCallable(name, call);
49 }
50 
51 template <typename A0, typename A1, typename ReturnType, typename ClassType, typename InstanceType>
52 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1))
53 {
54  Callable call(method);
55  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
56  this->registerCallable(name, call);
57 }
58 
59 template <typename A0, typename A1, typename ReturnType, typename ClassType, typename InstanceType>
60 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1) const)
61 {
62  Callable call(method);
63  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
64  this->registerCallable(name, call);
65 }
66 
67 template <typename A0, typename A1, typename A2, typename ReturnType, typename ClassType, typename InstanceType>
68 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1, A2))
69 {
70  Callable call(method);
71  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
72  this->registerCallable(name, call);
73 }
74 
75 template <typename A0, typename A1, typename A2, typename ReturnType, typename ClassType, typename InstanceType>
76 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1, A2) const)
77 {
78  Callable call(method);
79  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
80  this->registerCallable(name, call);
81 }
82 
83 template <typename A0, typename A1, typename A2, typename A3, typename ReturnType, typename ClassType, typename InstanceType>
84 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1, A2, A3))
85 {
86  Callable call(method);
87  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
88  this->registerCallable(name, call);
89 }
90 
91 template <typename A0, typename A1, typename A2, typename A3, typename ReturnType, typename ClassType, typename InstanceType>
92 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1, A2, A3) const)
93 {
94  Callable call(method);
95  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
96  this->registerCallable(name, call);
97 }
98 
99 template <typename A0, typename A1, typename A2, typename A3, typename A4, typename ReturnType, typename ClassType, typename InstanceType>
100 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1, A2, A3, A4))
101 {
102  Callable call(method);
103  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
104  this->registerCallable(name, call);
105 }
106 
107 template <typename A0, typename A1, typename A2, typename A3, typename A4, typename ReturnType, typename ClassType, typename InstanceType>
108 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1, A2, A3, A4) const)
109 {
110  Callable call(method);
111  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
112  this->registerCallable(name, call);
113 }
114 
115 template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename ReturnType, typename ClassType, typename InstanceType>
116 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1, A2, A3, A4, A5))
117 {
118  Callable call(method);
119  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
120  this->registerCallable(name, call);
121 }
122 
123 template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename ReturnType, typename ClassType, typename InstanceType>
124 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1, A2, A3, A4, A5) const)
125 {
126  Callable call(method);
127  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
128  this->registerCallable(name, call);
129 }
130 
131 template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename ReturnType, typename ClassType, typename InstanceType>
132 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1, A2, A3, A4, A5, A6))
133 {
134  Callable call(method);
135  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
136  this->registerCallable(name, call);
137 }
138 
139 template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename ReturnType, typename ClassType, typename InstanceType>
140 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1, A2, A3, A4, A5, A6) const)
141 {
142  Callable call(method);
143  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
144  this->registerCallable(name, call);
145 }
146 
147 template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename ReturnType, typename ClassType, typename InstanceType>
148 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1, A2, A3, A4, A5, A6, A7))
149 {
150  Callable call(method);
151  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
152  this->registerCallable(name, call);
153 }
154 
155 template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename ReturnType, typename ClassType, typename InstanceType>
156 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1, A2, A3, A4, A5, A6, A7) const)
157 {
158  Callable call(method);
159  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
160  this->registerCallable(name, call);
161 }
162 
163 template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename ReturnType, typename ClassType, typename InstanceType>
164 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1, A2, A3, A4, A5, A6, A7, A8))
165 {
166  Callable call(method);
167  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
168  this->registerCallable(name, call);
169 }
170 
171 template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename ReturnType, typename ClassType, typename InstanceType>
172 void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(A0, A1, A2, A3, A4, A5, A6, A7, A8) const)
173 {
174  Callable call(method);
175  call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
176  this->registerCallable(name, call);
177 }
178 
179 
180 } //namespace Pothos
Callable & bind(ValueType &&val, const size_t argNo)
Definition: CallableImpl.hpp:35
Definition: Callable.tmpl.hpp:30
void registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)($expand('A%d', $NARGS)))
Definition: CallRegistryImpl.tmpl.hpp:21
virtual void registerCallable(const std::string &name, const Callable &call)=0