mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Callback type made visible
This commit is contained in:
parent
eafdc82b4b
commit
fd6f27b7d8
@ -71,9 +71,9 @@ static Stream& operator<<(Stream& s, const ServiceCallResult<DataType>& scr)
|
||||
|
||||
template <typename DataType_,
|
||||
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
||||
typename Callback = std::function<void (const ServiceCallResult<DataType_>&)>
|
||||
typename Callback_ = std::function<void (const ServiceCallResult<DataType_>&)>
|
||||
#else
|
||||
typename Callback = void (*)(const ServiceCallResult<DataType_>&)
|
||||
typename Callback_ = void (*)(const ServiceCallResult<DataType_>&)
|
||||
#endif
|
||||
>
|
||||
class ServiceClient
|
||||
@ -86,6 +86,7 @@ public:
|
||||
typedef typename DataType::Request RequestType;
|
||||
typedef typename DataType::Response ResponseType;
|
||||
typedef ServiceCallResult<DataType> ServiceCallResultType;
|
||||
typedef Callback_ Callback;
|
||||
|
||||
private:
|
||||
typedef ServiceClient<DataType, Callback> SelfType;
|
||||
|
||||
@ -21,11 +21,11 @@ namespace uavcan
|
||||
|
||||
template <typename DataType_,
|
||||
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
||||
typename Callback = std::function<void (const ReceivedDataStructure<typename DataType_::Request>&,
|
||||
typename DataType_::Response&)>,
|
||||
typename Callback_ = std::function<void (const ReceivedDataStructure<typename DataType_::Request>&,
|
||||
typename DataType_::Response&)>,
|
||||
#else
|
||||
typename Callback = void (*)(const ReceivedDataStructure<typename DataType_::Request>&,
|
||||
typename DataType_::Response&),
|
||||
typename Callback_ = void (*)(const ReceivedDataStructure<typename DataType_::Request>&,
|
||||
typename DataType_::Response&),
|
||||
#endif
|
||||
unsigned NumStaticReceivers = 2,
|
||||
unsigned NumStaticBufs = 1>
|
||||
@ -38,6 +38,7 @@ public:
|
||||
typedef DataType_ DataType;
|
||||
typedef typename DataType::Request RequestType;
|
||||
typedef typename DataType::Response ResponseType;
|
||||
typedef Callback_ Callback;
|
||||
|
||||
private:
|
||||
typedef typename TransferListenerInstantiationHelper<RequestType, NumStaticReceivers, NumStaticBufs>::Type
|
||||
|
||||
@ -21,9 +21,9 @@ namespace uavcan
|
||||
|
||||
template <typename DataType_,
|
||||
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
||||
typename Callback = std::function<void (const ReceivedDataStructure<DataType_>&)>,
|
||||
typename Callback_ = std::function<void (const ReceivedDataStructure<DataType_>&)>,
|
||||
#else
|
||||
typename Callback = void (*)(const ReceivedDataStructure<DataType_>&),
|
||||
typename Callback_ = void (*)(const ReceivedDataStructure<DataType_>&),
|
||||
#endif
|
||||
unsigned NumStaticReceivers = 2,
|
||||
unsigned NumStaticBufs = 1>
|
||||
@ -32,6 +32,10 @@ class Subscriber : public GenericSubscriber<DataType_, DataType_,
|
||||
NumStaticReceivers,
|
||||
NumStaticBufs>::Type>
|
||||
{
|
||||
public:
|
||||
typedef Callback_ Callback;
|
||||
|
||||
private:
|
||||
typedef typename TransferListenerInstantiationHelper<DataType_, NumStaticReceivers, NumStaticBufs>::Type
|
||||
TransferListenerType;
|
||||
typedef GenericSubscriber<DataType_, DataType_, TransferListenerType> BaseType;
|
||||
|
||||
@ -64,9 +64,13 @@ public:
|
||||
};
|
||||
|
||||
|
||||
template <typename Callback>
|
||||
template <typename Callback_>
|
||||
class TimerEventForwarder : public TimerBase
|
||||
{
|
||||
public:
|
||||
typedef Callback_ Callback;
|
||||
|
||||
private:
|
||||
Callback callback_;
|
||||
|
||||
void handleTimerEvent(const TimerEvent& event)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user