Callback type made visible

This commit is contained in:
Pavel Kirienko 2014-03-31 18:45:46 +04:00
parent eafdc82b4b
commit fd6f27b7d8
4 changed files with 19 additions and 9 deletions

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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)