Isle
Loading...
Searching...
No Matches
mxqueue.h
Go to the documentation of this file.
1#ifndef MXQUEUE_H
2#define MXQUEUE_H
3
4#include "mxlist.h"
5
10template <class T>
11class MxQueue : public MxList<T> {
12public:
15 void Enqueue(T& p_obj)
16 {
17 // TODO
18 }
19
23 MxBool Dequeue(T& p_obj)
24 {
25 MxBool hasNext = (this->m_first != NULL);
26 if (this->m_first) {
27 p_obj = this->m_first->GetValue();
28 this->DeleteEntry(this->m_first);
29 }
30
31 return hasNext;
32 }
33};
34
35#endif // MXQUEUE_H
[AI] Forward declaration for MxList.
Definition: mxlist.h:89
MxListEntry< T > * m_first
[AI] Pointer to the first entry in the list. [AI]
Definition: mxlist.h:126
void DeleteEntry(MxListEntry< T > *)
[AI]
Template class implementing a queue, derived from MxList.
Definition: mxqueue.h:11
MxBool Dequeue(T &p_obj)
Removes the object from the front of the queue and copies it to p_obj.
Definition: mxqueue.h:23
void Enqueue(T &p_obj)
Adds an object to the end of the queue.
Definition: mxqueue.h:15
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
MxU8 MxBool
[AI]
Definition: mxtypes.h:124