Skip to content

Commit 6b9098e

Browse files
committed
avoid name collisions with Queue and Table
1 parent 24333f4 commit 6b9098e

File tree

6 files changed

+17
-16
lines changed

6 files changed

+17
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88
### Added
99

1010
### Changed
11+
- Queue and Table are now ArduinoCIQueue and ArduinoCITable to avoid name collisions
1112

1213
### Deprecated
1314

cpp/arduino/PinHistory.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
template <typename T>
88
class PinHistory : public ObservableDataStream {
99
private:
10-
Queue<T> qIn;
11-
Queue<T> qOut;
10+
ArduinoCIQueue<T> qIn;
11+
ArduinoCIQueue<T> qOut;
1212

1313
void clear() {
1414
qOut.clear();
1515
qIn.clear();
1616
}
1717

1818
// enqueue ascii bits
19-
void a2q(Queue<T> &q, String input, bool bigEndian, bool advertise) {
19+
void a2q(ArduinoCIQueue<T> &q, String input, bool bigEndian, bool advertise) {
2020
// 8 chars at a time, form up
2121
for (int j = 0; j < input.length(); ++j) {
2222
for (int i = 0; i < 8; ++i) {
@@ -31,10 +31,10 @@ class PinHistory : public ObservableDataStream {
3131

3232
// convert a queue to a string as if it was serial bits
3333
// start from offset, consider endianness
34-
String q2a(const Queue<T> &q, unsigned int offset, bool bigEndian) const {
34+
String q2a(const ArduinoCIQueue<T> &q, unsigned int offset, bool bigEndian) const {
3535
String ret = "";
3636

37-
Queue<T> q2(q);
37+
ArduinoCIQueue<T> q2(q);
3838

3939
while (offset) {
4040
q2.pop();
@@ -135,7 +135,7 @@ class PinHistory : public ObservableDataStream {
135135
// copy elements to an array, up to a given length
136136
// return the number of elements moved
137137
int toArray (T* arr, unsigned int length) const {
138-
Queue<T> q2(qOut);
138+
ArduinoCIQueue<T> q2(qOut);
139139

140140
int ret = 0;
141141
for (int i = 0; i < length && q2.size(); ++i) {
@@ -149,7 +149,7 @@ class PinHistory : public ObservableDataStream {
149149
// see if the array matches the elements in the queue
150150
bool hasElements (T const * const arr, unsigned int length) const {
151151
int i;
152-
Queue<T> q2(qOut);
152+
ArduinoCIQueue<T> q2(qOut);
153153
for (i = 0; i < length && q2.size(); ++i) {
154154
if (q2.front() != arr[i]) return false;
155155
q2.pop();

cpp/arduino/ci/DeviceUsingBytes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
class DeviceUsingBytes : public DataStreamObserver {
2626
public:
2727
String mMessage;
28-
Table<String, String> mResponses;
28+
ArduinoCITable<String, String> mResponses;
2929
GodmodeState* state;
3030

3131

cpp/arduino/ci/ObservableDataStream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class DataStreamObserver {
7272
class ObservableDataStream
7373
{
7474
private:
75-
Table<String, DataStreamObserver*> mObservers;
75+
ArduinoCITable<String, DataStreamObserver*> mObservers;
7676
bool mAdvertisingBit;
7777
unsigned char mAdvertisingByte;
7878

cpp/arduino/ci/Queue.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
template <typename T>
4-
class Queue {
4+
class ArduinoCIQueue {
55
private:
66
struct Node {
77
T data;
@@ -19,9 +19,9 @@ class Queue {
1919
}
2020

2121
public:
22-
Queue(): mNil() { init(); }
22+
ArduinoCIQueue(): mNil() { init(); }
2323

24-
Queue(const Queue<T>& q) {
24+
ArduinoCIQueue(const ArduinoCIQueue<T>& q) {
2525
init();
2626
for (Node* n = q.mFront; n; n = n->next) push(n->data);
2727
}
@@ -69,5 +69,5 @@ class Queue {
6969

7070
void clear() { while (!empty()) pop(); }
7171

72-
~Queue() { clear(); }
72+
~ArduinoCIQueue() { clear(); }
7373
};

cpp/arduino/ci/Table.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// this is this stupidest table implementation ever but it's
66
// an MVP for unit testing. O(n).
77
template <typename K, typename V>
8-
class Table {
8+
class ArduinoCITable {
99
private:
1010
struct Node {
1111
K key;
@@ -25,7 +25,7 @@ class Table {
2525
}
2626

2727
public:
28-
Table() : mNilK(), mNilV() { init(); }
28+
ArduinoCITable() : mNilK(), mNilV() { init(); }
2929

3030
// number of things in the table
3131
inline unsigned long size() const { return mSize; }
@@ -121,5 +121,5 @@ class Table {
121121
}
122122
}
123123

124-
~Table() { clear(); }
124+
~ArduinoCITable() { clear(); }
125125
};

0 commit comments

Comments
 (0)