OpenBarnyard
 
Loading...
Searching...
No Matches
T2NamedPipeServer_Win.h
Go to the documentation of this file.
1#pragma once
2#include "Toshi/Defines.h"
3#include "TThread_Win.h"
4
5#include <Windows.h>
6
8
9class T2NamedPipeServer;
10
12{
13public:
15
16 virtual void Main() override;
17
18private:
19 T2NamedPipeServer* m_pServer;
20};
21
22//-----------------------------------------------------------------------------
23// Use this class to establish communication between two different processes.
24// Note: Supports only one connection instance.
25//-----------------------------------------------------------------------------
27{
28public:
30
31 using UpdateStreamCallback_t = void ( * )( void*& a_rMemoryStream, TUINT& a_rDataSize, void* a_pUserData );
32
33public:
36
37 TBOOL Start( const TCHAR* a_szName, TUINT a_uiSendInterval, TUINT a_uiOutBufferSize = 1, TUINT a_uiInBufferSize = 64 * 1024 );
38
39 void Stop();
40
42 void SetMemoryStream( void* a_pMemory, TUINT a_uiSize );
43
44 void SetUserData( void* a_pUserData ) { m_pUserData = a_pUserData; }
45
46 TBOOL HasConnectedClient() const { return m_bHasClient; }
47
48private:
49 T2NamedPipeServerThread* m_pThread;
50 void* m_pUserData;
51 const TCHAR* m_szName;
52 UpdateStreamCallback_t m_fnUpdateStream;
53 TUINT m_uiSendInterval;
54 void* m_pMemory;
55 TUINT m_uiMemorySize;
56 HANDLE m_hPipe;
57 TBOOL m_bHasClient;
58 TBOOL m_bStarted;
59};
60
#define TOSHI_NAMESPACE_START
Definition Defines.h:47
#define TOSHI_NAMESPACE_END
Definition Defines.h:50
unsigned int TUINT
Definition Typedefs.h:8
char TCHAR
Definition Typedefs.h:20
bool TBOOL
Definition Typedefs.h:6
T2NamedPipeServerThread(T2NamedPipeServer *a_pServer)
void SetMemoryStream(void *a_pMemory, TUINT a_uiSize)
void SetMemoryStreamUpdateCallback(UpdateStreamCallback_t a_fnUpdateCallback)
void(*)(void *&a_rMemoryStream, TUINT &a_rDataSize, void *a_pUserData) UpdateStreamCallback_t
void SetUserData(void *a_pUserData)
TBOOL Start(const TCHAR *a_szName, TUINT a_uiSendInterval, TUINT a_uiOutBufferSize=1, TUINT a_uiInBufferSize=64 *1024)