#pragma once #ifndef NETWORK_MODULE_STDAFX_H #define NETWORK_MODULE_STDAFX_H //================================================================================================== #define WIN32_LEAN_AND_MEAN #ifndef _WIN32_WINNT # define _WIN32_WINNT 0x0501 #endif #ifndef WINVER # define WINVER 0x0501 #endif //================================================================================================== // ¸ðµç ÇÁ·ÎÁ§Æ® ¹× °øÀ¯ Æú´õ À§Ä¡°¡ °íÁ¤À̶ó´Â ÀüÁ¦ÇÏ¿¡ ¼³Á¤µÇ´Â »ó´ë À§Ä¡¸¦ ÅëÇÑ Include #include "../../include/Global.Define.h" //================================================================================================== // // <__WAVERIX_071217_NETWORK_REFACTORING__> // - Fault Control °è¿­À» Áß½ÉÀ¸·Î ÀÌ¿Í °ü·ÃµÈ ·ÎÁ÷µé Àü¸é °ËÁõ ¹× À籸¼º // - Control Mechanism - Assert Logic based control // - ´õ ÀÌ»ó »ç¿ëµÇÁö ¾Ê´Â ·ÎÁ÷ Á¦°Å //#define __WAVERIX_071217_NETWORK_REFACTORING__ #define WHATTHEHELL_NETWORK_20060519 //#define __SUSUNLOVE_REMOVE_ONLOGSTRING_APPLY_20080110 // Remove()½Ã ·Î±× ³²±â±â _DEBUG Á¦°Å //================================================================================================== // #include #include #include #include #include #include #include "./WxRingBuffer.h" #pragma warning(push, 4) //================================================================================================== // #include "NetworkDefine.h" #include "NetBase.h" //#include "RingBufferEx.h" // export to compatible an usage //using module::RingBufferEx; //using module::CCriticalSection; //using module::CSyncCriticalSection; // //================================================================================================== // IOCP #pragma comment(lib, "ws2_32.lib") #if !defined(SAFE_DELETE) #define SAFE_DELETE(ptr) \ ;{ if (ptr) { \ delete (ptr); \ (ptr) = NULL; \ } \ }; #endif // #if !defined(__UNUSED) #define __UNUSED(vars) vars #endif // inter memory utility to support a seperated alloc/dealloc namespace module { ; template struct base_type_info { typedef _Type value_type; typedef value_type* pointer; typedef value_type* const pointer_r; typedef const value_type* const_pointer; typedef value_type& reference; }; template struct TAllocator : base_type_info<_Type> { typedef TAllocator allocator_type; static pointer Allocate() { void* ptr = ::malloc(sizeof(value_type)); return new (ptr) value_type(); } template static void DeAllocate(_DerivedType* ptr) { // compile-time check routine static_cast<_DerivedType*>(reinterpret_cast(1)); ptr->~_DrivedType(); ::free(ptr); } static void DeAllocate(pointer ptr) { ptr->_Type::~_Type(); ::free(ptr); } }; template class RedirectedAllocator { typedef RedirectedAllocator allocator_local_type; typedef T node_type; public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef T* pointer; typedef const T* const_pointer; typedef T& reference; typedef const T& const_reference; typedef T value_type; template struct rebind { typedef RedirectedAllocator other; }; pointer address(reference x) const { return &x; } const_pointer address(const_reference x) const { return &x; } RedirectedAllocator() { } template RedirectedAllocator(const RedirectedAllocator&) { } allocator_local_type& operator=(const allocator_local_type&) { return *this; } pointer allocate(size_type n, const void* hint = 0) { __UNUSED(hint); return reinterpret_cast(::malloc(sizeof(T) * n)); } void deallocate(void* p, size_type n) { __UNUSED(n); ::free(p); } void construct(pointer p, const T& val) { new ((void *)p) T(val); } void destroy(pointer p) { p->T::~T(); } size_type max_size() const { size_type n = (size_type)(-1) / sizeof(node_type); return (0 < n ? n : 1); } bool operator == (const allocator_local_type& r) const { return this == &r; } bool operator != (const allocator_local_type& r) const { return this != &r; } bool operator < (const allocator_local_type&) const; bool operator > (const allocator_local_type&) const; private: }; }; //end of namespace #endif //NETWORK_MODULE_STDAFX_H