mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #2549 from geky/thread-clarification
Clean up confusion with deprecated constructors and callbacks in thread-spawning functionspull/2604/head
commit
3bb149cab2
|
|
@ -8,17 +8,23 @@ using namespace utest::v1;
|
||||||
|
|
||||||
// static functions
|
// static functions
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T static_func0() { return 0; }
|
T static_func0()
|
||||||
|
{ return 0; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T static_func1(T a0) { return 0 | a0; }
|
T static_func1(T a0)
|
||||||
|
{ return 0 | a0; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T static_func2(T a0, T a1) { return 0 | a0 | a1; }
|
T static_func2(T a0, T a1)
|
||||||
|
{ return 0 | a0 | a1; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T static_func3(T a0, T a1, T a2) { return 0 | a0 | a1 | a2; }
|
T static_func3(T a0, T a1, T a2)
|
||||||
|
{ return 0 | a0 | a1 | a2; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T static_func4(T a0, T a1, T a2, T a3) { return 0 | a0 | a1 | a2 | a3; }
|
T static_func4(T a0, T a1, T a2, T a3)
|
||||||
|
{ return 0 | a0 | a1 | a2 | a3; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T static_func5(T a0, T a1, T a2, T a3, T a4) { return 0 | a0 | a1 | a2 | a3 | a4; }
|
T static_func5(T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return 0 | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
|
||||||
// class functions
|
// class functions
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
@ -26,90 +32,206 @@ struct Thing {
|
||||||
T t;
|
T t;
|
||||||
Thing() : t(0x80) {}
|
Thing() : t(0x80) {}
|
||||||
|
|
||||||
T member_func0() { return t; }
|
T member_func0()
|
||||||
T member_func1(T a0) { return t | a0; }
|
{ return t; }
|
||||||
T member_func2(T a0, T a1) { return t | a0 | a1; }
|
T member_func1(T a0)
|
||||||
T member_func3(T a0, T a1, T a2) { return t | a0 | a1 | a2; }
|
{ return t | a0; }
|
||||||
T member_func4(T a0, T a1, T a2, T a3) { return t | a0 | a1 | a2 | a3; }
|
T member_func2(T a0, T a1)
|
||||||
T member_func5(T a0, T a1, T a2, T a3, T a4) { return t | a0 | a1 | a2 | a3 | a4; }
|
{ return t | a0 | a1; }
|
||||||
|
T member_func3(T a0, T a1, T a2)
|
||||||
|
{ return t | a0 | a1 | a2; }
|
||||||
|
T member_func4(T a0, T a1, T a2, T a3)
|
||||||
|
{ return t | a0 | a1 | a2 | a3; }
|
||||||
|
T member_func5(T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
|
||||||
T const_member_func0() const { return t; }
|
T const_member_func0() const
|
||||||
T const_member_func1(T a0) const { return t | a0; }
|
{ return t; }
|
||||||
T const_member_func2(T a0, T a1) const { return t | a0 | a1; }
|
T const_member_func1(T a0) const
|
||||||
T const_member_func3(T a0, T a1, T a2) const { return t | a0 | a1 | a2; }
|
{ return t | a0; }
|
||||||
T const_member_func4(T a0, T a1, T a2, T a3) const { return t | a0 | a1 | a2 | a3; }
|
T const_member_func2(T a0, T a1) const
|
||||||
T const_member_func5(T a0, T a1, T a2, T a3, T a4) const { return t | a0 | a1 | a2 | a3 | a4; }
|
{ return t | a0 | a1; }
|
||||||
|
T const_member_func3(T a0, T a1, T a2) const
|
||||||
|
{ return t | a0 | a1 | a2; }
|
||||||
|
T const_member_func4(T a0, T a1, T a2, T a3) const
|
||||||
|
{ return t | a0 | a1 | a2 | a3; }
|
||||||
|
T const_member_func5(T a0, T a1, T a2, T a3, T a4) const
|
||||||
|
{ return t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
|
||||||
T volatile_member_func0() volatile { return t; }
|
T volatile_member_func0() volatile
|
||||||
T volatile_member_func1(T a0) volatile { return t | a0; }
|
{ return t; }
|
||||||
T volatile_member_func2(T a0, T a1) volatile { return t | a0 | a1; }
|
T volatile_member_func1(T a0) volatile
|
||||||
T volatile_member_func3(T a0, T a1, T a2) volatile { return t | a0 | a1 | a2; }
|
{ return t | a0; }
|
||||||
T volatile_member_func4(T a0, T a1, T a2, T a3) volatile { return t | a0 | a1 | a2 | a3; }
|
T volatile_member_func2(T a0, T a1) volatile
|
||||||
T volatile_member_func5(T a0, T a1, T a2, T a3, T a4) volatile { return t | a0 | a1 | a2 | a3 | a4; }
|
{ return t | a0 | a1; }
|
||||||
|
T volatile_member_func3(T a0, T a1, T a2) volatile
|
||||||
|
{ return t | a0 | a1 | a2; }
|
||||||
|
T volatile_member_func4(T a0, T a1, T a2, T a3) volatile
|
||||||
|
{ return t | a0 | a1 | a2 | a3; }
|
||||||
|
T volatile_member_func5(T a0, T a1, T a2, T a3, T a4) volatile
|
||||||
|
{ return t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
|
||||||
T const_volatile_member_func0() const volatile { return t; }
|
T const_volatile_member_func0() const volatile
|
||||||
T const_volatile_member_func1(T a0) const volatile { return t | a0; }
|
{ return t; }
|
||||||
T const_volatile_member_func2(T a0, T a1) const volatile { return t | a0 | a1; }
|
T const_volatile_member_func1(T a0) const volatile
|
||||||
T const_volatile_member_func3(T a0, T a1, T a2) const volatile { return t | a0 | a1 | a2; }
|
{ return t | a0; }
|
||||||
T const_volatile_member_func4(T a0, T a1, T a2, T a3) const volatile { return t | a0 | a1 | a2 | a3; }
|
T const_volatile_member_func2(T a0, T a1) const volatile
|
||||||
T const_volatile_member_func5(T a0, T a1, T a2, T a3, T a4) const volatile { return t | a0 | a1 | a2 | a3 | a4; }
|
{ return t | a0 | a1; }
|
||||||
|
T const_volatile_member_func3(T a0, T a1, T a2) const volatile
|
||||||
|
{ return t | a0 | a1 | a2; }
|
||||||
|
T const_volatile_member_func4(T a0, T a1, T a2, T a3) const volatile
|
||||||
|
{ return t | a0 | a1 | a2 | a3; }
|
||||||
|
T const_volatile_member_func5(T a0, T a1, T a2, T a3, T a4) const volatile
|
||||||
|
{ return t | a0 | a1 | a2 | a3 | a4; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// bound functions
|
// bound functions
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T bound_func0(Thing<T> *t) { return t->t; }
|
T bound_func0(Thing<T> *t)
|
||||||
|
{ return t->t; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T bound_func1(Thing<T> *t, T a0) { return t->t | a0; }
|
T bound_func1(Thing<T> *t, T a0)
|
||||||
|
{ return t->t | a0; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T bound_func2(Thing<T> *t, T a0, T a1) { return t->t | a0 | a1; }
|
T bound_func2(Thing<T> *t, T a0, T a1)
|
||||||
|
{ return t->t | a0 | a1; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T bound_func3(Thing<T> *t, T a0, T a1, T a2) { return t->t | a0 | a1 | a2; }
|
T bound_func3(Thing<T> *t, T a0, T a1, T a2)
|
||||||
|
{ return t->t | a0 | a1 | a2; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T bound_func4(Thing<T> *t, T a0, T a1, T a2, T a3) { return t->t | a0 | a1 | a2 | a3; }
|
T bound_func4(Thing<T> *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T bound_func5(Thing<T> *t, T a0, T a1, T a2, T a3, T a4) { return t->t | a0 | a1 | a2 | a3 | a4; }
|
T bound_func5(Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
template <typename T>
|
||||||
|
T const_bound_func0(const Thing<T> *t)
|
||||||
|
{ return t->t; }
|
||||||
|
template <typename T>
|
||||||
|
T const_bound_func1(const Thing<T> *t, T a0)
|
||||||
|
{ return t->t | a0; }
|
||||||
|
template <typename T>
|
||||||
|
T const_bound_func2(const Thing<T> *t, T a0, T a1)
|
||||||
|
{ return t->t | a0 | a1; }
|
||||||
|
template <typename T>
|
||||||
|
T const_bound_func3(const Thing<T> *t, T a0, T a1, T a2)
|
||||||
|
{ return t->t | a0 | a1 | a2; }
|
||||||
|
template <typename T>
|
||||||
|
T const_bound_func4(const Thing<T> *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3; }
|
||||||
|
template <typename T>
|
||||||
|
T const_bound_func5(const Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
template <typename T>
|
||||||
|
T volatile_bound_func0(volatile Thing<T> *t)
|
||||||
|
{ return t->t; }
|
||||||
|
template <typename T>
|
||||||
|
T volatile_bound_func1(volatile Thing<T> *t, T a0)
|
||||||
|
{ return t->t | a0; }
|
||||||
|
template <typename T>
|
||||||
|
T volatile_bound_func2(volatile Thing<T> *t, T a0, T a1)
|
||||||
|
{ return t->t | a0 | a1; }
|
||||||
|
template <typename T>
|
||||||
|
T volatile_bound_func3(volatile Thing<T> *t, T a0, T a1, T a2)
|
||||||
|
{ return t->t | a0 | a1 | a2; }
|
||||||
|
template <typename T>
|
||||||
|
T volatile_bound_func4(volatile Thing<T> *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3; }
|
||||||
|
template <typename T>
|
||||||
|
T volatile_bound_func5(volatile Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_bound_func0(const volatile Thing<T> *t)
|
||||||
|
{ return t->t; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_bound_func1(const volatile Thing<T> *t, T a0)
|
||||||
|
{ return t->t | a0; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_bound_func2(const volatile Thing<T> *t, T a0, T a1)
|
||||||
|
{ return t->t | a0 | a1; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_bound_func3(const volatile Thing<T> *t, T a0, T a1, T a2)
|
||||||
|
{ return t->t | a0 | a1 | a2; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_bound_func4(const volatile Thing<T> *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_bound_func5(const volatile Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
|
||||||
// const bound functions
|
// void functions
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_func0(const Thing<T> *t) { return t->t; }
|
T void_func0(void *t)
|
||||||
|
{ return static_cast<Thing<T>*>(t)->t; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_func1(const Thing<T> *t, T a0) { return t->t | a0; }
|
T void_func1(void *t, T a0)
|
||||||
|
{ return static_cast<Thing<T>*>(t)->t | a0; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_func2(const Thing<T> *t, T a0, T a1) { return t->t | a0 | a1; }
|
T void_func2(void *t, T a0, T a1)
|
||||||
|
{ return static_cast<Thing<T>*>(t)->t | a0 | a1; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_func3(const Thing<T> *t, T a0, T a1, T a2) { return t->t | a0 | a1 | a2; }
|
T void_func3(void *t, T a0, T a1, T a2)
|
||||||
|
{ return static_cast<Thing<T>*>(t)->t | a0 | a1 | a2; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_func4(const Thing<T> *t, T a0, T a1, T a2, T a3) { return t->t | a0 | a1 | a2 | a3; }
|
T void_func4(void *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return static_cast<Thing<T>*>(t)->t | a0 | a1 | a2 | a3; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_func5(const Thing<T> *t, T a0, T a1, T a2, T a3, T a4) { return t->t | a0 | a1 | a2 | a3 | a4; }
|
T void_func5(void *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return static_cast<Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
// volatile bound functions
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T volatile_func0(volatile Thing<T> *t) { return t->t; }
|
T const_void_func0(const void *t)
|
||||||
|
{ return static_cast<const Thing<T>*>(t)->t; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T volatile_func1(volatile Thing<T> *t, T a0) { return t->t | a0; }
|
T const_void_func1(const void *t, T a0)
|
||||||
|
{ return static_cast<const Thing<T>*>(t)->t | a0; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T volatile_func2(volatile Thing<T> *t, T a0, T a1) { return t->t | a0 | a1; }
|
T const_void_func2(const void *t, T a0, T a1)
|
||||||
|
{ return static_cast<const Thing<T>*>(t)->t | a0 | a1; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T volatile_func3(volatile Thing<T> *t, T a0, T a1, T a2) { return t->t | a0 | a1 | a2; }
|
T const_void_func3(const void *t, T a0, T a1, T a2)
|
||||||
|
{ return static_cast<const Thing<T>*>(t)->t | a0 | a1 | a2; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T volatile_func4(volatile Thing<T> *t, T a0, T a1, T a2, T a3) { return t->t | a0 | a1 | a2 | a3; }
|
T const_void_func4(const void *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return static_cast<const Thing<T>*>(t)->t | a0 | a1 | a2 | a3; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T volatile_func5(volatile Thing<T> *t, T a0, T a1, T a2, T a3, T a4) { return t->t | a0 | a1 | a2 | a3 | a4; }
|
T const_void_func5(const void *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return static_cast<const Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
// const volatile bound functions
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_volatile_func0(const volatile Thing<T> *t) { return t->t; }
|
T volatile_void_func0(volatile void *t)
|
||||||
|
{ return static_cast<volatile Thing<T>*>(t)->t; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_volatile_func1(const volatile Thing<T> *t, T a0) { return t->t | a0; }
|
T volatile_void_func1(volatile void *t, T a0)
|
||||||
|
{ return static_cast<volatile Thing<T>*>(t)->t | a0; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_volatile_func2(const volatile Thing<T> *t, T a0, T a1) { return t->t | a0 | a1; }
|
T volatile_void_func2(volatile void *t, T a0, T a1)
|
||||||
|
{ return static_cast<volatile Thing<T>*>(t)->t | a0 | a1; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_volatile_func3(const volatile Thing<T> *t, T a0, T a1, T a2) { return t->t | a0 | a1 | a2; }
|
T volatile_void_func3(volatile void *t, T a0, T a1, T a2)
|
||||||
|
{ return static_cast<volatile Thing<T>*>(t)->t | a0 | a1 | a2; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_volatile_func4(const volatile Thing<T> *t, T a0, T a1, T a2, T a3) { return t->t | a0 | a1 | a2 | a3; }
|
T volatile_void_func4(volatile void *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return static_cast<volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_volatile_func5(const volatile Thing<T> *t, T a0, T a1, T a2, T a3, T a4) { return t->t | a0 | a1 | a2 | a3 | a4; }
|
T volatile_void_func5(volatile void *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return static_cast<volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_void_func0(const volatile void *t)
|
||||||
|
{ return static_cast<const volatile Thing<T>*>(t)->t; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_void_func1(const volatile void *t, T a0)
|
||||||
|
{ return static_cast<const volatile Thing<T>*>(t)->t | a0; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_void_func2(const volatile void *t, T a0, T a1)
|
||||||
|
{ return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_void_func3(const volatile void *t, T a0, T a1, T a2)
|
||||||
|
{ return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_void_func4(const volatile void *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_void_func5(const volatile void *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
|
||||||
|
|
||||||
// function call and result verification
|
// function call and result verification
|
||||||
|
|
@ -199,9 +321,13 @@ void test_dispatch0() {
|
||||||
Verifier<T>::verify0((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func0);
|
Verifier<T>::verify0((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func0);
|
||||||
Verifier<T>::verify0((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func0);
|
Verifier<T>::verify0((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func0);
|
||||||
Verifier<T>::verify0(&thing, &bound_func0<T>);
|
Verifier<T>::verify0(&thing, &bound_func0<T>);
|
||||||
Verifier<T>::verify0((const Thing<T>*)&thing, &const_func0<T>);
|
Verifier<T>::verify0((const Thing<T>*)&thing, &const_bound_func0<T>);
|
||||||
Verifier<T>::verify0((volatile Thing<T>*)&thing, &volatile_func0<T>);
|
Verifier<T>::verify0((volatile Thing<T>*)&thing, &volatile_bound_func0<T>);
|
||||||
Verifier<T>::verify0((const volatile Thing<T>*)&thing, &const_volatile_func0<T>);
|
Verifier<T>::verify0((const volatile Thing<T>*)&thing, &const_volatile_bound_func0<T>);
|
||||||
|
Verifier<T>::verify0(&thing, &void_func0<T>);
|
||||||
|
Verifier<T>::verify0((const Thing<T>*)&thing, &const_void_func0<T>);
|
||||||
|
Verifier<T>::verify0((volatile Thing<T>*)&thing, &volatile_void_func0<T>);
|
||||||
|
Verifier<T>::verify0((const volatile Thing<T>*)&thing, &const_volatile_void_func0<T>);
|
||||||
Verifier<T>::verify0(callback(static_func0<T>));
|
Verifier<T>::verify0(callback(static_func0<T>));
|
||||||
|
|
||||||
Callback<T()> cb(static_func0);
|
Callback<T()> cb(static_func0);
|
||||||
|
|
@ -222,9 +348,13 @@ void test_dispatch1() {
|
||||||
Verifier<T>::verify1((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func1);
|
Verifier<T>::verify1((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func1);
|
||||||
Verifier<T>::verify1((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func1);
|
Verifier<T>::verify1((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func1);
|
||||||
Verifier<T>::verify1(&thing, &bound_func1<T>);
|
Verifier<T>::verify1(&thing, &bound_func1<T>);
|
||||||
Verifier<T>::verify1((const Thing<T>*)&thing, &const_func1<T>);
|
Verifier<T>::verify1((const Thing<T>*)&thing, &const_bound_func1<T>);
|
||||||
Verifier<T>::verify1((volatile Thing<T>*)&thing, &volatile_func1<T>);
|
Verifier<T>::verify1((volatile Thing<T>*)&thing, &volatile_bound_func1<T>);
|
||||||
Verifier<T>::verify1((const volatile Thing<T>*)&thing, &const_volatile_func1<T>);
|
Verifier<T>::verify1((const volatile Thing<T>*)&thing, &const_volatile_bound_func1<T>);
|
||||||
|
Verifier<T>::verify1(&thing, &void_func1<T>);
|
||||||
|
Verifier<T>::verify1((const Thing<T>*)&thing, &const_void_func1<T>);
|
||||||
|
Verifier<T>::verify1((volatile Thing<T>*)&thing, &volatile_void_func1<T>);
|
||||||
|
Verifier<T>::verify1((const volatile Thing<T>*)&thing, &const_volatile_void_func1<T>);
|
||||||
Verifier<T>::verify1(callback(static_func1<T>));
|
Verifier<T>::verify1(callback(static_func1<T>));
|
||||||
|
|
||||||
Callback<T(T)> cb(static_func1);
|
Callback<T(T)> cb(static_func1);
|
||||||
|
|
@ -245,9 +375,13 @@ void test_dispatch2() {
|
||||||
Verifier<T>::verify2((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func2);
|
Verifier<T>::verify2((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func2);
|
||||||
Verifier<T>::verify2((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func2);
|
Verifier<T>::verify2((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func2);
|
||||||
Verifier<T>::verify2(&thing, &bound_func2<T>);
|
Verifier<T>::verify2(&thing, &bound_func2<T>);
|
||||||
Verifier<T>::verify2((const Thing<T>*)&thing, &const_func2<T>);
|
Verifier<T>::verify2((const Thing<T>*)&thing, &const_bound_func2<T>);
|
||||||
Verifier<T>::verify2((volatile Thing<T>*)&thing, &volatile_func2<T>);
|
Verifier<T>::verify2((volatile Thing<T>*)&thing, &volatile_bound_func2<T>);
|
||||||
Verifier<T>::verify2((const volatile Thing<T>*)&thing, &const_volatile_func2<T>);
|
Verifier<T>::verify2((const volatile Thing<T>*)&thing, &const_volatile_bound_func2<T>);
|
||||||
|
Verifier<T>::verify2(&thing, &void_func2<T>);
|
||||||
|
Verifier<T>::verify2((const Thing<T>*)&thing, &const_void_func2<T>);
|
||||||
|
Verifier<T>::verify2((volatile Thing<T>*)&thing, &volatile_void_func2<T>);
|
||||||
|
Verifier<T>::verify2((const volatile Thing<T>*)&thing, &const_volatile_void_func2<T>);
|
||||||
Verifier<T>::verify2(callback(static_func2<T>));
|
Verifier<T>::verify2(callback(static_func2<T>));
|
||||||
|
|
||||||
Callback<T(T, T)> cb(static_func2);
|
Callback<T(T, T)> cb(static_func2);
|
||||||
|
|
@ -268,9 +402,13 @@ void test_dispatch3() {
|
||||||
Verifier<T>::verify3((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func3);
|
Verifier<T>::verify3((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func3);
|
||||||
Verifier<T>::verify3((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func3);
|
Verifier<T>::verify3((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func3);
|
||||||
Verifier<T>::verify3(&thing, &bound_func3<T>);
|
Verifier<T>::verify3(&thing, &bound_func3<T>);
|
||||||
Verifier<T>::verify3((const Thing<T>*)&thing, &const_func3<T>);
|
Verifier<T>::verify3((const Thing<T>*)&thing, &const_bound_func3<T>);
|
||||||
Verifier<T>::verify3((volatile Thing<T>*)&thing, &volatile_func3<T>);
|
Verifier<T>::verify3((volatile Thing<T>*)&thing, &volatile_bound_func3<T>);
|
||||||
Verifier<T>::verify3((const volatile Thing<T>*)&thing, &const_volatile_func3<T>);
|
Verifier<T>::verify3((const volatile Thing<T>*)&thing, &const_volatile_bound_func3<T>);
|
||||||
|
Verifier<T>::verify3(&thing, &void_func3<T>);
|
||||||
|
Verifier<T>::verify3((const Thing<T>*)&thing, &const_void_func3<T>);
|
||||||
|
Verifier<T>::verify3((volatile Thing<T>*)&thing, &volatile_void_func3<T>);
|
||||||
|
Verifier<T>::verify3((const volatile Thing<T>*)&thing, &const_volatile_void_func3<T>);
|
||||||
Verifier<T>::verify3(callback(static_func3<T>));
|
Verifier<T>::verify3(callback(static_func3<T>));
|
||||||
|
|
||||||
Callback<T(T, T, T)> cb(static_func3);
|
Callback<T(T, T, T)> cb(static_func3);
|
||||||
|
|
@ -291,9 +429,13 @@ void test_dispatch4() {
|
||||||
Verifier<T>::verify4((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func4);
|
Verifier<T>::verify4((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func4);
|
||||||
Verifier<T>::verify4((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func4);
|
Verifier<T>::verify4((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func4);
|
||||||
Verifier<T>::verify4(&thing, &bound_func4<T>);
|
Verifier<T>::verify4(&thing, &bound_func4<T>);
|
||||||
Verifier<T>::verify4((const Thing<T>*)&thing, &const_func4<T>);
|
Verifier<T>::verify4((const Thing<T>*)&thing, &const_bound_func4<T>);
|
||||||
Verifier<T>::verify4((volatile Thing<T>*)&thing, &volatile_func4<T>);
|
Verifier<T>::verify4((volatile Thing<T>*)&thing, &volatile_bound_func4<T>);
|
||||||
Verifier<T>::verify4((const volatile Thing<T>*)&thing, &const_volatile_func4<T>);
|
Verifier<T>::verify4((const volatile Thing<T>*)&thing, &const_volatile_bound_func4<T>);
|
||||||
|
Verifier<T>::verify4(&thing, &void_func4<T>);
|
||||||
|
Verifier<T>::verify4((const Thing<T>*)&thing, &const_void_func4<T>);
|
||||||
|
Verifier<T>::verify4((volatile Thing<T>*)&thing, &volatile_void_func4<T>);
|
||||||
|
Verifier<T>::verify4((const volatile Thing<T>*)&thing, &const_volatile_void_func4<T>);
|
||||||
Verifier<T>::verify4(callback(static_func4<T>));
|
Verifier<T>::verify4(callback(static_func4<T>));
|
||||||
|
|
||||||
Callback<T(T, T, T, T)> cb(static_func4);
|
Callback<T(T, T, T, T)> cb(static_func4);
|
||||||
|
|
@ -314,9 +456,13 @@ void test_dispatch5() {
|
||||||
Verifier<T>::verify5((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func5);
|
Verifier<T>::verify5((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func5);
|
||||||
Verifier<T>::verify5((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func5);
|
Verifier<T>::verify5((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func5);
|
||||||
Verifier<T>::verify5(&thing, &bound_func5<T>);
|
Verifier<T>::verify5(&thing, &bound_func5<T>);
|
||||||
Verifier<T>::verify5((const Thing<T>*)&thing, &const_func5<T>);
|
Verifier<T>::verify5((const Thing<T>*)&thing, &const_bound_func5<T>);
|
||||||
Verifier<T>::verify5((volatile Thing<T>*)&thing, &volatile_func5<T>);
|
Verifier<T>::verify5((volatile Thing<T>*)&thing, &volatile_bound_func5<T>);
|
||||||
Verifier<T>::verify5((const volatile Thing<T>*)&thing, &const_volatile_func5<T>);
|
Verifier<T>::verify5((const volatile Thing<T>*)&thing, &const_volatile_bound_func5<T>);
|
||||||
|
Verifier<T>::verify5(&thing, &void_func5<T>);
|
||||||
|
Verifier<T>::verify5((const Thing<T>*)&thing, &const_void_func5<T>);
|
||||||
|
Verifier<T>::verify5((volatile Thing<T>*)&thing, &volatile_void_func5<T>);
|
||||||
|
Verifier<T>::verify5((const volatile Thing<T>*)&thing, &const_volatile_void_func5<T>);
|
||||||
Verifier<T>::verify5(callback(static_func5<T>));
|
Verifier<T>::verify5(callback(static_func5<T>));
|
||||||
|
|
||||||
Callback<T(T, T, T, T, T)> cb(static_func5);
|
Callback<T(T, T, T, T, T)> cb(static_func5);
|
||||||
|
|
|
||||||
|
|
@ -8,17 +8,23 @@ using namespace utest::v1;
|
||||||
|
|
||||||
// static functions
|
// static functions
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T static_func0() { return 0; }
|
T static_func0()
|
||||||
|
{ return 0; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T static_func1(T a0) { return 0 | a0; }
|
T static_func1(T a0)
|
||||||
|
{ return 0 | a0; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T static_func2(T a0, T a1) { return 0 | a0 | a1; }
|
T static_func2(T a0, T a1)
|
||||||
|
{ return 0 | a0 | a1; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T static_func3(T a0, T a1, T a2) { return 0 | a0 | a1 | a2; }
|
T static_func3(T a0, T a1, T a2)
|
||||||
|
{ return 0 | a0 | a1 | a2; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T static_func4(T a0, T a1, T a2, T a3) { return 0 | a0 | a1 | a2 | a3; }
|
T static_func4(T a0, T a1, T a2, T a3)
|
||||||
|
{ return 0 | a0 | a1 | a2 | a3; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T static_func5(T a0, T a1, T a2, T a3, T a4) { return 0 | a0 | a1 | a2 | a3 | a4; }
|
T static_func5(T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return 0 | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
|
||||||
// class functions
|
// class functions
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
@ -26,90 +32,206 @@ struct Thing {
|
||||||
T t;
|
T t;
|
||||||
Thing() : t(0x80) {}
|
Thing() : t(0x80) {}
|
||||||
|
|
||||||
T member_func0() { return t; }
|
T member_func0()
|
||||||
T member_func1(T a0) { return t | a0; }
|
{ return t; }
|
||||||
T member_func2(T a0, T a1) { return t | a0 | a1; }
|
T member_func1(T a0)
|
||||||
T member_func3(T a0, T a1, T a2) { return t | a0 | a1 | a2; }
|
{ return t | a0; }
|
||||||
T member_func4(T a0, T a1, T a2, T a3) { return t | a0 | a1 | a2 | a3; }
|
T member_func2(T a0, T a1)
|
||||||
T member_func5(T a0, T a1, T a2, T a3, T a4) { return t | a0 | a1 | a2 | a3 | a4; }
|
{ return t | a0 | a1; }
|
||||||
|
T member_func3(T a0, T a1, T a2)
|
||||||
|
{ return t | a0 | a1 | a2; }
|
||||||
|
T member_func4(T a0, T a1, T a2, T a3)
|
||||||
|
{ return t | a0 | a1 | a2 | a3; }
|
||||||
|
T member_func5(T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
|
||||||
T const_member_func0() const { return t; }
|
T const_member_func0() const
|
||||||
T const_member_func1(T a0) const { return t | a0; }
|
{ return t; }
|
||||||
T const_member_func2(T a0, T a1) const { return t | a0 | a1; }
|
T const_member_func1(T a0) const
|
||||||
T const_member_func3(T a0, T a1, T a2) const { return t | a0 | a1 | a2; }
|
{ return t | a0; }
|
||||||
T const_member_func4(T a0, T a1, T a2, T a3) const { return t | a0 | a1 | a2 | a3; }
|
T const_member_func2(T a0, T a1) const
|
||||||
T const_member_func5(T a0, T a1, T a2, T a3, T a4) const { return t | a0 | a1 | a2 | a3 | a4; }
|
{ return t | a0 | a1; }
|
||||||
|
T const_member_func3(T a0, T a1, T a2) const
|
||||||
|
{ return t | a0 | a1 | a2; }
|
||||||
|
T const_member_func4(T a0, T a1, T a2, T a3) const
|
||||||
|
{ return t | a0 | a1 | a2 | a3; }
|
||||||
|
T const_member_func5(T a0, T a1, T a2, T a3, T a4) const
|
||||||
|
{ return t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
|
||||||
T volatile_member_func0() volatile { return t; }
|
T volatile_member_func0() volatile
|
||||||
T volatile_member_func1(T a0) volatile { return t | a0; }
|
{ return t; }
|
||||||
T volatile_member_func2(T a0, T a1) volatile { return t | a0 | a1; }
|
T volatile_member_func1(T a0) volatile
|
||||||
T volatile_member_func3(T a0, T a1, T a2) volatile { return t | a0 | a1 | a2; }
|
{ return t | a0; }
|
||||||
T volatile_member_func4(T a0, T a1, T a2, T a3) volatile { return t | a0 | a1 | a2 | a3; }
|
T volatile_member_func2(T a0, T a1) volatile
|
||||||
T volatile_member_func5(T a0, T a1, T a2, T a3, T a4) volatile { return t | a0 | a1 | a2 | a3 | a4; }
|
{ return t | a0 | a1; }
|
||||||
|
T volatile_member_func3(T a0, T a1, T a2) volatile
|
||||||
|
{ return t | a0 | a1 | a2; }
|
||||||
|
T volatile_member_func4(T a0, T a1, T a2, T a3) volatile
|
||||||
|
{ return t | a0 | a1 | a2 | a3; }
|
||||||
|
T volatile_member_func5(T a0, T a1, T a2, T a3, T a4) volatile
|
||||||
|
{ return t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
|
||||||
T const_volatile_member_func0() const volatile { return t; }
|
T const_volatile_member_func0() const volatile
|
||||||
T const_volatile_member_func1(T a0) const volatile { return t | a0; }
|
{ return t; }
|
||||||
T const_volatile_member_func2(T a0, T a1) const volatile { return t | a0 | a1; }
|
T const_volatile_member_func1(T a0) const volatile
|
||||||
T const_volatile_member_func3(T a0, T a1, T a2) const volatile { return t | a0 | a1 | a2; }
|
{ return t | a0; }
|
||||||
T const_volatile_member_func4(T a0, T a1, T a2, T a3) const volatile { return t | a0 | a1 | a2 | a3; }
|
T const_volatile_member_func2(T a0, T a1) const volatile
|
||||||
T const_volatile_member_func5(T a0, T a1, T a2, T a3, T a4) const volatile { return t | a0 | a1 | a2 | a3 | a4; }
|
{ return t | a0 | a1; }
|
||||||
|
T const_volatile_member_func3(T a0, T a1, T a2) const volatile
|
||||||
|
{ return t | a0 | a1 | a2; }
|
||||||
|
T const_volatile_member_func4(T a0, T a1, T a2, T a3) const volatile
|
||||||
|
{ return t | a0 | a1 | a2 | a3; }
|
||||||
|
T const_volatile_member_func5(T a0, T a1, T a2, T a3, T a4) const volatile
|
||||||
|
{ return t | a0 | a1 | a2 | a3 | a4; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// bound functions
|
// bound functions
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T bound_func0(Thing<T> *t) { return t->t; }
|
T bound_func0(Thing<T> *t)
|
||||||
|
{ return t->t; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T bound_func1(Thing<T> *t, T a0) { return t->t | a0; }
|
T bound_func1(Thing<T> *t, T a0)
|
||||||
|
{ return t->t | a0; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T bound_func2(Thing<T> *t, T a0, T a1) { return t->t | a0 | a1; }
|
T bound_func2(Thing<T> *t, T a0, T a1)
|
||||||
|
{ return t->t | a0 | a1; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T bound_func3(Thing<T> *t, T a0, T a1, T a2) { return t->t | a0 | a1 | a2; }
|
T bound_func3(Thing<T> *t, T a0, T a1, T a2)
|
||||||
|
{ return t->t | a0 | a1 | a2; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T bound_func4(Thing<T> *t, T a0, T a1, T a2, T a3) { return t->t | a0 | a1 | a2 | a3; }
|
T bound_func4(Thing<T> *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T bound_func5(Thing<T> *t, T a0, T a1, T a2, T a3, T a4) { return t->t | a0 | a1 | a2 | a3 | a4; }
|
T bound_func5(Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
template <typename T>
|
||||||
|
T const_bound_func0(const Thing<T> *t)
|
||||||
|
{ return t->t; }
|
||||||
|
template <typename T>
|
||||||
|
T const_bound_func1(const Thing<T> *t, T a0)
|
||||||
|
{ return t->t | a0; }
|
||||||
|
template <typename T>
|
||||||
|
T const_bound_func2(const Thing<T> *t, T a0, T a1)
|
||||||
|
{ return t->t | a0 | a1; }
|
||||||
|
template <typename T>
|
||||||
|
T const_bound_func3(const Thing<T> *t, T a0, T a1, T a2)
|
||||||
|
{ return t->t | a0 | a1 | a2; }
|
||||||
|
template <typename T>
|
||||||
|
T const_bound_func4(const Thing<T> *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3; }
|
||||||
|
template <typename T>
|
||||||
|
T const_bound_func5(const Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
template <typename T>
|
||||||
|
T volatile_bound_func0(volatile Thing<T> *t)
|
||||||
|
{ return t->t; }
|
||||||
|
template <typename T>
|
||||||
|
T volatile_bound_func1(volatile Thing<T> *t, T a0)
|
||||||
|
{ return t->t | a0; }
|
||||||
|
template <typename T>
|
||||||
|
T volatile_bound_func2(volatile Thing<T> *t, T a0, T a1)
|
||||||
|
{ return t->t | a0 | a1; }
|
||||||
|
template <typename T>
|
||||||
|
T volatile_bound_func3(volatile Thing<T> *t, T a0, T a1, T a2)
|
||||||
|
{ return t->t | a0 | a1 | a2; }
|
||||||
|
template <typename T>
|
||||||
|
T volatile_bound_func4(volatile Thing<T> *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3; }
|
||||||
|
template <typename T>
|
||||||
|
T volatile_bound_func5(volatile Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_bound_func0(const volatile Thing<T> *t)
|
||||||
|
{ return t->t; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_bound_func1(const volatile Thing<T> *t, T a0)
|
||||||
|
{ return t->t | a0; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_bound_func2(const volatile Thing<T> *t, T a0, T a1)
|
||||||
|
{ return t->t | a0 | a1; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_bound_func3(const volatile Thing<T> *t, T a0, T a1, T a2)
|
||||||
|
{ return t->t | a0 | a1 | a2; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_bound_func4(const volatile Thing<T> *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_bound_func5(const volatile Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return t->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
|
||||||
// const bound functions
|
// void functions
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_func0(const Thing<T> *t) { return t->t; }
|
T void_func0(void *t)
|
||||||
|
{ return static_cast<Thing<T>*>(t)->t; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_func1(const Thing<T> *t, T a0) { return t->t | a0; }
|
T void_func1(void *t, T a0)
|
||||||
|
{ return static_cast<Thing<T>*>(t)->t | a0; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_func2(const Thing<T> *t, T a0, T a1) { return t->t | a0 | a1; }
|
T void_func2(void *t, T a0, T a1)
|
||||||
|
{ return static_cast<Thing<T>*>(t)->t | a0 | a1; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_func3(const Thing<T> *t, T a0, T a1, T a2) { return t->t | a0 | a1 | a2; }
|
T void_func3(void *t, T a0, T a1, T a2)
|
||||||
|
{ return static_cast<Thing<T>*>(t)->t | a0 | a1 | a2; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_func4(const Thing<T> *t, T a0, T a1, T a2, T a3) { return t->t | a0 | a1 | a2 | a3; }
|
T void_func4(void *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return static_cast<Thing<T>*>(t)->t | a0 | a1 | a2 | a3; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_func5(const Thing<T> *t, T a0, T a1, T a2, T a3, T a4) { return t->t | a0 | a1 | a2 | a3 | a4; }
|
T void_func5(void *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return static_cast<Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
// volatile bound functions
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T volatile_func0(volatile Thing<T> *t) { return t->t; }
|
T const_void_func0(const void *t)
|
||||||
|
{ return static_cast<const Thing<T>*>(t)->t; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T volatile_func1(volatile Thing<T> *t, T a0) { return t->t | a0; }
|
T const_void_func1(const void *t, T a0)
|
||||||
|
{ return static_cast<const Thing<T>*>(t)->t | a0; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T volatile_func2(volatile Thing<T> *t, T a0, T a1) { return t->t | a0 | a1; }
|
T const_void_func2(const void *t, T a0, T a1)
|
||||||
|
{ return static_cast<const Thing<T>*>(t)->t | a0 | a1; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T volatile_func3(volatile Thing<T> *t, T a0, T a1, T a2) { return t->t | a0 | a1 | a2; }
|
T const_void_func3(const void *t, T a0, T a1, T a2)
|
||||||
|
{ return static_cast<const Thing<T>*>(t)->t | a0 | a1 | a2; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T volatile_func4(volatile Thing<T> *t, T a0, T a1, T a2, T a3) { return t->t | a0 | a1 | a2 | a3; }
|
T const_void_func4(const void *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return static_cast<const Thing<T>*>(t)->t | a0 | a1 | a2 | a3; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T volatile_func5(volatile Thing<T> *t, T a0, T a1, T a2, T a3, T a4) { return t->t | a0 | a1 | a2 | a3 | a4; }
|
T const_void_func5(const void *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return static_cast<const Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
// const volatile bound functions
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_volatile_func0(const volatile Thing<T> *t) { return t->t; }
|
T volatile_void_func0(volatile void *t)
|
||||||
|
{ return static_cast<volatile Thing<T>*>(t)->t; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_volatile_func1(const volatile Thing<T> *t, T a0) { return t->t | a0; }
|
T volatile_void_func1(volatile void *t, T a0)
|
||||||
|
{ return static_cast<volatile Thing<T>*>(t)->t | a0; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_volatile_func2(const volatile Thing<T> *t, T a0, T a1) { return t->t | a0 | a1; }
|
T volatile_void_func2(volatile void *t, T a0, T a1)
|
||||||
|
{ return static_cast<volatile Thing<T>*>(t)->t | a0 | a1; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_volatile_func3(const volatile Thing<T> *t, T a0, T a1, T a2) { return t->t | a0 | a1 | a2; }
|
T volatile_void_func3(volatile void *t, T a0, T a1, T a2)
|
||||||
|
{ return static_cast<volatile Thing<T>*>(t)->t | a0 | a1 | a2; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_volatile_func4(const volatile Thing<T> *t, T a0, T a1, T a2, T a3) { return t->t | a0 | a1 | a2 | a3; }
|
T volatile_void_func4(volatile void *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return static_cast<volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const_volatile_func5(const volatile Thing<T> *t, T a0, T a1, T a2, T a3, T a4) { return t->t | a0 | a1 | a2 | a3 | a4; }
|
T volatile_void_func5(volatile void *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return static_cast<volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_void_func0(const volatile void *t)
|
||||||
|
{ return static_cast<const volatile Thing<T>*>(t)->t; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_void_func1(const volatile void *t, T a0)
|
||||||
|
{ return static_cast<const volatile Thing<T>*>(t)->t | a0; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_void_func2(const volatile void *t, T a0, T a1)
|
||||||
|
{ return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_void_func3(const volatile void *t, T a0, T a1, T a2)
|
||||||
|
{ return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_void_func4(const volatile void *t, T a0, T a1, T a2, T a3)
|
||||||
|
{ return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3; }
|
||||||
|
template <typename T>
|
||||||
|
T const_volatile_void_func5(const volatile void *t, T a0, T a1, T a2, T a3, T a4)
|
||||||
|
{ return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; }
|
||||||
|
|
||||||
|
|
||||||
// function call and result verification
|
// function call and result verification
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,38 @@ public:
|
||||||
attach(func);
|
attach(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(void *obj, R (*func)(void*)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(const void *obj, R (*func)(const void*)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(volatile void *obj, R (*func)(volatile void*)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(const volatile void *obj, R (*func)(const volatile void*)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
/** Create a Callback with a static function and bound pointer
|
/** Create a Callback with a static function and bound pointer
|
||||||
* @param obj Pointer to object to bind to function
|
* @param obj Pointer to object to bind to function
|
||||||
* @param func Static function to attach
|
* @param func Static function to attach
|
||||||
|
|
@ -143,6 +175,78 @@ public:
|
||||||
_thunk = func._thunk;
|
_thunk = func._thunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(void *obj, R (*func)(void*)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func) {
|
||||||
|
return (*static_cast<R (*const *)(void*)>(func))(
|
||||||
|
(void*)obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(const void *obj, R (*func)(const void*)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func) {
|
||||||
|
return (*static_cast<R (*const *)(const void*)>(func))(
|
||||||
|
(const void*)obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(volatile void *obj, R (*func)(volatile void*)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func) {
|
||||||
|
return (*static_cast<R (*const *)(volatile void*)>(func))(
|
||||||
|
(volatile void*)obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(const volatile void *obj, R (*func)(const volatile void*)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func) {
|
||||||
|
return (*static_cast<R (*const *)(const volatile void*)>(func))(
|
||||||
|
(const volatile void*)obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
/** Attach a static function with a bound pointer
|
/** Attach a static function with a bound pointer
|
||||||
* @param obj Pointer to object to bind to function
|
* @param obj Pointer to object to bind to function
|
||||||
* @param func Static function to attach
|
* @param func Static function to attach
|
||||||
|
|
@ -369,6 +473,38 @@ public:
|
||||||
attach(func);
|
attach(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(void *obj, R (*func)(void*, A0)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(const void *obj, R (*func)(const void*, A0)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(volatile void *obj, R (*func)(volatile void*, A0)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(const volatile void *obj, R (*func)(const volatile void*, A0)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
/** Create a Callback with a static function and bound pointer
|
/** Create a Callback with a static function and bound pointer
|
||||||
* @param obj Pointer to object to bind to function
|
* @param obj Pointer to object to bind to function
|
||||||
* @param func Static function to attach
|
* @param func Static function to attach
|
||||||
|
|
@ -468,6 +604,78 @@ public:
|
||||||
_thunk = func._thunk;
|
_thunk = func._thunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(void *obj, R (*func)(void*, A0)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0) {
|
||||||
|
return (*static_cast<R (*const *)(void*, A0)>(func))(
|
||||||
|
(void*)obj, a0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(const void *obj, R (*func)(const void*, A0)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0) {
|
||||||
|
return (*static_cast<R (*const *)(const void*, A0)>(func))(
|
||||||
|
(const void*)obj, a0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(volatile void *obj, R (*func)(volatile void*, A0)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0) {
|
||||||
|
return (*static_cast<R (*const *)(volatile void*, A0)>(func))(
|
||||||
|
(volatile void*)obj, a0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(const volatile void *obj, R (*func)(const volatile void*, A0)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0) {
|
||||||
|
return (*static_cast<R (*const *)(const volatile void*, A0)>(func))(
|
||||||
|
(const volatile void*)obj, a0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
/** Attach a static function with a bound pointer
|
/** Attach a static function with a bound pointer
|
||||||
* @param obj Pointer to object to bind to function
|
* @param obj Pointer to object to bind to function
|
||||||
* @param func Static function to attach
|
* @param func Static function to attach
|
||||||
|
|
@ -694,6 +902,38 @@ public:
|
||||||
attach(func);
|
attach(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(void *obj, R (*func)(void*, A0, A1)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(const void *obj, R (*func)(const void*, A0, A1)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(volatile void *obj, R (*func)(volatile void*, A0, A1)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
/** Create a Callback with a static function and bound pointer
|
/** Create a Callback with a static function and bound pointer
|
||||||
* @param obj Pointer to object to bind to function
|
* @param obj Pointer to object to bind to function
|
||||||
* @param func Static function to attach
|
* @param func Static function to attach
|
||||||
|
|
@ -793,6 +1033,78 @@ public:
|
||||||
_thunk = func._thunk;
|
_thunk = func._thunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(void *obj, R (*func)(void*, A0, A1)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1) {
|
||||||
|
return (*static_cast<R (*const *)(void*, A0, A1)>(func))(
|
||||||
|
(void*)obj, a0, a1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(const void *obj, R (*func)(const void*, A0, A1)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1) {
|
||||||
|
return (*static_cast<R (*const *)(const void*, A0, A1)>(func))(
|
||||||
|
(const void*)obj, a0, a1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(volatile void *obj, R (*func)(volatile void*, A0, A1)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1) {
|
||||||
|
return (*static_cast<R (*const *)(volatile void*, A0, A1)>(func))(
|
||||||
|
(volatile void*)obj, a0, a1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(const volatile void *obj, R (*func)(const volatile void*, A0, A1)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1) {
|
||||||
|
return (*static_cast<R (*const *)(const volatile void*, A0, A1)>(func))(
|
||||||
|
(const volatile void*)obj, a0, a1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
/** Attach a static function with a bound pointer
|
/** Attach a static function with a bound pointer
|
||||||
* @param obj Pointer to object to bind to function
|
* @param obj Pointer to object to bind to function
|
||||||
* @param func Static function to attach
|
* @param func Static function to attach
|
||||||
|
|
@ -1019,6 +1331,38 @@ public:
|
||||||
attach(func);
|
attach(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(void *obj, R (*func)(void*, A0, A1, A2)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(const void *obj, R (*func)(const void*, A0, A1, A2)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(volatile void *obj, R (*func)(volatile void*, A0, A1, A2)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
/** Create a Callback with a static function and bound pointer
|
/** Create a Callback with a static function and bound pointer
|
||||||
* @param obj Pointer to object to bind to function
|
* @param obj Pointer to object to bind to function
|
||||||
* @param func Static function to attach
|
* @param func Static function to attach
|
||||||
|
|
@ -1118,6 +1462,78 @@ public:
|
||||||
_thunk = func._thunk;
|
_thunk = func._thunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(void *obj, R (*func)(void*, A0, A1, A2)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1, A2 a2) {
|
||||||
|
return (*static_cast<R (*const *)(void*, A0, A1, A2)>(func))(
|
||||||
|
(void*)obj, a0, a1, a2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(const void *obj, R (*func)(const void*, A0, A1, A2)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1, A2 a2) {
|
||||||
|
return (*static_cast<R (*const *)(const void*, A0, A1, A2)>(func))(
|
||||||
|
(const void*)obj, a0, a1, a2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(volatile void *obj, R (*func)(volatile void*, A0, A1, A2)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1, A2 a2) {
|
||||||
|
return (*static_cast<R (*const *)(volatile void*, A0, A1, A2)>(func))(
|
||||||
|
(volatile void*)obj, a0, a1, a2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1, A2 a2) {
|
||||||
|
return (*static_cast<R (*const *)(const volatile void*, A0, A1, A2)>(func))(
|
||||||
|
(const volatile void*)obj, a0, a1, a2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
/** Attach a static function with a bound pointer
|
/** Attach a static function with a bound pointer
|
||||||
* @param obj Pointer to object to bind to function
|
* @param obj Pointer to object to bind to function
|
||||||
* @param func Static function to attach
|
* @param func Static function to attach
|
||||||
|
|
@ -1344,6 +1760,38 @@ public:
|
||||||
attach(func);
|
attach(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(void *obj, R (*func)(void*, A0, A1, A2, A3)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(const void *obj, R (*func)(const void*, A0, A1, A2, A3)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(volatile void *obj, R (*func)(volatile void*, A0, A1, A2, A3)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2, A3)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
/** Create a Callback with a static function and bound pointer
|
/** Create a Callback with a static function and bound pointer
|
||||||
* @param obj Pointer to object to bind to function
|
* @param obj Pointer to object to bind to function
|
||||||
* @param func Static function to attach
|
* @param func Static function to attach
|
||||||
|
|
@ -1443,6 +1891,78 @@ public:
|
||||||
_thunk = func._thunk;
|
_thunk = func._thunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(void *obj, R (*func)(void*, A0, A1, A2, A3)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1, A2 a2, A3 a3) {
|
||||||
|
return (*static_cast<R (*const *)(void*, A0, A1, A2, A3)>(func))(
|
||||||
|
(void*)obj, a0, a1, a2, a3);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(const void *obj, R (*func)(const void*, A0, A1, A2, A3)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1, A2 a2, A3 a3) {
|
||||||
|
return (*static_cast<R (*const *)(const void*, A0, A1, A2, A3)>(func))(
|
||||||
|
(const void*)obj, a0, a1, a2, a3);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(volatile void *obj, R (*func)(volatile void*, A0, A1, A2, A3)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1, A2 a2, A3 a3) {
|
||||||
|
return (*static_cast<R (*const *)(volatile void*, A0, A1, A2, A3)>(func))(
|
||||||
|
(volatile void*)obj, a0, a1, a2, a3);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2, A3)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1, A2 a2, A3 a3) {
|
||||||
|
return (*static_cast<R (*const *)(const volatile void*, A0, A1, A2, A3)>(func))(
|
||||||
|
(const volatile void*)obj, a0, a1, a2, a3);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
/** Attach a static function with a bound pointer
|
/** Attach a static function with a bound pointer
|
||||||
* @param obj Pointer to object to bind to function
|
* @param obj Pointer to object to bind to function
|
||||||
* @param func Static function to attach
|
* @param func Static function to attach
|
||||||
|
|
@ -1669,6 +2189,38 @@ public:
|
||||||
attach(func);
|
attach(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(void *obj, R (*func)(void*, A0, A1, A2, A3, A4)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(const void *obj, R (*func)(const void*, A0, A1, A2, A3, A4)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(volatile void *obj, R (*func)(volatile void*, A0, A1, A2, A3, A4)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a Callback with a static function and bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
Callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2, A3, A4)) {
|
||||||
|
attach(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
/** Create a Callback with a static function and bound pointer
|
/** Create a Callback with a static function and bound pointer
|
||||||
* @param obj Pointer to object to bind to function
|
* @param obj Pointer to object to bind to function
|
||||||
* @param func Static function to attach
|
* @param func Static function to attach
|
||||||
|
|
@ -1768,6 +2320,78 @@ public:
|
||||||
_thunk = func._thunk;
|
_thunk = func._thunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(void *obj, R (*func)(void*, A0, A1, A2, A3, A4)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
|
||||||
|
return (*static_cast<R (*const *)(void*, A0, A1, A2, A3, A4)>(func))(
|
||||||
|
(void*)obj, a0, a1, a2, a3, a4);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(const void *obj, R (*func)(const void*, A0, A1, A2, A3, A4)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
|
||||||
|
return (*static_cast<R (*const *)(const void*, A0, A1, A2, A3, A4)>(func))(
|
||||||
|
(const void*)obj, a0, a1, a2, a3, a4);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(volatile void *obj, R (*func)(volatile void*, A0, A1, A2, A3, A4)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
|
||||||
|
return (*static_cast<R (*const *)(volatile void*, A0, A1, A2, A3, A4)>(func))(
|
||||||
|
(volatile void*)obj, a0, a1, a2, a3, a4);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attach a static function with a bound pointer
|
||||||
|
* @param obj Pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
*/
|
||||||
|
void attach(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2, A3, A4)) {
|
||||||
|
struct local {
|
||||||
|
static R _thunk(void *obj, const void *func, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
|
||||||
|
return (*static_cast<R (*const *)(const volatile void*, A0, A1, A2, A3, A4)>(func))(
|
||||||
|
(const volatile void*)obj, a0, a1, a2, a3, a4);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&_func, 0, sizeof _func);
|
||||||
|
memcpy(&_func, &func, sizeof func);
|
||||||
|
_obj = (void*)obj;
|
||||||
|
_thunk = &local::_thunk;
|
||||||
|
}
|
||||||
|
|
||||||
/** Attach a static function with a bound pointer
|
/** Attach a static function with a bound pointer
|
||||||
* @param obj Pointer to object to bind to function
|
* @param obj Pointer to object to bind to function
|
||||||
* @param func Static function to attach
|
* @param func Static function to attach
|
||||||
|
|
@ -2004,6 +2628,50 @@ Callback<R()> callback(const Callback<R()> &func) {
|
||||||
return Callback<R()>(func);
|
return Callback<R()>(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R>
|
||||||
|
Callback<R()> callback(void *obj, R (*func)(void*)) {
|
||||||
|
return Callback<R()>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R>
|
||||||
|
Callback<R()> callback(const void *obj, R (*func)(const void*)) {
|
||||||
|
return Callback<R()>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R>
|
||||||
|
Callback<R()> callback(volatile void *obj, R (*func)(volatile void*)) {
|
||||||
|
return Callback<R()>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R>
|
||||||
|
Callback<R()> callback(const volatile void *obj, R (*func)(const volatile void*)) {
|
||||||
|
return Callback<R()>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
/** Create a callback class with type infered from the arguments
|
/** Create a callback class with type infered from the arguments
|
||||||
*
|
*
|
||||||
* @param obj Optional pointer to object to bind to function
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
|
@ -2113,6 +2781,50 @@ Callback<R(A0)> callback(const Callback<R(A0)> &func) {
|
||||||
return Callback<R(A0)>(func);
|
return Callback<R(A0)>(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0>
|
||||||
|
Callback<R(A0)> callback(void *obj, R (*func)(void*, A0)) {
|
||||||
|
return Callback<R(A0)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0>
|
||||||
|
Callback<R(A0)> callback(const void *obj, R (*func)(const void*, A0)) {
|
||||||
|
return Callback<R(A0)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0>
|
||||||
|
Callback<R(A0)> callback(volatile void *obj, R (*func)(volatile void*, A0)) {
|
||||||
|
return Callback<R(A0)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0>
|
||||||
|
Callback<R(A0)> callback(const volatile void *obj, R (*func)(const volatile void*, A0)) {
|
||||||
|
return Callback<R(A0)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
/** Create a callback class with type infered from the arguments
|
/** Create a callback class with type infered from the arguments
|
||||||
*
|
*
|
||||||
* @param obj Optional pointer to object to bind to function
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
|
@ -2222,6 +2934,50 @@ Callback<R(A0, A1)> callback(const Callback<R(A0, A1)> &func) {
|
||||||
return Callback<R(A0, A1)>(func);
|
return Callback<R(A0, A1)>(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1>
|
||||||
|
Callback<R(A0, A1)> callback(void *obj, R (*func)(void*, A0, A1)) {
|
||||||
|
return Callback<R(A0, A1)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1>
|
||||||
|
Callback<R(A0, A1)> callback(const void *obj, R (*func)(const void*, A0, A1)) {
|
||||||
|
return Callback<R(A0, A1)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1>
|
||||||
|
Callback<R(A0, A1)> callback(volatile void *obj, R (*func)(volatile void*, A0, A1)) {
|
||||||
|
return Callback<R(A0, A1)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1>
|
||||||
|
Callback<R(A0, A1)> callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1)) {
|
||||||
|
return Callback<R(A0, A1)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
/** Create a callback class with type infered from the arguments
|
/** Create a callback class with type infered from the arguments
|
||||||
*
|
*
|
||||||
* @param obj Optional pointer to object to bind to function
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
|
@ -2331,6 +3087,50 @@ Callback<R(A0, A1, A2)> callback(const Callback<R(A0, A1, A2)> &func) {
|
||||||
return Callback<R(A0, A1, A2)>(func);
|
return Callback<R(A0, A1, A2)>(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1, typename A2>
|
||||||
|
Callback<R(A0, A1, A2)> callback(void *obj, R (*func)(void*, A0, A1, A2)) {
|
||||||
|
return Callback<R(A0, A1, A2)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1, typename A2>
|
||||||
|
Callback<R(A0, A1, A2)> callback(const void *obj, R (*func)(const void*, A0, A1, A2)) {
|
||||||
|
return Callback<R(A0, A1, A2)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1, typename A2>
|
||||||
|
Callback<R(A0, A1, A2)> callback(volatile void *obj, R (*func)(volatile void*, A0, A1, A2)) {
|
||||||
|
return Callback<R(A0, A1, A2)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1, typename A2>
|
||||||
|
Callback<R(A0, A1, A2)> callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2)) {
|
||||||
|
return Callback<R(A0, A1, A2)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
/** Create a callback class with type infered from the arguments
|
/** Create a callback class with type infered from the arguments
|
||||||
*
|
*
|
||||||
* @param obj Optional pointer to object to bind to function
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
|
@ -2440,6 +3240,50 @@ Callback<R(A0, A1, A2, A3)> callback(const Callback<R(A0, A1, A2, A3)> &func) {
|
||||||
return Callback<R(A0, A1, A2, A3)>(func);
|
return Callback<R(A0, A1, A2, A3)>(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1, typename A2, typename A3>
|
||||||
|
Callback<R(A0, A1, A2, A3)> callback(void *obj, R (*func)(void*, A0, A1, A2, A3)) {
|
||||||
|
return Callback<R(A0, A1, A2, A3)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1, typename A2, typename A3>
|
||||||
|
Callback<R(A0, A1, A2, A3)> callback(const void *obj, R (*func)(const void*, A0, A1, A2, A3)) {
|
||||||
|
return Callback<R(A0, A1, A2, A3)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1, typename A2, typename A3>
|
||||||
|
Callback<R(A0, A1, A2, A3)> callback(volatile void *obj, R (*func)(volatile void*, A0, A1, A2, A3)) {
|
||||||
|
return Callback<R(A0, A1, A2, A3)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1, typename A2, typename A3>
|
||||||
|
Callback<R(A0, A1, A2, A3)> callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2, A3)) {
|
||||||
|
return Callback<R(A0, A1, A2, A3)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
/** Create a callback class with type infered from the arguments
|
/** Create a callback class with type infered from the arguments
|
||||||
*
|
*
|
||||||
* @param obj Optional pointer to object to bind to function
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
|
@ -2549,6 +3393,50 @@ Callback<R(A0, A1, A2, A3, A4)> callback(const Callback<R(A0, A1, A2, A3, A4)> &
|
||||||
return Callback<R(A0, A1, A2, A3, A4)>(func);
|
return Callback<R(A0, A1, A2, A3, A4)>(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
|
||||||
|
Callback<R(A0, A1, A2, A3, A4)> callback(void *obj, R (*func)(void*, A0, A1, A2, A3, A4)) {
|
||||||
|
return Callback<R(A0, A1, A2, A3, A4)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
|
||||||
|
Callback<R(A0, A1, A2, A3, A4)> callback(const void *obj, R (*func)(const void*, A0, A1, A2, A3, A4)) {
|
||||||
|
return Callback<R(A0, A1, A2, A3, A4)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
|
||||||
|
Callback<R(A0, A1, A2, A3, A4)> callback(volatile void *obj, R (*func)(volatile void*, A0, A1, A2, A3, A4)) {
|
||||||
|
return Callback<R(A0, A1, A2, A3, A4)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a callback class with type infered from the arguments
|
||||||
|
*
|
||||||
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
* @param func Static function to attach
|
||||||
|
* @return Callback with infered type
|
||||||
|
*/
|
||||||
|
template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
|
||||||
|
Callback<R(A0, A1, A2, A3, A4)> callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2, A3, A4)) {
|
||||||
|
return Callback<R(A0, A1, A2, A3, A4)>(obj, func);
|
||||||
|
}
|
||||||
|
|
||||||
/** Create a callback class with type infered from the arguments
|
/** Create a callback class with type infered from the arguments
|
||||||
*
|
*
|
||||||
* @param obj Optional pointer to object to bind to function
|
* @param obj Optional pointer to object to bind to function
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,34 @@
|
||||||
|
|
||||||
namespace rtos {
|
namespace rtos {
|
||||||
|
|
||||||
/** The Thread class allow defining, creating, and controlling thread functions in the system. */
|
/** The Thread class allow defining, creating, and controlling thread functions in the system.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* @code
|
||||||
|
* #include "mbed.h"
|
||||||
|
* #include "rtos.h"
|
||||||
|
*
|
||||||
|
* Thread thread;
|
||||||
|
* DigitalOut led1(LED1);
|
||||||
|
* volatile bool running = true;
|
||||||
|
*
|
||||||
|
* // Blink function toggles the led in a long running loop
|
||||||
|
* void blink(DigitalOut *led) {
|
||||||
|
* while (running) {
|
||||||
|
* *led = !*led;
|
||||||
|
* Thread::wait(1000);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // Spawns a thread to run blink for 5 seconds
|
||||||
|
* int main() {
|
||||||
|
* thread.start(led1, blink);
|
||||||
|
* Thread::wait(5000);
|
||||||
|
* running = false;
|
||||||
|
* thread.join();
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
class Thread {
|
class Thread {
|
||||||
public:
|
public:
|
||||||
/** Allocate a new thread without starting execution
|
/** Allocate a new thread without starting execution
|
||||||
|
|
@ -52,15 +79,20 @@ public:
|
||||||
@param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
|
@param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
|
||||||
@param stack_pointer pointer to the stack area to be used by this thread (default: NULL).
|
@param stack_pointer pointer to the stack area to be used by this thread (default: NULL).
|
||||||
@deprecated
|
@deprecated
|
||||||
Thread-spawning constructors hide errors and may lead to complex
|
Thread-spawning constructors hide errors. Replaced by thread.start(task).
|
||||||
program state when a thread is declared.
|
|
||||||
|
|
||||||
The explicit Thread::start member function should be used to spawn
|
@code
|
||||||
a thread.
|
Thread thread(priority, stack_size, stack_pointer);
|
||||||
|
|
||||||
|
osStatus status = thread.start(task);
|
||||||
|
if (status != osOK) {
|
||||||
|
error("oh no!");
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
*/
|
*/
|
||||||
MBED_DEPRECATED_SINCE("mbed-os-5.1",
|
MBED_DEPRECATED_SINCE("mbed-os-5.1",
|
||||||
"Thread-spawning constructors hide errors and may lead to complex "
|
"Thread-spawning constructors hide errors. "
|
||||||
"program state when a thread is declared")
|
"Replaced by thread.start(task).")
|
||||||
Thread(mbed::Callback<void()> task,
|
Thread(mbed::Callback<void()> task,
|
||||||
osPriority priority=osPriorityNormal,
|
osPriority priority=osPriorityNormal,
|
||||||
uint32_t stack_size=DEFAULT_STACK_SIZE,
|
uint32_t stack_size=DEFAULT_STACK_SIZE,
|
||||||
|
|
@ -76,21 +108,26 @@ public:
|
||||||
@param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
|
@param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
|
||||||
@param stack_pointer pointer to the stack area to be used by this thread (default: NULL).
|
@param stack_pointer pointer to the stack area to be used by this thread (default: NULL).
|
||||||
@deprecated
|
@deprecated
|
||||||
Thread-spawning constructors hide errors and may lead to complex
|
Thread-spawning constructors hide errors. Replaced by thread.start(callback(argument, task)).
|
||||||
program state when a thread is declared.
|
|
||||||
|
|
||||||
The explicit Thread::start member function should be used to spawn
|
@code
|
||||||
a thread.
|
Thread thread(priority, stack_size, stack_pointer);
|
||||||
|
|
||||||
|
osStatus status = thread.start(callback(argument, task));
|
||||||
|
if (status != osOK) {
|
||||||
|
error("oh no!");
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
MBED_DEPRECATED_SINCE("mbed-os-5.1",
|
MBED_DEPRECATED_SINCE("mbed-os-5.1",
|
||||||
"Thread-spawning constructors hide errors and may lead to complex "
|
"Thread-spawning constructors hide errors. "
|
||||||
"program state when a thread is declared")
|
"Replaced by thread.start(callback(argument, task)).")
|
||||||
Thread(T *obj, void (T::*method)(),
|
Thread(T *argument, void (T::*task)(),
|
||||||
osPriority priority=osPriorityNormal,
|
osPriority priority=osPriorityNormal,
|
||||||
uint32_t stack_size=DEFAULT_STACK_SIZE,
|
uint32_t stack_size=DEFAULT_STACK_SIZE,
|
||||||
unsigned char *stack_pointer=NULL) {
|
unsigned char *stack_pointer=NULL) {
|
||||||
constructor(mbed::callback(obj, method),
|
constructor(mbed::callback(argument, task),
|
||||||
priority, stack_size, stack_pointer);
|
priority, stack_size, stack_pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,21 +139,26 @@ public:
|
||||||
@param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
|
@param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
|
||||||
@param stack_pointer pointer to the stack area to be used by this thread (default: NULL).
|
@param stack_pointer pointer to the stack area to be used by this thread (default: NULL).
|
||||||
@deprecated
|
@deprecated
|
||||||
Thread-spawning constructors hide errors and may lead to complex
|
Thread-spawning constructors hide errors. Replaced by thread.start(callback(argument, task)).
|
||||||
program state when a thread is declared.
|
|
||||||
|
|
||||||
The explicit Thread::start member function should be used to spawn
|
@code
|
||||||
a thread.
|
Thread thread(priority, stack_size, stack_pointer);
|
||||||
|
|
||||||
|
osStatus status = thread.start(callback(argument, task));
|
||||||
|
if (status != osOK) {
|
||||||
|
error("oh no!");
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
MBED_DEPRECATED_SINCE("mbed-os-5.1",
|
MBED_DEPRECATED_SINCE("mbed-os-5.1",
|
||||||
"Thread-spawning constructors hide errors and may lead to complex "
|
"Thread-spawning constructors hide errors. "
|
||||||
"program state when a thread is declared")
|
"Replaced by thread.start(callback(argument, task)).")
|
||||||
Thread(T *obj, void (*method)(T *),
|
Thread(T *argument, void (*task)(T *),
|
||||||
osPriority priority=osPriorityNormal,
|
osPriority priority=osPriorityNormal,
|
||||||
uint32_t stack_size=DEFAULT_STACK_SIZE,
|
uint32_t stack_size=DEFAULT_STACK_SIZE,
|
||||||
unsigned char *stack_pointer=NULL) {
|
unsigned char *stack_pointer=NULL) {
|
||||||
constructor(mbed::callback(obj, method),
|
constructor(mbed::callback(argument, task),
|
||||||
priority, stack_size, stack_pointer);
|
priority, stack_size, stack_pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,15 +170,20 @@ public:
|
||||||
@param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
|
@param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
|
||||||
@param stack_pointer pointer to the stack area to be used by this thread (default: NULL).
|
@param stack_pointer pointer to the stack area to be used by this thread (default: NULL).
|
||||||
@deprecated
|
@deprecated
|
||||||
Thread-spawning constructors hide errors and may lead to complex
|
Thread-spawning constructors hide errors. Replaced by thread.start(callback(argument, task)).
|
||||||
program state when a thread is declared.
|
|
||||||
|
|
||||||
The explicit Thread::start member function should be used to spawn
|
@code
|
||||||
a thread.
|
Thread thread(priority, stack_size, stack_pointer);
|
||||||
|
|
||||||
|
osStatus status = thread.start(callback(argument, task));
|
||||||
|
if (status != osOK) {
|
||||||
|
error("oh no!");
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
*/
|
*/
|
||||||
MBED_DEPRECATED_SINCE("mbed-os-5.1",
|
MBED_DEPRECATED_SINCE("mbed-os-5.1",
|
||||||
"Thread-spawning constructors hide errors and may lead to complex "
|
"Thread-spawning constructors hide errors. "
|
||||||
"program state when a thread is declared")
|
"Replaced by thread.start(callback(argument, task)).")
|
||||||
Thread(void (*task)(void const *argument), void *argument=NULL,
|
Thread(void (*task)(void const *argument), void *argument=NULL,
|
||||||
osPriority priority=osPriorityNormal,
|
osPriority priority=osPriorityNormal,
|
||||||
uint32_t stack_size=DEFAULT_STACK_SIZE,
|
uint32_t stack_size=DEFAULT_STACK_SIZE,
|
||||||
|
|
@ -156,13 +203,12 @@ public:
|
||||||
@param method function to be executed by this thread.
|
@param method function to be executed by this thread.
|
||||||
@return status code that indicates the execution status of the function.
|
@return status code that indicates the execution status of the function.
|
||||||
@deprecated
|
@deprecated
|
||||||
The start function does not support cv-qualifiers. Replaced by
|
The start function does not support cv-qualifiers. Replaced by start(callback(obj, method)).
|
||||||
start(callback(obj, method)).
|
|
||||||
*/
|
*/
|
||||||
template <typename T, typename M>
|
template <typename T, typename M>
|
||||||
MBED_DEPRECATED_SINCE("mbed-os-5.1",
|
MBED_DEPRECATED_SINCE("mbed-os-5.1",
|
||||||
"The start function does not support cv-qualifiers. Replaced by "
|
"The start function does not support cv-qualifiers. "
|
||||||
"start(callback(obj, method)).")
|
"Replaced by thread.start(callback(obj, method)).")
|
||||||
osStatus start(T *obj, M method) {
|
osStatus start(T *obj, M method) {
|
||||||
return start(mbed::callback(obj, method));
|
return start(mbed::callback(obj, method));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue