Skip to content

Commit c8085d4

Browse files
cy-opmromanjoe
authored andcommitted
Update template argument names to not collide with Arduino names
1 parent d0b5ba6 commit c8085d4

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

drivers/internal/Task.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace events {
2929
*/
3030

3131

32-
template<typename F, typename A1 = void, typename A2 = void, typename A3 = void, typename A4 = void, typename A5 = void>
32+
template<typename F, typename ARG1 = void, typename ARG2 = void, typename ARG3 = void, typename ARG4 = void, typename ARG5 = void>
3333
struct AllArgs;
3434

3535
template<typename B0>
@@ -543,22 +543,22 @@ class Task<R()>: public TaskBase {
543543
All _args;
544544
};
545545

546-
template <typename R, typename A0>
547-
class Task<R(A0)>: public TaskBase {
546+
template <typename R, typename ARG0>
547+
class Task<R(ARG0)>: public TaskBase {
548548
public:
549549

550-
Task(TaskQueue *q = NULL, mbed::Callback<R(A0)> cb = mbed::Callback<R(A0)>())
550+
Task(TaskQueue *q = NULL, mbed::Callback<R(ARG0)> cb = mbed::Callback<R(ARG0)>())
551551
: TaskBase(q), _args(cb)
552552
{
553553
}
554554

555-
Task &operator=(mbed::Callback<R(A0)> cb)
555+
Task &operator=(mbed::Callback<R(ARG0)> cb)
556556
{
557557
_args.b0 = cb;
558558
return *this;
559559
}
560560

561-
void call(A0 a0)
561+
void call(ARG0 a0)
562562
{
563563
_args.b1 = a0;
564564
post();
@@ -578,16 +578,16 @@ class Task<R(A0)>: public TaskBase {
578578
}
579579

580580
private:
581-
typedef AllArgs<mbed::Callback<R(A0)>, A0> All;
581+
typedef AllArgs<mbed::Callback<R(ARG0)>, ARG0> All;
582582
All _args;
583583
};
584584

585585
/** Task
586586
*
587587
* Representation of a postable task
588588
*/
589-
template <typename R, typename A0, typename A1>
590-
class Task<R(A0, A1)>: public TaskBase {
589+
template <typename R, typename ARG0, typename ARG1>
590+
class Task<R(ARG0, ARG1)>: public TaskBase {
591591
public:
592592

593593
/**
@@ -596,7 +596,7 @@ class Task<R(A0, A1)>: public TaskBase {
596596
* @param q TaskQueue to post to
597597
* @param cb Callback to run
598598
*/
599-
Task(TaskQueue *q = NULL, mbed::Callback<R(A0, A1)> cb = mbed::Callback<R(A0, A1)>())
599+
Task(TaskQueue *q = NULL, mbed::Callback<R(ARG0, ARG1)> cb = mbed::Callback<R(ARG0, ARG1)>())
600600
: TaskBase(q), _args(cb)
601601
{
602602
}
@@ -606,7 +606,7 @@ class Task<R(A0, A1)>: public TaskBase {
606606
*
607607
* @param cb Callback to run
608608
*/
609-
Task &operator=(mbed::Callback<R(A0, A1)> cb)
609+
Task &operator=(mbed::Callback<R(ARG0, ARG1)> cb)
610610
{
611611
_args.b0 = cb;
612612
return *this;
@@ -623,7 +623,7 @@ class Task<R(A0, A1)>: public TaskBase {
623623
* @param a0 First callback parameter
624624
* @param a1 Second callback parameter
625625
*/
626-
void call(A0 a0, A1 a1)
626+
void call(ARG0 a0, ARG1 a1)
627627
{
628628
_args.b1 = a0;
629629
_args.b2 = a1;
@@ -644,7 +644,7 @@ class Task<R(A0, A1)>: public TaskBase {
644644
}
645645

646646
private:
647-
typedef AllArgs<mbed::Callback<R(A0, A1)>, A0, A1> All;
647+
typedef AllArgs<mbed::Callback<R(ARG0, ARG1)>, ARG0, ARG1> All;
648648
All _args;
649649
};
650650

platform/FunctionPointer.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,37 @@ namespace mbed {
3232

3333
// Declarations for backwards compatibility
3434
// To be foward compatible, code should adopt the Callback class
35-
template <typename R, typename A1>
36-
class FunctionPointerArg1 : public Callback<R(A1)> {
35+
template <typename R, typename ARG1>
36+
class FunctionPointerArg1 : public Callback<R(ARG1)> {
3737
public:
3838
MBED_DEPRECATED_SINCE("mbed-os-5.1",
3939
"FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
40-
FunctionPointerArg1(R(*function)(A1) = 0)
41-
: Callback<R(A1)>(function) {}
40+
FunctionPointerArg1(R(*function)(ARG1) = 0)
41+
: Callback<R(ARG1)>(function) {}
4242

4343
template<typename T>
4444
MBED_DEPRECATED_SINCE("mbed-os-5.1",
4545
"FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
46-
FunctionPointerArg1(T *object, R(T::*member)(A1))
47-
: Callback<R(A1)>(object, member) {}
46+
FunctionPointerArg1(T *object, R(T::*member)(ARG1))
47+
: Callback<R(ARG1)>(object, member) {}
4848

49-
R(*get_function())(A1)
49+
R(*get_function())(ARG1)
5050
{
51-
return *reinterpret_cast<R(* *)(A1)>(this);
51+
return *reinterpret_cast<R(* *)(ARG1)>(this);
5252
}
5353

54-
R call(A1 a1) const
54+
R call(ARG1 a1) const
5555
{
56-
if (!Callback<R(A1)>::operator bool()) {
56+
if (!Callback<R(ARG1)>::operator bool()) {
5757
return (R)0;
5858
}
5959

60-
return Callback<R(A1)>::call(a1);
60+
return Callback<R(ARG1)>::call(a1);
6161
}
6262

63-
R operator()(A1 a1) const
63+
R operator()(ARG1 a1) const
6464
{
65-
return Callback<R(A1)>::call(a1);
65+
return Callback<R(ARG1)>::call(a1);
6666
}
6767
};
6868

0 commit comments

Comments
 (0)