Pothos  0.2.1-g9f04573d
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Callable.tmpl.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 
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 
112  #for $NARGS in range($MAX_ARGS)
113  template <typename ReturnType, typename ClassType, $expand('typename A%d', $NARGS)>
115  Callable(ReturnType(ClassType::*fcn)($expand('A%d', $NARGS)));
116 
118  template <typename ReturnType, typename ClassType, $expand('typename A%d', $NARGS)>
119  Callable(ReturnType(ClassType::*fcn)($expand('A%d', $NARGS)) const);
120 
122  template <typename ReturnType, $expand('typename A%d', $NARGS)>
123  Callable(ReturnType(*fcn)($expand('A%d', $NARGS)));
124 
130  template <$expand('typename A%d', $NARGS), typename ReturnType, typename ClassType>
131  static Callable make(ReturnType(ClassType::*fcn)($expand('A%d', $NARGS)));
132 
138  template <$expand('typename A%d', $NARGS), typename ReturnType, typename ClassType>
139  static Callable make(ReturnType(ClassType::*fcn)($expand('A%d', $NARGS)) const);
140 
146  template <$expand('typename A%d', $NARGS), typename ReturnType>
147  static Callable make(ReturnType(*fcn)($expand('A%d', $NARGS)));
148 
153  template <typename ClassType, $expand('typename A%d', $NARGS)>
154  static Callable factory(void);
155 
162  template <typename ClassType, $expand('typename A%d', $NARGS)>
163  static Callable factoryNew(void);
164 
170  template <typename ClassType, $expand('typename A%d', $NARGS)>
171  static Callable factoryShared(void);
172 
173  #end for
174 private:
175  std::vector<Object> _boundArgs;
176  std::shared_ptr<Detail::CallableContainer> _impl;
177  POTHOS_API friend bool operator==(const Callable &lhs, const Callable &rhs);
178 };
179 
188 POTHOS_API bool operator==(const Callable &lhs, const Callable &rhs);
189 
190 } //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)
Definition: Callable.tmpl.hpp:30
Definition: CallInterface.tmpl.hpp:21
Definition: Object.hpp:55