Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
34 lines
798 B
C++
34 lines
798 B
C++
#ifndef _GAMA_SERVER_NETWORK_POOL_DISPATCH_FACTORY_H_
|
|
#define _GAMA_SERVER_NETWORK_POOL_DISPATCH_FACTORY_H_
|
|
|
|
#include "Dispatch.h"
|
|
#include <boost/pool/pool.hpp>
|
|
|
|
template<typename DispatchType>
|
|
class CPoolDispatchFactory : public CDispatchFactory
|
|
{
|
|
public:
|
|
|
|
CPoolDispatchFactory() : m_DispatchPool(sizeof(DispatchType)) { }
|
|
virtual ~CPoolDispatchFactory() { }
|
|
|
|
virtual CPacketDispatch* CreateDispatch(CSession& Session)
|
|
{
|
|
void* ptr = m_DispatchPool.malloc();
|
|
return new (ptr) DispatchType(Session);
|
|
}
|
|
|
|
virtual void DeleteDispatch(CPacketDispatch* lpDispatch)
|
|
{
|
|
lpDispatch->~CPacketDispatch();
|
|
m_DispatchPool.free(lpDispatch);
|
|
}
|
|
|
|
protected:
|
|
|
|
typedef boost::pool<> DispatchPool;
|
|
|
|
DispatchPool m_DispatchPool;
|
|
};
|
|
|
|
#endif |