28 template <
class tVARTYPE>
class DLList;
34 friend class DLList<tVARTYPE>;
53 template <
class tVARTYPE>
class DLList
63 void insertAtBeginning(
const tVARTYPE& val);
64 void insertAtEnd(
const tVARTYPE& val);
101 template <
class tVARTYPE>
113 template <
class tVARTYPE>
120 template <
class tVARTYPE>
127 while (pCurrNode != NULL)
129 pNextNode = pCurrNode->m_pNext;
131 pCurrNode = pNextNode;
142 template <
class tVARTYPE>
147 assert((m_pHead == NULL) || (m_iLength > 0));
153 m_pHead->m_pPrev = pNode;
154 pNode->m_pNext = m_pHead;
168 template <
class tVARTYPE>
173 assert((m_pHead == NULL) || (m_iLength > 0));
179 m_pTail->m_pNext = pNode;
180 pNode->m_pPrev = m_pTail;
194 template <
class tVARTYPE>
199 assert((m_pHead == NULL) || (m_iLength > 0));
201 if ((pThisNode == NULL) || (pThisNode->m_pPrev == NULL))
203 insertAtBeginning(val);
209 pThisNode->m_pPrev->m_pNext = pNode;
210 pNode->m_pPrev = pThisNode->m_pPrev;
211 pThisNode->m_pPrev = pNode;
212 pNode->m_pNext = pThisNode;
219 template <
class tVARTYPE>
224 assert((m_pHead == NULL) || (m_iLength > 0));
226 if ((pThisNode == NULL) || (pThisNode->m_pNext == NULL))
234 pThisNode->m_pNext->m_pPrev = pNode;
235 pNode->m_pNext = pThisNode->m_pNext;
236 pThisNode->m_pNext = pNode;
237 pNode->m_pPrev = pThisNode;
243 template <
class tVARTYPE>
249 assert(pNode != NULL);
251 pPrevNode = pNode->m_pPrev;
252 pNextNode = pNode->m_pNext;
254 if ((pPrevNode != NULL) && (pNextNode != NULL))
256 pPrevNode->m_pNext = pNextNode;
257 pNextNode->m_pPrev = pPrevNode;
259 else if (pPrevNode != NULL)
261 pPrevNode->m_pNext = NULL;
264 else if (pNextNode != NULL)
266 pNextNode->m_pPrev = NULL;
283 template <
class tVARTYPE>
289 assert(pNode != NULL);
291 if (getLength() == 1)
296 if (pNode == m_pTail)
301 pPrevNode = pNode->m_pPrev;
302 pNextNode = pNode->m_pNext;
304 if ((pPrevNode != NULL) && (pNextNode != NULL))
306 pPrevNode->m_pNext = pNextNode;
307 pNextNode->m_pPrev = pPrevNode;
309 else if (pPrevNode != NULL)
311 pPrevNode->m_pNext = NULL;
314 else if (pNextNode != NULL)
316 pNextNode->m_pPrev = NULL;
325 pNode->m_pNext = NULL;
326 m_pTail->m_pNext = pNode;
327 pNode->m_pPrev = m_pTail;
332 template <
class tVARTYPE>
335 assert(pNode != NULL);
337 return pNode->m_pNext;
341 template <
class tVARTYPE>
344 assert(pNode != NULL);
346 return pNode->m_pPrev;
350 template <
class tVARTYPE>
359 while (pNode != NULL)
367 pNode = pNode->m_pNext;
374 #endif //LINKEDLIST_H
virtual int Subscribe(player_devaddr_t addr)
Subscribe to this driver.
static bool MatchMessage(player_msghdr_t *hdr, int type, int subtype, player_devaddr_t addr)
Helper for message processing.
Definition: message.h:159
double ReadFloat(int section, const char *name, double value)
Read a floating point (double) value.
Generic message header.
Definition: player.h:162
virtual int Subscribe(QueuePointer &, player_devaddr_t)
Subscribe to this driver.
Definition: driver.h:343
virtual int MainSetup(void)
Sets up the resources needed by the driver thread.
Definition: driver.h:658
virtual void MainQuit(void)
Cleanup method for driver thread (called when main exits)
Definition: driver.h:664
Encapsulates a device (i.e., a driver bound to an interface)
Definition: device.h:75
const char * ReadString(int section, const char *name, const char *value)
Read a string value.
virtual void Main(void)=0
Main method for driver thread.
int ReadInt(int section, const char *name, int value)
Read an integer value.
#define PLAYER_MSGTYPE_DATA
A data message.
Definition: player.h:95
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
static bool MatchDeviceAddress(player_devaddr_t addr1, player_devaddr_t addr2)
Compare two addresses.
Definition: device.h:201
int ReadDeviceAddr(player_devaddr_t *addr, int section, const char *name, int code, int index, const char *key)
Read a device id.
int GetTupleCount(int section, const char *name)
Get the number of values in a tuple.
Class for loading configuration file information.
Definition: configfile.h:197
virtual int Setup()
Initialize the driver.
Definition: driver.h:386
A device address.
Definition: player.h:146
An autopointer for the message queue.
Definition: message.h:74
#define PLAYER_ERROR(msg)
Definition: error.h:81
Base class for drivers which oeprate with a thread.
Definition: driver.h:553
#define PLAYER_WARN(msg)
Warning message macros.
Definition: error.h:89
#define PLAYER_MSGTYPE_CMD
A command message.
Definition: player.h:99
virtual int Shutdown()
Finalize the driver.
Definition: driver.h:393
Base class for all drivers.
Definition: driver.h:109
#define PLAYER_MSGQUEUE_DEFAULT_MAXLEN
Default maximum length for a message queue.
Definition: player.h:76