Pothos  0.2.1-g9f04573d
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Callable.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 #include <Pothos/Config.hpp>
14 #include <Pothos/Object/Object.hpp>
15 #include <vector>
16 #include <memory>
17 
18 namespace Pothos {
19 
20 //messy forward declares
21 namespace Detail {
22 struct CallableContainer;
23 } //namespace Detail
24 
30 class POTHOS_API Callable : public CallInterface
31 {
32 public:
33 
38  Callable(void);
39 
44  pothos_explicit operator bool(void) const;
45 
55  Object opaqueCall(const Object *inputArgs, const size_t numArgs) const;
56 
62  size_t getNumArgs(void) const;
63 
72  const std::type_info &type(const int argNo) const;
73 
83  template <typename ValueType>
84  Callable &bind(ValueType &&val, const size_t argNo);
85 
95  Callable &bind(Object &&val, const size_t argNo);
96 
103  Callable &unbind(const size_t argNo);
104 
110  std::string toString(void) const;
111 
113  template <typename ReturnType, typename ClassType>
114  Callable(ReturnType(ClassType::*fcn)());
115 
117  template <typename ReturnType, typename ClassType>
118  Callable(ReturnType(ClassType::*fcn)() const);
119 
121  template <typename ReturnType>
122  Callable(ReturnType(*fcn)());
123 
129  template <typename ReturnType, typename ClassType>
130  static Callable make(ReturnType(ClassType::*fcn)());
131 
137  template <typename ReturnType, typename ClassType>
138  static Callable make(ReturnType(ClassType::*fcn)() const);
139 
145  template <typename ReturnType>
146  static Callable make(ReturnType(*fcn)());
147 
152  template <typename ClassType>
153  static Callable factory(void);
154 
161  template <typename ClassType>
162  static Callable factoryNew(void);
163 
169  template <typename ClassType>
170  static Callable factoryShared(void);
171 
173  template <typename ReturnType, typename ClassType, typename A0>
174  Callable(ReturnType(ClassType::*fcn)(A0));
175 
177  template <typename ReturnType, typename ClassType, typename A0>
178  Callable(ReturnType(ClassType::*fcn)(A0) const);
179 
181  template <typename ReturnType, typename A0>
182  Callable(ReturnType(*fcn)(A0));
183 
189  template <typename A0, typename ReturnType, typename ClassType>
190  static Callable make(ReturnType(ClassType::*fcn)(A0));
191 
197  template <typename A0, typename ReturnType, typename ClassType>
198  static Callable make(ReturnType(ClassType::*fcn)(A0) const);
199 
205  template <typename A0, typename ReturnType>
206  static Callable make(ReturnType(*fcn)(A0));
207 
212  template <typename ClassType, typename A0>
213  static Callable factory(void);
214 
221  template <typename ClassType, typename A0>
222  static Callable factoryNew(void);
223 
229  template <typename ClassType, typename A0>
230  static Callable factoryShared(void);
231 
233  template <typename ReturnType, typename ClassType, typename A0, typename A1>
234  Callable(ReturnType(ClassType::*fcn)(A0, A1));
235 
237  template <typename ReturnType, typename ClassType, typename A0, typename A1>
238  Callable(ReturnType(ClassType::*fcn)(A0, A1) const);
239 
241  template <typename ReturnType, typename A0, typename A1>
242  Callable(ReturnType(*fcn)(A0, A1));
243 
249  template <typename A0, typename A1, typename ReturnType, typename ClassType>
250  static Callable make(ReturnType(ClassType::*fcn)(A0, A1));
251 
257  template <typename A0, typename A1, typename ReturnType, typename ClassType>
258  static Callable make(ReturnType(ClassType::*fcn)(A0, A1) const);
259 
265  template <typename A0, typename A1, typename ReturnType>
266  static Callable make(ReturnType(*fcn)(A0, A1));
267 
272  template <typename ClassType, typename A0, typename A1>
273  static Callable factory(void);
274 
281  template <typename ClassType, typename A0, typename A1>
282  static Callable factoryNew(void);
283 
289  template <typename ClassType, typename A0, typename A1>
290  static Callable factoryShared(void);
291 
293  template <typename ReturnType, typename ClassType, typename A0, typename A1, typename A2>
294  Callable(ReturnType(ClassType::*fcn)(A0, A1, A2));
295 
297  template <typename ReturnType, typename ClassType, typename A0, typename A1, typename A2>
298  Callable(ReturnType(ClassType::*fcn)(A0, A1, A2) const);
299 
301  template <typename ReturnType, typename A0, typename A1, typename A2>
302  Callable(ReturnType(*fcn)(A0, A1, A2));
303 
309  template <typename A0, typename A1, typename A2, typename ReturnType, typename ClassType>
310  static Callable make(ReturnType(ClassType::*fcn)(A0, A1, A2));
311 
317  template <typename A0, typename A1, typename A2, typename ReturnType, typename ClassType>
318  static Callable make(ReturnType(ClassType::*fcn)(A0, A1, A2) const);
319 
325  template <typename A0, typename A1, typename A2, typename ReturnType>
326  static Callable make(ReturnType(*fcn)(A0, A1, A2));
327 
332  template <typename ClassType, typename A0, typename A1, typename A2>
333  static Callable factory(void);
334 
341  template <typename ClassType, typename A0, typename A1, typename A2>
342  static Callable factoryNew(void);
343 
349  template <typename ClassType, typename A0, typename A1, typename A2>
350  static Callable factoryShared(void);
351 
353  template <typename ReturnType, typename ClassType, typename A0, typename A1, typename A2, typename A3>
354  Callable(ReturnType(ClassType::*fcn)(A0, A1, A2, A3));
355 
357  template <typename ReturnType, typename ClassType, typename A0, typename A1, typename A2, typename A3>
358  Callable(ReturnType(ClassType::*fcn)(A0, A1, A2, A3) const);
359 
361  template <typename ReturnType, typename A0, typename A1, typename A2, typename A3>
362  Callable(ReturnType(*fcn)(A0, A1, A2, A3));
363 
369  template <typename A0, typename A1, typename A2, typename A3, typename ReturnType, typename ClassType>
370  static Callable make(ReturnType(ClassType::*fcn)(A0, A1, A2, A3));
371 
377  template <typename A0, typename A1, typename A2, typename A3, typename ReturnType, typename ClassType>
378  static Callable make(ReturnType(ClassType::*fcn)(A0, A1, A2, A3) const);
379 
385  template <typename A0, typename A1, typename A2, typename A3, typename ReturnType>
386  static Callable make(ReturnType(*fcn)(A0, A1, A2, A3));
387 
392  template <typename ClassType, typename A0, typename A1, typename A2, typename A3>
393  static Callable factory(void);
394 
401  template <typename ClassType, typename A0, typename A1, typename A2, typename A3>
402  static Callable factoryNew(void);
403 
409  template <typename ClassType, typename A0, typename A1, typename A2, typename A3>
410  static Callable factoryShared(void);
411 
413  template <typename ReturnType, typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4>
414  Callable(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4));
415 
417  template <typename ReturnType, typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4>
418  Callable(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4) const);
419 
421  template <typename ReturnType, typename A0, typename A1, typename A2, typename A3, typename A4>
422  Callable(ReturnType(*fcn)(A0, A1, A2, A3, A4));
423 
429  template <typename A0, typename A1, typename A2, typename A3, typename A4, typename ReturnType, typename ClassType>
430  static Callable make(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4));
431 
437  template <typename A0, typename A1, typename A2, typename A3, typename A4, typename ReturnType, typename ClassType>
438  static Callable make(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4) const);
439 
445  template <typename A0, typename A1, typename A2, typename A3, typename A4, typename ReturnType>
446  static Callable make(ReturnType(*fcn)(A0, A1, A2, A3, A4));
447 
452  template <typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4>
453  static Callable factory(void);
454 
461  template <typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4>
462  static Callable factoryNew(void);
463 
469  template <typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4>
470  static Callable factoryShared(void);
471 
473  template <typename ReturnType, typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
474  Callable(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5));
475 
477  template <typename ReturnType, typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
478  Callable(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5) const);
479 
481  template <typename ReturnType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
482  Callable(ReturnType(*fcn)(A0, A1, A2, A3, A4, A5));
483 
489  template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename ReturnType, typename ClassType>
490  static Callable make(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5));
491 
497  template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename ReturnType, typename ClassType>
498  static Callable make(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5) const);
499 
505  template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename ReturnType>
506  static Callable make(ReturnType(*fcn)(A0, A1, A2, A3, A4, A5));
507 
512  template <typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
513  static Callable factory(void);
514 
521  template <typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
522  static Callable factoryNew(void);
523 
529  template <typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
530  static Callable factoryShared(void);
531 
533  template <typename ReturnType, typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
534  Callable(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5, A6));
535 
537  template <typename ReturnType, typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
538  Callable(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5, A6) const);
539 
541  template <typename ReturnType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
542  Callable(ReturnType(*fcn)(A0, A1, A2, A3, A4, A5, A6));
543 
549  template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename ReturnType, typename ClassType>
550  static Callable make(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5, A6));
551 
557  template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename ReturnType, typename ClassType>
558  static Callable make(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5, A6) const);
559 
565  template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename ReturnType>
566  static Callable make(ReturnType(*fcn)(A0, A1, A2, A3, A4, A5, A6));
567 
572  template <typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
573  static Callable factory(void);
574 
581  template <typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
582  static Callable factoryNew(void);
583 
589  template <typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
590  static Callable factoryShared(void);
591 
593  template <typename ReturnType, typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
594  Callable(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5, A6, A7));
595 
597  template <typename ReturnType, typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
598  Callable(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5, A6, A7) const);
599 
601  template <typename ReturnType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
602  Callable(ReturnType(*fcn)(A0, A1, A2, A3, A4, A5, A6, A7));
603 
609  template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename ReturnType, typename ClassType>
610  static Callable make(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5, A6, A7));
611 
617  template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename ReturnType, typename ClassType>
618  static Callable make(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5, A6, A7) const);
619 
625  template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename ReturnType>
626  static Callable make(ReturnType(*fcn)(A0, A1, A2, A3, A4, A5, A6, A7));
627 
632  template <typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
633  static Callable factory(void);
634 
641  template <typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
642  static Callable factoryNew(void);
643 
649  template <typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
650  static Callable factoryShared(void);
651 
653  template <typename ReturnType, typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
654  Callable(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5, A6, A7, A8));
655 
657  template <typename ReturnType, typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
658  Callable(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5, A6, A7, A8) const);
659 
661  template <typename ReturnType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
662  Callable(ReturnType(*fcn)(A0, A1, A2, A3, A4, A5, A6, A7, A8));
663 
669  template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename ReturnType, typename ClassType>
670  static Callable make(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5, A6, A7, A8));
671 
677  template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename ReturnType, typename ClassType>
678  static Callable make(ReturnType(ClassType::*fcn)(A0, A1, A2, A3, A4, A5, A6, A7, A8) const);
679 
685  template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename ReturnType>
686  static Callable make(ReturnType(*fcn)(A0, A1, A2, A3, A4, A5, A6, A7, A8));
687 
692  template <typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
693  static Callable factory(void);
694 
701  template <typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
702  static Callable factoryNew(void);
703 
709  template <typename ClassType, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
710  static Callable factoryShared(void);
711 
712 private:
713  std::vector<Object> _boundArgs;
714  std::shared_ptr<Detail::CallableContainer> _impl;
715  POTHOS_API friend bool operator==(const Callable &lhs, const Callable &rhs);
716 };
717 
726 POTHOS_API bool operator==(const Callable &lhs, const Callable &rhs);
727 
728 } //namespace Pothos
#define pothos_explicit
Definition: Config.hpp:85
#define POTHOS_API
Definition: Config.hpp:41
POTHOS_API bool operator==(const Callable &lhs, const Callable &rhs)