This fork captures the mbed lib v125 for ease of integration into older projects.
Fork of mbed-dev by
FunctionPointer.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2015 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef MBED_FUNCTIONPOINTER_H 00017 #define MBED_FUNCTIONPOINTER_H 00018 00019 #include "Callback.h" 00020 #include "toolchain.h" 00021 #include <string.h> 00022 #include <stdint.h> 00023 00024 namespace mbed { 00025 00026 00027 // Declarations for backwards compatibility 00028 // To be foward compatible, code should adopt the Callback class 00029 template <typename R, typename A1> 00030 class FunctionPointerArg1 : public Callback<R(A1)> { 00031 public: 00032 MBED_DEPRECATED_SINCE("mbed-os-5.1", 00033 "FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>") 00034 FunctionPointerArg1(R (*function)(A1) = 0) 00035 : Callback<R(A1)>(function) {} 00036 00037 template<typename T> 00038 MBED_DEPRECATED_SINCE("mbed-os-5.1", 00039 "FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>") 00040 FunctionPointerArg1(T *object, R (T::*member)(A1)) 00041 : Callback<R(A1)>(object, member) {} 00042 00043 R (*get_function())(A1) { 00044 return *reinterpret_cast<R (**)(A1)>(this); 00045 } 00046 }; 00047 00048 template <typename R> 00049 class FunctionPointerArg1<R, void> : public Callback<R()> { 00050 public: 00051 MBED_DEPRECATED_SINCE("mbed-os-5.1", 00052 "FunctionPointer has been replaced by Callback<void()>") 00053 FunctionPointerArg1(R (*function)() = 0) 00054 : Callback<R()>(function) {} 00055 00056 template<typename T> 00057 MBED_DEPRECATED_SINCE("mbed-os-5.1", 00058 "FunctionPointer has been replaced by Callback<void()>") 00059 FunctionPointerArg1(T *object, R (T::*member)()) 00060 : Callback<R()>(object, member) {} 00061 00062 R (*get_function())() { 00063 return *reinterpret_cast<R (**)()>(this); 00064 } 00065 }; 00066 00067 typedef FunctionPointerArg1<void, void> FunctionPointer; 00068 00069 00070 } // namespace mbed 00071 00072 #endif
Generated on Tue Jul 12 2022 19:06:15 by 1.7.2