aboutsummaryrefslogtreecommitdiff
path: root/src/old/linkmessenger.cpp
blob: 3bd401a903d56b633af38af3d85a17c050265cc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "linkmessenger.h"

LinkMessenger::LinkMessenger() :
	pFirst( NULL ),
	pLast( NULL )
{
}

LinkMessenger::~LinkMessenger()
{
}

void LinkMessenger::enqueueMessage( LinkMessage *pMsg )
{
	if( pLast == NULL )
	{
		pFirst = pLast = new Link;
		pLast->pMsg = pMsg;
		pLast->pNext = NULL;
	}
	else
	{
		pLast->pNext = new Link;
		pLast = pLast->pNext;
		pLast->pMsg = pMsg;
		pLast->pNext = NULL;
	}
}

LinkMessage *LinkMessenger::dequeueMessage()
{
	if( pFirst == NULL )
		return NULL;

	Link *pTmp = pFirst;
	pFirst = pFirst->pNext;
	LinkMessage *pRet = pTmp->pMsg;
	delete pTmp;
	return pRet;
}