├── BaseLayer ├── BaseCommonHeader.h ├── BaseLayer.vcxproj ├── BaseLayer.vcxproj.filters ├── BaseLayer.vcxproj.user ├── BaseLayerLinux.vcxproj ├── BaseLayerLinux.vcxproj.filters ├── BaseLayerLinux.vcxproj.user ├── BigNum.h ├── BitSet.cpp ├── BitSet.h ├── CGSFDefine.h ├── CMakeLists.txt ├── CStdString.h ├── ConcurrentQueue.h ├── GPGLockFreeQueue.h ├── Macro.h ├── Markup.cpp ├── Markup.h ├── ReadMe.txt ├── SFBitArray.cpp ├── SFBitArray.h ├── SFCompressZLib.cpp ├── SFCompressZLib.h ├── SFCompressor.h ├── SFConsumer.h ├── SFDispatch.h ├── SFEncryption.h ├── SFEncryptionXOR.cpp ├── SFEncryptionXOR.h ├── SFFString.cpp ├── SFFString.h ├── SFFastCRC.cpp ├── SFFastCRC.h ├── SFIOCPQueue.h ├── SFList.cpp ├── SFList.h ├── SFLock.h ├── SFLockDeque.h ├── SFLockQueue.h ├── SFMath.h ├── SFObjectPool.h ├── SFQueue.h ├── SFRegexChecker.cpp ├── SFRegexChecker.h ├── SFScheduler.h ├── SFString.h ├── SFTSSyncQueue.h ├── SFTimer.h ├── SFTree.h ├── VMemPool.h ├── base64.cpp ├── base64.h ├── crc.cpp ├── crc.h ├── fast_mutex.h ├── md5.cpp ├── md5.h ├── tinythread.cpp └── tinythread.h ├── Bin ├── Debug │ ├── ACEd.dll │ ├── EngineConfig.xml │ ├── ServerConnection.xml │ └── libglog.dll └── Release │ ├── ACE.dll │ ├── EngineConfig.xml │ ├── ServerConnection.xml │ ├── boost_chrono-vc140-mt-1_60.dll │ ├── boost_system-vc140-mt-1_60.dll │ ├── boost_thread-vc140-mt-1_60.dll │ └── libglog.dll ├── CGSFII.sln ├── CGSFII_WithNetwork.sln ├── CGSFLinux.sln ├── CGSFNet ├── ACEEngine.cpp ├── ACEEngine.h ├── ACEHeader.h ├── ACETimeOutHandler.h ├── BasePacket.h ├── CGSFNet.vcxproj ├── CGSFNet.vcxproj.filters ├── CGSFNetLinux.vcxproj ├── CommonStructure.h ├── EngineConstant.h ├── EngineStructure.h ├── ErrorCode.h ├── GamePacketStructure.h ├── IDMap.h ├── IEngine.h ├── INetworkCallback.h ├── INetworkEngine.h ├── IPacketProtocol.h ├── IServerCallback.h ├── ISession.h ├── ISessionService.h ├── InterlockedValue.cpp ├── InterlockedValue.h ├── Lock.h ├── PeerInfo.h ├── ProactorAcceptor.cpp ├── ProactorAcceptor.h ├── ProactorService.cpp ├── ProactorService.h ├── Queue.h ├── ReactorAcceptor.h ├── ReactorService.cpp ├── ReactorService.h ├── SFMessage.h ├── ServiceManager.h ├── WorkerThread.cpp └── WorkerThread.h ├── DatabaseLayer ├── CppSQLite3.cpp ├── CppSQLite3.h ├── DBMsg.h ├── DBStruct.h ├── DatabaseLayer.vcxproj ├── DatabaseLayer.vcxproj.filters ├── IDBManager.h ├── ReadMe.txt ├── SFDBAdaptor.cpp ├── SFDBAdaptor.h ├── SFDBManager.cpp ├── SFDBManager.h ├── SFDBPacketSystem.h ├── SFDBRequest.cpp ├── SFDBRequest.h ├── SFDBWorker.cpp ├── SFDBWorker.h ├── SFDataBaseProxy.h ├── SFDatabase.cpp ├── SFDatabase.h ├── SFDatabaseProxyImpl.h ├── SFDatabaseProxyLocal.h ├── SFDatabaseProxyRemote.h ├── SFDatabaseSQLite.cpp ├── SFDatabaseSQLite.h ├── SFFastDBAdaptor.cpp ├── SFFastDBAdaptor.h ├── SFMSSQL.cpp ├── SFMSSQL.h ├── SFMSSQLAdaptor.cpp ├── SFMSSQLAdaptor.h ├── SFZdb.cpp ├── SFZdb.h ├── SFZdbAdpator.cpp ├── SFZdbAdpator.h ├── stdafx.cpp ├── stdafx.h └── targetver.h ├── DotCGSF ├── CGSFNET64Common │ ├── CGSFNETCommon.csproj │ ├── CGSFNETCommon.sln │ ├── ClientSimpleTcp.cs │ ├── DevLog.cs │ ├── FileLogger.cs │ ├── JsonEnDecode.cs │ ├── NLog.config │ ├── NLog.xsd │ ├── PacketBufferManager.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── app.config │ └── packages.config ├── CGSFNET64Lib │ ├── 3DESEncrypt.h │ ├── AESEncrypt.h │ ├── AssemblyInfo.cpp │ ├── CgsfNET64.cpp │ ├── CgsfNET64.h │ ├── CgsfNET64Lib.filters │ ├── CgsfNET64Lib.sln │ ├── CgsfNET64Lib.vcxproj │ ├── CgsfNET64Lib.vcxproj.filters │ ├── CgsfNET64Lib.vcxproj.user │ ├── Compress.h │ ├── ConcurrencyPacketQueue.h │ ├── DESEncrypt.h │ ├── DefineValue.h │ ├── FRAMEWORK_ERROR_CODE.h │ ├── Helper.h │ ├── SFNETDispatcher.cpp │ ├── SFNETDispatcher.h │ ├── SFNETMultiDispatcher.cpp │ ├── SFNETMultiDispatcher.h │ ├── SFNETPacket.h │ ├── ServerConnectReceiveCallback.h │ ├── ServerLogicEntry.h │ ├── Stdafx.cpp │ ├── Stdafx.h │ ├── app.ico │ ├── app.rc │ └── resource.h └── EchoServerNet │ ├── App.config │ ├── EchoServerNet.csproj │ ├── EchoServerNet.csproj.user │ ├── EchoServerNet.sln │ ├── Form1.Designer.cs │ ├── Form1.cs │ ├── Form1.resx │ ├── Program.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ └── ServerNetwork.cs ├── EngineLayer ├── CommonHeader.h ├── DataBuffer.cpp ├── DataBuffer.h ├── DataTypeConvertor.h ├── EngineLayer.vcxproj ├── EngineLayer.vcxproj.filters ├── EngineLayer.vcxproj.user ├── EngineLayerHeader.h ├── EngineLayerLinux.vcxproj ├── EngineLayerLinux.vcxproj.filters ├── EngineLayerLinux.vcxproj.user ├── GPGLockFree.h ├── ILogicDispatcher.h ├── ILogicEntry.cpp ├── ILogicEntry.h ├── INetworkFramework.h ├── JsonBuilder.cpp ├── JsonBuilder.h ├── JsonNode.cpp ├── JsonNode.h ├── LogicEntry.cpp ├── LogicEntry.h ├── ReadMe.txt ├── SFACEAllocator.h ├── SFBasePacketProtocol.cpp ├── SFBasePacketProtocol.h ├── SFCGSFPacketProtocol.cpp ├── SFCGSFPacketProtocol.h ├── SFCheckSum.cpp ├── SFCheckSum.h ├── SFClassicDispatcher.cpp ├── SFClassicDispatcher.h ├── SFConfigure.cpp ├── SFConfigure.h ├── SFConstant.h ├── SFEngine.cpp ├── SFEngine.h ├── SFExcel.cpp ├── SFExcel.h ├── SFFactory.h ├── SFIOBuffer.cpp ├── SFIOBuffer.h ├── SFIOCPFramework.cpp ├── SFIOCPFramework.h ├── SFIni.cpp ├── SFIni.h ├── SFJsonPacket.cpp ├── SFJsonPacket.h ├── SFJsonProtocol.cpp ├── SFJsonProtocol.h ├── SFLogicDispatcher.cpp ├── SFLogicDispatcher.h ├── SFLogicGateway.cpp ├── SFLogicGateway.h ├── SFMGClient.cpp ├── SFMacro.h ├── SFMultiLogicDispatcher.cpp ├── SFMultiLogicDispatcher.h ├── SFObject.cpp ├── SFObject.h ├── SFObserver.cpp ├── SFObserver.h ├── SFPacket.cpp ├── SFPacket.h ├── SFPacketIOBuffer.cpp ├── SFPacketIOBuffer.h ├── SFPacketPool.cpp ├── SFPacketPool.h ├── SFPacketProtocol.cpp ├── SFPacketProtocol.h ├── SFPacketProtocolManager.cpp ├── SFPacketProtocolManager.h ├── SFProducer.h ├── SFProtobuf2ExtensionProtocol.cpp ├── SFProtobuf2ExtensionProtocol.h ├── SFProtobufExtensionProtocol.cpp ├── SFProtobufExtensionProtocol.h ├── SFProtobufPacket.cpp ├── SFProtobufPacket.h ├── SFProtobufPacketImpl.cpp ├── SFProtobufPacketImpl.h ├── SFProtobufProtocol.cpp ├── SFProtobufProtocol.h ├── SFProtocol.cpp ├── SFProtocol.h ├── SFServerConnectionManager.cpp ├── SFServerConnectionManager.h ├── SFSessionService.cpp ├── SFSessionService.h ├── SFShouter.cpp ├── SFShouter.h ├── SFSingleLogicDispatcher.cpp ├── SFSingleLogicDispatcher.h ├── SFStructure.h ├── SFSubject.cpp ├── SFSubject.h ├── elements.h ├── elements.inl ├── reader.h ├── reader.inl ├── stdafx.cpp ├── stdafx.h ├── targetver.h ├── visitor.h ├── writer.h └── writer.inl ├── README.md └── Sample ├── Common ├── SampleMessage.proto ├── Tank.proto ├── TankMessage.proto ├── Tank_csgen.bat ├── protobuf-net r668 │ ├── CoreOnly │ │ ├── cf20 │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ │ ├── cf35 │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ │ ├── ios │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ │ ├── mono │ │ │ ├── protobuf-net.dll │ │ │ └── protobuf-net.xml │ │ ├── net11 │ │ │ └── protobuf-net.dll │ │ ├── net30 │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ │ ├── netcore45 │ │ │ ├── protobuf-net.XML │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.pri │ │ ├── portable │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ │ ├── sl4 │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ │ ├── wp71 │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ │ └── wp8 │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ ├── Full │ │ ├── cf20 │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ │ ├── cf35 │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ │ ├── mono │ │ │ ├── protobuf-net.dll │ │ │ └── protobuf-net.xml │ │ ├── net11 │ │ │ └── protobuf-net.dll │ │ ├── net20 │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ │ ├── net30 │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ │ ├── netcore45 │ │ │ ├── protobuf-net.XML │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.pri │ │ ├── portable │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ │ ├── sl4 │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ │ ├── unity │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ │ ├── wp71 │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ │ └── wp8 │ │ │ ├── protobuf-net.dll │ │ │ ├── protobuf-net.pdb │ │ │ └── protobuf-net.xml │ ├── Licence.txt │ ├── Precompile │ │ ├── IKVM-LICENSE │ │ ├── IKVM.Reflection.dll │ │ ├── Licence.txt │ │ ├── precompile.XML │ │ ├── precompile.exe │ │ ├── precompile.pdb │ │ ├── protobuf-net.dll │ │ ├── protobuf-net.pdb │ │ └── protobuf-net.xml │ ├── ProtoGen │ │ ├── Licence.txt │ │ ├── common.xslt │ │ ├── csharp.xslt │ │ ├── descriptor.proto │ │ ├── protobuf-net.dll │ │ ├── protobuf-net.pdb │ │ ├── protobuf-net.xml │ │ ├── protoc-license.txt │ │ ├── protogen.exe │ │ ├── protogen.exe.config │ │ ├── protogen.pdb │ │ ├── vb.xslt │ │ └── xml.xslt │ └── What Files Do I Need.txt ├── protobuf_cppgen.bat ├── protobuf_csgen.bat ├── protoc.exe └── tank_cppgen.bat ├── EchoServer ├── EchoLogicEntry.cpp ├── EchoLogicEntry.h ├── EchoServer.cpp ├── EchoServer.vcxproj ├── EchoServer.vcxproj.filters ├── EchoServer.vcxproj.user ├── EchoServerHeader.h ├── EchoServreLinux.vcxproj ├── EchoServreLinux.vcxproj.user ├── ReadMe.txt └── targetver.h ├── ProtoBufServer ├── ProtoBufLogicEntry.cpp ├── ProtoBufLogicEntry.h ├── ProtoBufProtocol.cpp ├── ProtoBufProtocol.h ├── ProtoBufServer.cpp ├── ProtoBufServer.vcxproj ├── ProtoBufServer.vcxproj.user ├── ReadMe.txt ├── SampleMessage.pb.cc ├── SampleMessage.pb.h ├── TankServer.vcxproj.filters ├── TankServer.vcxproj.user ├── stdafx.cpp ├── stdafx.h └── targetver.h ├── ProtobufUnity ├── Assets │ ├── ProtoBuf.meta │ ├── ProtoBuf │ │ ├── protobuf-net.dll │ │ ├── protobuf-net.dll.mdb │ │ ├── protobuf-net.dll.mdb.meta │ │ ├── protobuf-net.dll.meta │ │ ├── protobuf-net.pdb │ │ ├── protobuf-net.pdb.meta │ │ ├── protobuf-net.xml │ │ └── protobuf-net.xml.meta │ ├── Scene.meta │ ├── Scene │ │ ├── CGSFClient.unity │ │ └── CGSFClient.unity.meta │ ├── Scripts.meta │ └── Scripts │ │ ├── Common.meta │ │ ├── Common │ │ ├── Singleton.cs │ │ └── Singleton.cs.meta │ │ ├── Network.meta │ │ ├── Network │ │ ├── CGSFNetProtocol.cs │ │ ├── CGSFNetProtocol.cs.meta │ │ ├── INetworkInterface.cs │ │ ├── INetworkInterface.cs.meta │ │ ├── NetworkController.cs │ │ ├── NetworkController.cs.meta │ │ ├── SampleMessage.cs │ │ ├── SampleMessage.cs.meta │ │ ├── TCPNetwork.cs │ │ ├── TCPNetwork.cs.meta │ │ ├── UDP.cs │ │ └── UDP.cs.meta │ │ ├── UIRoot.cs │ │ └── UIRoot.cs.meta ├── CGSFUnity.CSharp.csproj ├── CGSFUnity.sln ├── ProjectSettings │ ├── AudioManager.asset │ ├── ClusterInputManager.asset │ ├── DynamicsManager.asset │ ├── EditorBuildSettings.asset │ ├── EditorSettings.asset │ ├── GraphicsSettings.asset │ ├── InputManager.asset │ ├── NavMeshAreas.asset │ ├── NetworkManager.asset │ ├── Physics2DSettings.asset │ ├── ProjectSettings.asset │ ├── ProjectVersion.txt │ ├── QualitySettings.asset │ ├── TagManager.asset │ ├── TimeManager.asset │ ├── UnityAdsSettings.asset │ └── UnityConnectSettings.asset ├── ProtobufUnity.CSharp.csproj └── ProtobufUnity.sln ├── Sample.sln ├── ServerConnector ├── AuthServerCallback.cpp ├── AuthServerCallback.h ├── DatabaseServerCallback.cpp ├── DatabaseServerCallback.h ├── ReadMe.txt ├── ServerConnector.cpp ├── ServerConnector.vcxproj ├── ServerConnector.vcxproj.filters ├── ServerConnectorLogicEntry.cpp ├── ServerConnectorLogicEntry.h ├── stdafx.cpp ├── stdafx.h └── targetver.h ├── ServerListener ├── ReadMe.txt ├── ServerListener.cpp ├── ServerListener.vcxproj ├── ServerListener.vcxproj.filters ├── ServerListener.vcxproj.user ├── ServerListenerLogicEntry.cpp ├── ServerListenerLogicEntry.h ├── stdafx.cpp ├── stdafx.h └── targetver.h └── TankServer ├── ReadMe.txt ├── Tank.pb.cc ├── Tank.pb.h ├── TankLogicEntry.cpp ├── TankLogicEntry.h ├── TankProtocol.cpp ├── TankProtocol.h ├── TankServer.cpp ├── TankServer.vcxproj ├── TankServer.vcxproj.filters ├── TankServer.vcxproj.user ├── stdafx.cpp ├── stdafx.h └── targetver.h /BaseLayer/BaseCommonHeader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 3 | 4 | 5 | 6 | // TODO: reference additional headers your program requires here 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "Macro.h" -------------------------------------------------------------------------------- /BaseLayer/BaseLayer.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /BaseLayer/BaseLayerLinux.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | export DISPLAY=:0.0 5 | LinuxDebugger 6 | 7 | -------------------------------------------------------------------------------- /BaseLayer/BitSet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _WIN32 3 | #include "CGSFDefine.h" 4 | #else 5 | #include 6 | #endif 7 | 8 | class CBitSet 9 | { 10 | BOOL m_bAutoDelete; // Is will be deleted? 11 | char* m_pBitSet; // Bitset raw memory pointer 12 | DWORD m_dwUsedBytes; // Used bytes. 13 | public: 14 | 15 | CBitSet(); 16 | virtual ~CBitSet(); 17 | 18 | inline static DWORD sCalcUsedBytes( DWORD dwBits, BOOL b32BitAlign = TRUE ) 19 | { 20 | DWORD dwUsedBytes = dwBits>>3; 21 | if( dwBits%8 ) dwUsedBytes++; 22 | 23 | if( b32BitAlign ) 24 | { 25 | // if os is 64 bit , then maybe change code little. 26 | dwUsedBytes += (4 - (dwUsedBytes&3) ); 27 | 28 | } 29 | return dwUsedBytes; 30 | } 31 | 32 | BOOL Create( DWORD dwBits, BOOL bZeroInit, BOOL b32BitAlign = TRUE, char* pszSource = NULL, DWORD dwSourceLen = 0 ); 33 | 34 | const DWORD GetUsedBytes() const 35 | { 36 | return m_dwUsedBytes; 37 | } 38 | inline char Get( DWORD dwBit ) 39 | { 40 | return m_pBitSet[dwBit>>3] & 1<<(dwBit&7); 41 | } 42 | inline void Set( DWORD dwBit, char bit ) 43 | { 44 | bit?m_pBitSet[dwBit>>3]|=1<<(dwBit&7): 45 | m_pBitSet[dwBit>>3]&=~(1<<(dwBit&7)); 46 | } 47 | 48 | inline char operator [] (int nBit) 49 | { 50 | return Get( nBit ); 51 | } 52 | }; 53 | -------------------------------------------------------------------------------- /BaseLayer/CGSFDefine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef USHORT 4 | #define USHORT unsigned short 5 | #endif 6 | 7 | #ifndef DWORD 8 | #define DWORD unsigned int 9 | #endif 10 | 11 | #ifndef INT 12 | #define INT int 13 | #endif 14 | 15 | #ifndef BOOL 16 | #define BOOL bool 17 | #endif 18 | 19 | #ifndef TRUE 20 | #define TRUE true 21 | #endif 22 | 23 | #ifndef FALSE 24 | #define FALSE false 25 | #endif 26 | 27 | #ifndef NULL 28 | #define NULL nullptr 29 | #endif 30 | 31 | #ifndef BYTE 32 | #define BYTE unsigned char 33 | #endif 34 | 35 | #ifndef UINT32 36 | #define UINT32 unsigned int 37 | #endif 38 | 39 | #ifndef UINT 40 | #define UINT unsigned int 41 | #endif 42 | 43 | #ifndef CHAR 44 | #define CHAR char 45 | #endif 46 | 47 | #ifndef SHORT 48 | #define SHORT short 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /BaseLayer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | project(BaseLayer) 3 | 4 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 5 | 6 | add_library (BaseLayer SFBitArray.cpp SFBitArray.h) 7 | 8 | 9 | -------------------------------------------------------------------------------- /BaseLayer/ConcurrentQueue.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | template 7 | class Queue 8 | { 9 | public: 10 | 11 | T pop() 12 | { 13 | std::unique_lock mlock(mutex_); 14 | while (queue_.empty()) 15 | { 16 | cond_.wait(mlock); 17 | } 18 | auto item = queue_.front(); 19 | queue_.pop(); 20 | return item; 21 | } 22 | 23 | void pop(T& item) 24 | { 25 | std::unique_lock mlock(mutex_); 26 | while (queue_.empty()) 27 | { 28 | cond_.wait(mlock); 29 | } 30 | item = queue_.front(); 31 | queue_.pop(); 32 | } 33 | 34 | void push(const T& item) 35 | { 36 | std::unique_lock mlock(mutex_); 37 | queue_.push(item); 38 | mlock.unlock(); 39 | cond_.notify_one(); 40 | } 41 | 42 | void push(T&& item) 43 | { 44 | std::unique_lock mlock(mutex_); 45 | queue_.push(std::move(item)); 46 | mlock.unlock(); 47 | cond_.notify_one(); 48 | } 49 | 50 | private: 51 | std::queue queue_; 52 | std::mutex mutex_; 53 | std::condition_variable cond_; 54 | }; -------------------------------------------------------------------------------- /BaseLayer/Macro.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #define LOKI_WINDOWS_H 5 | 6 | #define SFASSERT(x) assert((x)) 7 | 8 | #ifndef TRACE 9 | #define TRACE 10 | #endif 11 | 12 | 13 | #ifndef ASSERT 14 | #define ASSERT(exp) SFASSERT(exp) 15 | #endif 16 | 17 | #ifndef ASSERT_VALID 18 | #define ASSERT_VALID(pOb) 19 | #endif 20 | 21 | #ifndef VERIFY 22 | #ifdef _DEBUG 23 | #define VERIFY(exp) SFASSERT(exp) 24 | #else 25 | #define VERIFY(exp) exp 26 | #endif 27 | #endif -------------------------------------------------------------------------------- /BaseLayer/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | STATIC LIBRARY : BaseLib Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this BaseLib library project for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your BaseLib application. 9 | 10 | 11 | BaseLib.vcproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | 18 | ///////////////////////////////////////////////////////////////////////////// 19 | 20 | StdAfx.h, StdAfx.cpp 21 | These files are used to build a precompiled header (PCH) file 22 | named BaseLib.pch and a precompiled types file named StdAfx.obj. 23 | 24 | ///////////////////////////////////////////////////////////////////////////// 25 | Other notes: 26 | 27 | AppWizard uses "TODO:" comments to indicate parts of the source code you 28 | should add to or customize. 29 | 30 | ///////////////////////////////////////////////////////////////////////////// 31 | -------------------------------------------------------------------------------- /BaseLayer/SFCompressZLib.cpp: -------------------------------------------------------------------------------- 1 | #include "../BaseLayer/SFCompressZLib.h" 2 | 3 | #ifdef _WIN32 4 | #include 5 | #else 6 | #include 7 | #endif 8 | 9 | SFCompressZLib::SFCompressZLib(void) 10 | { 11 | } 12 | 13 | SFCompressZLib::~SFCompressZLib(void) 14 | { 15 | } 16 | 17 | bool SFCompressZLib::Compress(char* pDest, int& destLen, unsigned char* pSrc, int srcLen) 18 | { 19 | int result = compress((unsigned char*)pDest,(uLongf*)&destLen, (const unsigned char*)pSrc, srcLen); 20 | 21 | return result >= 0; 22 | } 23 | 24 | bool SFCompressZLib::Uncompress(unsigned char* pDest, int& destLen, unsigned char* pSrc, int srcLen) 25 | { 26 | int result = uncompress((unsigned char*)pDest, (uLongf*)&destLen, (const unsigned char*)pSrc, srcLen); 27 | 28 | return result >= 0; 29 | } -------------------------------------------------------------------------------- /BaseLayer/SFCompressZLib.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class SFCompressZLib 4 | { 5 | public: 6 | SFCompressZLib(void); 7 | virtual ~SFCompressZLib(void); 8 | 9 | bool Compress(char* pDest, int& destLen, unsigned char* pSrc, int srcLen); 10 | bool Uncompress(unsigned char* pDest, int& destLen, unsigned char* pSrc, int srcLen); 11 | 12 | protected: 13 | 14 | private: 15 | }; 16 | -------------------------------------------------------------------------------- /BaseLayer/SFCompressor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | template 4 | class SFCompressor 5 | { 6 | public: 7 | SFCompressor(void){} 8 | virtual ~SFCompressor(void){} 9 | 10 | static T* GetCompressor(){return &m_Compress;} 11 | 12 | protected: 13 | 14 | private: 15 | static T m_Compress; 16 | }; 17 | 18 | template 19 | T SFCompressor::m_Compress; 20 | 21 | -------------------------------------------------------------------------------- /BaseLayer/SFConsumer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef ACE_Atomic_Op SafeInt; 4 | 5 |