mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 23:13:33 +08:00
libuavcan documentation
This commit is contained in:
@@ -10,7 +10,11 @@
|
||||
|
||||
namespace uavcan
|
||||
{
|
||||
|
||||
/**
|
||||
* Use this to call member functions as callbacks in C++03 mode.
|
||||
*
|
||||
* In C++11 or newer you don't need it because you can use std::function<>/std::bind<> instead.
|
||||
*/
|
||||
template <typename ObjectPtr, typename MemFunPtr>
|
||||
class UAVCAN_EXPORT MethodBinder
|
||||
{
|
||||
@@ -36,17 +40,26 @@ public:
|
||||
, fun_(f)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Returns true if the binder is initialized (doesn't contain null pointers).
|
||||
*/
|
||||
operator bool() const
|
||||
{
|
||||
return try_implicit_cast<bool>(obj_, true) && try_implicit_cast<bool>(fun_, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will raise a fatal error if either method pointer or object pointer are null.
|
||||
*/
|
||||
void operator()()
|
||||
{
|
||||
validateBeforeCall();
|
||||
(obj_->*fun_)();
|
||||
}
|
||||
|
||||
/**
|
||||
* Will raise a fatal error if either method pointer or object pointer are null.
|
||||
*/
|
||||
template <typename Par1>
|
||||
void operator()(Par1& p1)
|
||||
{
|
||||
@@ -54,6 +67,9 @@ public:
|
||||
(obj_->*fun_)(p1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will raise a fatal error if either method pointer or object pointer are null.
|
||||
*/
|
||||
template <typename Par1, typename Par2>
|
||||
void operator()(Par1& p1, Par2& p2)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user