Pothos  0.4.1-gb758ed46
The Pothos dataflow programming software suite
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 
31 {
32 public:
33 
38  Callable(void);
39 
44  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, typename... ArgsType>
114  Callable(ReturnType(ClassType::*fcn)(ArgsType...));
115 
117  template <typename ReturnType, typename ClassType, typename... ArgsType>
118  Callable(ReturnType(ClassType::*fcn)(ArgsType...) const);
119 
121  template <typename ReturnType, typename... ArgsType>
122  Callable(ReturnType(*fcn)(ArgsType...));
123 
130  template <typename ReturnType, typename ClassType, typename... ArgsType>
131  static Callable make(ReturnType(ClassType::*fcn)(ArgsType...));
132 
139  template <typename ReturnType, typename ClassType, typename... ArgsType>
140  static Callable make(ReturnType(ClassType::*fcn)(ArgsType...) const);
141 
148  template <typename ReturnType, typename... ArgsType>
149  static Callable make(ReturnType(*fcn)(ArgsType...));
150 
155  template <typename ClassType, typename... ArgsType>
156  static Callable factory(void);
157 
164  template <typename ClassType, typename... ArgsType>
165  static Callable factoryNew(void);
166 
172  template <typename ClassType, typename... ArgsType>
173  static Callable factoryShared(void);
174 
175 private:
176  std::vector<Object> _boundArgs;
177  std::shared_ptr<Detail::CallableContainer> _impl;
178  POTHOS_API friend bool operator==(const Callable &lhs, const Callable &rhs);
179 };
180 
189 POTHOS_API bool operator==(const Callable &lhs, const Callable &rhs);
190 
191 } //namespace Pothos
#define POTHOS_API
Definition: Config.hpp:41
Definition: Callable.hpp:30
Definition: Testing.hpp:134
bool operator==(const ManagedBuffer &lhs, const ManagedBuffer &rhs)
Definition: ManagedBuffer.hpp:261
Definition: CallInterface.hpp:21
Definition: Object.hpp:55