Merge pull request #2191 from geky/callback-fp-deprecate

[api] Mark FunctionPointer and friends as deprecated
pull/2218/head
Martin Kojtal 2016-07-22 10:25:07 +01:00 committed by GitHub
commit 51cd3cb972
1 changed files with 5 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#define MBED_FUNCTIONPOINTER_H #define MBED_FUNCTIONPOINTER_H
#include "Callback.h" #include "Callback.h"
#include "toolchain.h"
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
@ -28,10 +29,12 @@ namespace mbed {
template <typename R, typename A1> template <typename R, typename A1>
class FunctionPointerArg1 : public Callback<R(A1)> { class FunctionPointerArg1 : public Callback<R(A1)> {
public: public:
MBED_DEPRECATED("FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
FunctionPointerArg1(R (*function)(A1) = 0) FunctionPointerArg1(R (*function)(A1) = 0)
: Callback<R(A1)>(function) {} : Callback<R(A1)>(function) {}
template<typename T> template<typename T>
MBED_DEPRECATED("FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
FunctionPointerArg1(T *object, R (T::*member)(A1)) FunctionPointerArg1(T *object, R (T::*member)(A1))
: Callback<R(A1)>(object, member) {} : Callback<R(A1)>(object, member) {}
@ -43,10 +46,12 @@ public:
template <typename R> template <typename R>
class FunctionPointerArg1<R, void> : public Callback<R()> { class FunctionPointerArg1<R, void> : public Callback<R()> {
public: public:
MBED_DEPRECATED("FunctionPointer has been replaced by Callback<void()>")
FunctionPointerArg1(R (*function)() = 0) FunctionPointerArg1(R (*function)() = 0)
: Callback<R()>(function) {} : Callback<R()>(function) {}
template<typename T> template<typename T>
MBED_DEPRECATED("FunctionPointer has been replaced by Callback<void()>")
FunctionPointerArg1(T *object, R (T::*member)()) FunctionPointerArg1(T *object, R (T::*member)())
: Callback<R()>(object, member) {} : Callback<R()>(object, member) {}