Network - Id on client and == operator.
This commit is contained in:
parent
94651ec77a
commit
092f83a084
|
@ -52,9 +52,15 @@ struct NetworkClient::PrivateData : public IThreadObject
|
||||||
std::mutex postBoxMutex;
|
std::mutex postBoxMutex;
|
||||||
|
|
||||||
Translator translator;
|
Translator translator;
|
||||||
|
|
||||||
|
//ID
|
||||||
|
static unsigned int currID;
|
||||||
|
const unsigned int ID;
|
||||||
};
|
};
|
||||||
|
|
||||||
NetworkClient::PrivateData::PrivateData()
|
unsigned int NetworkClient::PrivateData::currID = 0;
|
||||||
|
|
||||||
|
NetworkClient::PrivateData::PrivateData() : ID(currID++)
|
||||||
{
|
{
|
||||||
InitWinSock();
|
InitWinSock();
|
||||||
|
|
||||||
|
@ -67,7 +73,7 @@ NetworkClient::PrivateData::PrivateData()
|
||||||
Start();
|
Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkClient::PrivateData::PrivateData(unsigned int socket)
|
NetworkClient::PrivateData::PrivateData(unsigned int socket) : ID(currID++)
|
||||||
{
|
{
|
||||||
InitWinSock();
|
InitWinSock();
|
||||||
|
|
||||||
|
@ -259,4 +265,9 @@ void NetworkClient::SetRecieverObject(RecieverObject recvObj, NetworkProtocolCal
|
||||||
privateData->recvObj = SmartPointer<RecieverObject>(&recvObj);
|
privateData->recvObj = SmartPointer<RecieverObject>(&recvObj);
|
||||||
privateData->callbackType = type;
|
privateData->callbackType = type;
|
||||||
privateData->recvObjMutex.unlock();
|
privateData->recvObjMutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NetworkClient::operator ==(const NetworkClient& obj)
|
||||||
|
{
|
||||||
|
return (this->privateData->ID == obj.privateData->ID);
|
||||||
}
|
}
|
|
@ -41,6 +41,8 @@ namespace Oyster
|
||||||
|
|
||||||
void SetRecieverObject(RecieverObject recvObj, NetworkProtocolCallbackType type);
|
void SetRecieverObject(RecieverObject recvObj, NetworkProtocolCallbackType type);
|
||||||
|
|
||||||
|
bool operator ==(const NetworkClient& obj);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PrivateData;
|
struct PrivateData;
|
||||||
PrivateData* privateData;
|
PrivateData* privateData;
|
||||||
|
|
Loading…
Reference in New Issue