#ifndef __SERVER_SESSION_MANAGER_H__ #define __SERVER_SESSION_MANAGER_H__ #pragma once class ServerSessionEx; #include #include #include // DWORDÇü ServerKey¸¦ ¸ÊÀÇ Å°·Î »ç¿ëÇÑ´Ù. typedef Delegator SERVER_SESSION_DELEGATOR; typedef std::pair SERVER_SESSION_PAIR; //typedef CMemoryPoolFactory SERVER_SESSION_POOL_TOKEN; typedef STLX_MAP SERVER_SESSION_MAP; typedef SERVER_SESSION_MAP::iterator SERVER_SESSION_MAP_ITER; typedef Delegator SERVER_SESSION_MAP_DELEGATOR; // Key is ServerSession* typedef std::pair SERVER_SESSION_CONTAINER_PAIR; typedef STLX_MAP SERVER_SESSION_CONTAINER; typedef SERVER_SESSION_CONTAINER::iterator SERVER_SESSION_CONTAINER_ITER; typedef Delegator SERVER_SESSION_CONTAINER_DELEGATOR; class ServerSessionManager : public util::Singleton { public: ServerSessionManager(); ~ServerSessionManager(); public: //GLOBAL_SERVER_KEY AddServer( ip, port, ... ); VOID AddServer( SERVER_SESSION_DELEGATOR pSessionDelegator ); VOID RemoveServer( SERVER_SESSION_DELEGATOR pSessionDelegator ); // ¾ÆÁ÷Àº container¸¸ »ç¿ëÇÑ´Ù. SERVER_SESSION_DELEGATOR& FindServer( SERVER_SESSION_DELEGATOR pServer ); VOID Update(); // Á¢¼ÓµÇ¾î ÀÖ´Â ¸¶½ºÅͼ­¹öµé¿¡°Ô ºê·Îµåij½ºÆÃ VOID SendToMasterServers( BYTE* pMsg, WORD wSize ); SERVER_SESSION_CONTAINER_DELEGATOR GetConnectedServerList() { return ConnectedSessions; } template VOID ForEach_ConnectedSessions( _FN _funcRaw, const _ObjType& _Left ) { std::for_each( ConnectedSessions->begin(), ConnectedSessions->end(), std::bind1st(mem_fun(_funcRaw), _Left) ); } private: // // ÇöÀç ¿¬°áµÈ(ÀÎÁõµÈ) ¸¶½ºÅÍ ¼­¹öµé, ÀÎÁõ¿©ºÎ´Â ¼¼ºÎ ¼Ó¼ºÀ¸·Î ó¸® // ÇöÀç ¿¬°á ½ÃµµÁßÀÎ ¼­¹öµé, ÀÎÁõµÈ ¸¶½ºÅÍ ¼­¹öÀÎÁö È®ÀÎÇϰí À̸¦ À§ÇÑ º¸¾È 󸮰¡ ¼öÇàµÉ °ÍÀÌ´Ù. SERVER_SESSION_MAP_DELEGATOR AcceptedSessions; //MasterServerSession SERVER_SESSION_CONTAINER_DELEGATOR ConnectedSessions; //MasterServerSession+TempServerSession; // SERVER_SESSION_DELEGATOR m_EmptySession; private: VOID _Initialize(); // for foreach VOID _UpdateSession( SERVER_SESSION_PAIR node ); VOID _DeleteSession( SERVER_SESSION_PAIR node ); }; #endif // __SERVER_SESSION_MANAGER_H__