Purpose: Creates singleton hzIpServer instance Pointer to the hzIpServer instance. The same instance is returned however many times this function is called. NULL if no logger is provided
| Return Type | Function name | Arguments |
|---|---|---|
| hzIpServer* | hzIpServer::GetInstance | (hzLogger*,) |
Declared in file: hzIpServer.h
Defined in file : hzIpServer.cpp
Function Logic:
Function body:
hzIpServer* hzIpServer::GetInstance (hzLogger* pLogger)
{
// Purpose: Creates singleton hzIpServer instance
//
// Argument: pLogger The logger for the server (compulsory)
//
// Returns: Pointer to the hzIpServer instance. The same instance is returned however many times this function is called.
// NULL if no logger is provided
_hzfunc("hzIpServer::GetInstance") ;
hzIpServer* pSvr = 0; // TCP server
if (!pLogger)
{ hzerr(E_NOINIT, "No logfile supplied") ; return 0; }
if (s_pTheOneAndOnlyServer)
pSvr = s_pTheOneAndOnlyServer ;
else
{
pSvr = new hzIpServer() ;
pSvr->m_pLog = pLogger ;
s_pTheOneAndOnlyServer = pSvr ;
}
return pSvr ;
}