Skip to content

Commit 1dc53e4

Browse files
author
Ari Parkkila
committed
Cellular: Add count/dequeue methods in CellularList
1 parent 2ac04c5 commit 1dc53e4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

features/cellular/framework/common/CellularList.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,27 @@ template <class T> class CellularList {
8686
delete current;
8787
}
8888

89+
int count()
90+
{
91+
T *item = _head;
92+
int n = 0;
93+
while (item) {
94+
item = item->next;
95+
n++;
96+
}
97+
return n;
98+
}
99+
100+
T *dequeue()
101+
{
102+
if (!_head) {
103+
return NULL;
104+
}
105+
T *temp = _head;
106+
_head = _head->next;
107+
return temp;
108+
}
109+
89110
void delete_all()
90111
{
91112
T *temp = _head;

0 commit comments

Comments
 (0)