Pothos
0.4.1-gb758ed46
The Pothos dataflow programming software suite
|
#include <Callable.hpp>
Public Member Functions | |
Callable (void) | |
operator bool (void) const | |
Object | opaqueCall (const Object *inputArgs, const size_t numArgs) const |
size_t | getNumArgs (void) const |
const std::type_info & | type (const int argNo) const |
template<typename ValueType > | |
Callable & | bind (ValueType &&val, const size_t argNo) |
Callable & | bind (Object &&val, const size_t argNo) |
Callable & | unbind (const size_t argNo) |
std::string | toString (void) const |
template<typename ReturnType , typename ClassType , typename... ArgsType> | |
Callable (ReturnType(ClassType::*fcn)(ArgsType...)) | |
Create a Callable for a class method with variable args. More... | |
template<typename ReturnType , typename ClassType , typename... ArgsType> | |
Callable (ReturnType(ClassType::*fcn)(ArgsType...) const) | |
Create a Callable for a const class method with variable args. More... | |
template<typename ReturnType , typename... ArgsType> | |
Callable (ReturnType(*fcn)(ArgsType...)) | |
Create a Callable for a function with variable args. More... | |
Public Member Functions inherited from Pothos::CallInterface | |
virtual | ~CallInterface (void) |
template<typename ReturnType , typename... ArgsType> | |
ReturnType | call (ArgsType &&...args) const |
Call a bound method/function with a return type and variable args. More... | |
template<typename... ArgsType> | |
Object | callObject (ArgsType &&...args) const |
Call a bound method/function with an Object return and variable args. More... | |
template<typename... ArgsType> | |
void | callVoid (ArgsType &&...args) const |
Call a bound method/function with a void return and variable args. More... | |
Static Public Member Functions | |
template<typename ReturnType , typename ClassType , typename... ArgsType> | |
static Callable | make (ReturnType(ClassType::*fcn)(ArgsType...)) |
template<typename ReturnType , typename ClassType , typename... ArgsType> | |
static Callable | make (ReturnType(ClassType::*fcn)(ArgsType...) const) |
template<typename ReturnType , typename... ArgsType> | |
static Callable | make (ReturnType(*fcn)(ArgsType...)) |
template<typename ClassType , typename... ArgsType> | |
static Callable | factory (void) |
template<typename ClassType , typename... ArgsType> | |
static Callable | factoryNew (void) |
template<typename ClassType , typename... ArgsType> | |
static Callable | factoryShared (void) |
Friends | |
POTHOS_API friend bool | operator== (const Callable &lhs, const Callable &rhs) |
Additional Inherited Members |
The Callable class binds a class method or function. The method/function can be called through an opaque Object interface, or through a templated call interface with an arbitrary number of args.
Pothos::Callable::Callable | ( | void | ) |
Create a null Callable. Calling a null instance will throw CallableNullError.
Pothos::Callable::Callable | ( | ReturnType(ClassType::*)(ArgsType...) | fcn | ) |
Create a Callable for a class method with variable args.
Pothos::Callable::Callable | ( | ReturnType(ClassType::*)(ArgsType...) const | fcn | ) |
Create a Callable for a const class method with variable args.
Pothos::Callable::Callable | ( | ReturnType(*)(ArgsType...) | fcn | ) |
Create a Callable for a function with variable args.
Callable & Pothos::Callable::bind | ( | ValueType && | val, |
const size_t | argNo | ||
) |
Bind an argument to the given argument index - template version. The user will not specify this argument at call time, the bound argument will be used as a substitute. The bind call does not throw.
val | the value to put into the argument list |
argNo | the argument index to bind to |
Bind an argument to the given argument index - Object version. The user will not specify this argument at call time, the bound argument will be used as a substitute. The bind call does not throw.
val | the value to put into the argument list |
argNo | the argument index to bind to |
|
static |
Create a Callable for a constructor with variable args. Template arguments must be explicitly specified.
|
static |
Create a Callable for a constructor with variable args. The callable return type is a pointer to ClassType*. The user is responsible for managing the memory. Template arguments must be explicitly specified.
|
static |
Create a Callable for a constructor with variable args. The callable return type is a std::shared_ptr<ClassType>. Template arguments must be explicitly specified.
size_t Pothos::Callable::getNumArgs | ( | void | ) | const |
Get the number of arguments for this call. For methods, the class instance also counts
|
static |
Create a Callable for a class method with variable args. Use make to specify explicit template arguments to differentiate overloads with the same name. In this case, the entire pack must be specified.
|
static |
Create a Callable for a const class method with variable args. Use make to specify explicit template arguments to differentiate overloads with the same name. In this case, the entire pack must be specified.
|
static |
Create a Callable for a function with variable args. Use make to specify explicit template arguments to differentiate overloads with the same name. In this case, the entire pack must be specified.
|
virtual |
Call into the function/method with opaque input and return types. For a void return type of call, the returned Object will be null.
CallableNullError | if the Callable is null |
CallableArgumentError | for bad arguments in number or type |
inputArgs | an array of call arguments of type Object |
numArgs | the number of arguments in inputArgs |
Implements Pothos::CallInterface.
|
explicit |
Does the Callable hold a bound function?
std::string Pothos::Callable::toString | ( | void | ) | const |
Get a string representation for this Callable. The string holds the return type, and argument types.
const std::type_info& Pothos::Callable::type | ( | const int | argNo | ) | const |
Get the type info for a particular argument. For the return type, use argNo = -1. For argument 0 use argNo = 0, etc. For methods, argNo = 0 is the class type.
CallableArgumentError | if the argNo is invalid |
Callable& Pothos::Callable::unbind | ( | const size_t | argNo | ) |
Remove a binding at the given argument index. The unbind call does not throw.
argNo | the argument index to clear |
|
friend |
The equals operators checks if two Callable represent the same internal data. The actual bound functions/methods cannot be checked for equality. Two callables are only equal if they originated from the same construction.
lhs | the left hand object of the comparison |
rhs | the right hand object of the comparison |