![]() |
Scanframe Modular Application 0.1.0
|
Encapsulates the std::function() template. More...
#include <TClosure.h>
Public Types | |
| typedef std::function< Result(Args...)> | func_type |
| Function type of the lambda or function. | |
Public Member Functions | |
| TClosure ()=default | |
| Default constructor. | |
| TClosure (const TClosure &c) | |
| Copy constructor. | |
| TClosure (const func_type &fn) | |
| Function assignment constructor. | |
| TClosure & | assign (const func_type &fn) |
| Function assignment method for static function. | |
| template<typename ClassType , typename MethodType , typename... BoundArgs> | |
| TClosure & | assign (ClassType *cls, MethodType mtd, BoundArgs... args) |
| Binds a non-static class member function to this instance. | |
| TClosure & | unassign () |
| Releases the bind function. | |
| TClosure & | operator= (const TClosure &c) |
| Closure assignment operator. | |
| TClosure & | operator= (const func_type &f) |
| Closure assignment operator. | |
| Result | operator() (Args... args) const |
| Make the call to the member function. | |
| bool | isAssigned () const |
| Checks if the closure is valid for calling. | |
| operator bool () const | |
| Checks if the closure is valid for calling. | |
Protected Member Functions | |
| Result | call (Args... args) const |
| Makes the call to the member function. | |
Encapsulates the std::function() template.
| Result | Return type of the function. |
| Args | Variable amount of function arguments. |
| typedef std::function<Result(Args...)> sf::TClosure< Result, Args >::func_type |
Function type of the lambda or function.
|
default |
Default constructor.
| sf::TClosure< Result, Args >::TClosure | ( | const TClosure< Result, Args > & | c | ) |
Copy constructor.
|
explicit |
Function assignment constructor.
| TClosure & sf::TClosure< Result, Args >::assign | ( | ClassType * | cls, |
| MethodType | mtd, | ||
| BoundArgs... | args | ||
| ) |
Binds a non-static class member function to this instance.
Short for passing a std::bind(...) result the assign().
For example:
| ClassType | Type having the to be called method. |
| MethodType | Type from the passed class type. |
| BoundArgs | Only std::placeholders::_? enumeration values. (see std::bind) |
| cls | Pointer of the class having the passed method. |
| mtd | Pointer to method of the given class. |
| args | Amount of arguments needed to call the method using std::placeholders::_? enumeration values. |
| TClosure & sf::TClosure< Result, Args >::assign | ( | const func_type & | fn | ) |
Function assignment method for static function.
|
protected |
Makes the call to the member function.
| args | List of arguments specified by the template. |
| bool sf::TClosure< Result, Args >::isAssigned | ( | ) | const |
Checks if the closure is valid for calling.
|
explicit |
Checks if the closure is valid for calling.
| Result sf::TClosure< Result, Args >::operator() | ( | Args... | args | ) | const |
Make the call to the member function.
| args | List of arguments specified by the template. |
| TClosure & sf::TClosure< Result, Args >::operator= | ( | const func_type & | f | ) |
Closure assignment operator.
| TClosure & sf::TClosure< Result, Args >::operator= | ( | const TClosure< Result, Args > & | c | ) |
Closure assignment operator.
| TClosure & sf::TClosure< Result, Args >::unassign | ( | ) |
Releases the bind function.