?? gsdpqueue.cpp
字號:
// gsdpqueue.cpp
//
// Basic Queue for the GSDP server
//
// Copyright (c) 2000-2002 Symbian Ltd. All rights reserved.
#include "gsdpqueue.h"
/*
CGsdpQueueBase
*/
CGsdpQueueBase::CGsdpQueueBase()
{
}
void CGsdpQueueBase::ConstructL()
{
for (TInt i=0; i<10; i++)
{
TGsdpPacket* packet=new(ELeave) TGsdpPacket;
iSlots.AddFirst(*packet);
}
}
CGsdpQueueBase::~CGsdpQueueBase()
{
TGsdpPacket* packet;
for (packet=iSlots.First(); packet; packet=iSlots.First())
{
iSlots.Remove(*packet);
delete packet;
}
for (packet=iPackets.First(); packet; packet=iPackets.First())
{
iPackets.Remove(*packet);
delete packet;
}
}
// functions
TGsdpPacket* CGsdpQueueBase::AddPacket(TUint32 aGameProtocol, TUint32 aToPort, const TDesC8& aAddress, TUint32 aFromPort, const TDesC8& aData)
/**
Queue a packet.
@param aAddress: the address to send to or from which this was received.
*/
{
// get first free packet slot - drop packet if there isn't one
TGsdpPacket* packet=iSlots.First();
if (!packet)
return 0;
iSlots.Remove(*packet);
// plug in values
packet->iGameProtocol=aGameProtocol;
packet->iToPort=aToPort;
packet->iAddress=aAddress;
packet->iFromPort=aFromPort;
packet->iData=aData;
// add to packet queue
iPackets.AddLast(*packet);
return packet;
}
void CGsdpQueueBase::FreePacket(TGsdpPacket& aPacket)
{
iPackets.Remove(aPacket);
iSlots.AddFirst(aPacket);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -