A method which executes a function. More...
#include <rtt/Method.hpp>
Public Types | |
typedef FunctionT | Signature |
typedef boost::function_traits < Signature >::result_type | result_type |
typedef boost::function_traits < Signature > | traits |
typedef boost::shared_ptr < detail::MethodBase < FunctionT > > | MethodBasePtr |
Public Member Functions | |
Method () | |
Create an empty Method object. | |
Method (std::string name) | |
Create an empty Method object. | |
Method (const Method &m) | |
Method objects may be copied. | |
Method & | operator= (const Method &m) |
Method objects may be assigned. | |
Method (boost::shared_ptr< ActionInterface > implementation) | |
Initialise a nameless Method object from an implementation. | |
Method & | operator= (boost::shared_ptr< ActionInterface > implementation) |
Method objects may be assigned to an implementation. | |
template<class M , class ObjectType > | |
Method (std::string name, M meth, ObjectType object) | |
Construct a Method from a class member pointer and an object of that class. | |
template<class M > | |
Method (std::string name, M meth) | |
Construct a Method from a function pointer or function object. | |
~Method () | |
Clean up the Method object. | |
bool | ready () const |
Check if this Method is ready for execution. | |
const std::string & | getName () const |
Get the name of this method. | |
const MethodBasePtr | getMethodImpl () const |
Returns the internal implementation of the Method object. | |
void | setMethodImpl (MethodBasePtr new_impl) const |
Sets the internal implementation of the Method object. | |
template<class M , class ObjectType > | |
void | setMethod (M meth, ObjectType object) |
Assign a class member pointer and an object of that class to the Method. | |
template<class M > | |
void | setMethod (M meth) |
Assign a function pointer or function object to the Method. |
A method which executes a function.
Usage:
Method<double(int, double)> mymeth("name", &Class::foo, &c); double result = mymeth( 3, 1.9);
Definition at line 71 of file Method.hpp.
RTT::Method< FunctionT >::Method | ( | ) | [inline] |
Create an empty Method object.
Use assignment to initialise it.
Definition at line 91 of file Method.hpp.
References RTT::Method< FunctionT >::Method().
Referenced by RTT::Method< FunctionT >::Method(), RTT::Method< FunctionT >::operator=(), and RTT::Method< FunctionT >::~Method().
RTT::Method< FunctionT >::Method | ( | std::string | name | ) | [inline] |
Create an empty Method object.
Use assignment to initialise it.
Definition at line 100 of file Method.hpp.
References RTT::Method< FunctionT >::Method().
RTT::Method< FunctionT >::Method | ( | const Method< FunctionT > & | m | ) | [inline] |
Method objects may be copied.
m | the original |
Definition at line 109 of file Method.hpp.
References RTT::Method< FunctionT >::Method().
RTT::Method< FunctionT >::Method | ( | boost::shared_ptr< ActionInterface > | implementation | ) | [inline] |
Initialise a nameless Method object from an implementation.
implementation | The implementation which is acquired by the Method object. If it has the wrong type, it is freed. |
Definition at line 136 of file Method.hpp.
References RTT::Method< FunctionT >::Method().
RTT::Method< FunctionT >::Method | ( | std::string | name, | |
M | meth, | |||
ObjectType | object | |||
) | [inline] |
Construct a Method from a class member pointer and an object of that class.
name | The name of this method | |
meth | A pointer to a class member function | |
object | An object of the class which has meth as member function. |
Definition at line 173 of file Method.hpp.
References RTT::Method< FunctionT >::Method().
RTT::Method< FunctionT >::Method | ( | std::string | name, | |
M | meth | |||
) | [inline] |
Construct a Method from a function pointer or function object.
name | the name of this method | |
meth | an pointer to a function or function object. |
Definition at line 185 of file Method.hpp.
References RTT::Method< FunctionT >::Method().
Method& RTT::Method< FunctionT >::operator= | ( | boost::shared_ptr< ActionInterface > | implementation | ) | [inline] |
Method objects may be assigned to an implementation.
implementation | the implementation, if it is not suitable, it is freed. |
Definition at line 153 of file Method.hpp.
References RTT::Method< FunctionT >::Method(), and RTT::Method< FunctionT >::operator=().
Method& RTT::Method< FunctionT >::operator= | ( | const Method< FunctionT > & | m | ) | [inline] |
Method objects may be assigned.
m | the original |
Definition at line 121 of file Method.hpp.
References RTT::Method< FunctionT >::Method(), and RTT::Method< FunctionT >::operator=().
Referenced by RTT::Method< FunctionT >::operator=().
bool RTT::Method< FunctionT >::ready | ( | ) | const [inline] |
Check if this Method is ready for execution.
Definition at line 202 of file Method.hpp.
void RTT::Method< FunctionT >::setMethod | ( | M | meth | ) | [inline] |
Assign a function pointer or function object to the Method.
Does not change the Method's name.
Use getMethodImpl() to retrieve the resulting implementation.
meth | A pointer to a class member function | |
object | An object of the class which has meth as member function. |
Definition at line 251 of file Method.hpp.
References RTT::Method< FunctionT >::setMethod().
void RTT::Method< FunctionT >::setMethod | ( | M | meth, | |
ObjectType | object | |||
) | [inline] |
Assign a class member pointer and an object of that class to the Method.
Does not change the Method's name.
Use getMethodImpl() to retrieve the resulting implementation.
meth | A pointer to a class member function | |
object | An object of the class which has meth as member function. |
Definition at line 236 of file Method.hpp.
References RTT::Method< FunctionT >::setMethod().
Referenced by RTT::Method< FunctionT >::setMethod().