Plasma Engine  2.0
Loading...
Searching...
No Matches
IpcProcessMessageProtocol.h
1#pragma once
2
3#include <Foundation/Basics.h>
4#include <Foundation/Communication/RemoteInterface.h>
5#include <Foundation/Communication/RemoteMessage.h>
6#include <Foundation/Types/UniquePtr.h>
7
8class plIpcChannel;
9class plMessageLoop;
10
11
17class PL_FOUNDATION_DLL plIpcProcessMessageProtocol
18{
19public:
22
24 bool Send(plProcessMessage* pMsg);
25
26
28 bool ProcessMessages();
30 plResult WaitForMessages(plTime timeout = plTime::MakeZero());
31
32public:
34
35private:
36 void EnqueueMessage(plUniquePtr<plProcessMessage>&& msg);
37 void SwapWorkQueue(plDeque<plUniquePtr<plProcessMessage>>& messages);
38 void ReceiveMessageData(plArrayPtr<const plUInt8> data);
39
40private:
41 plIpcChannel* m_pChannel = nullptr;
42
43 plMutex m_IncomingQueueMutex;
45};
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
Definition Deque.h:270
Definition Event.h:177
Base class for a communication channel between processes.
Definition IpcChannel.h:44
A protocol around plIpcChannel to send reflected messages instead of byte array messages between clie...
Definition IpcProcessMessageProtocol.h:18
plEvent< const plProcessMessage * > m_MessageEvent
Will be sent from thread calling ProcessMessages or WaitForMessages.
Definition IpcProcessMessageProtocol.h:33
Internal sub-system used by plIpcChannel.
Definition MessageLoop.h:20
Provides a simple mechanism for mutual exclusion to prevent multiple threads from accessing a shared ...
Definition Mutex.h:13
Base class for IPC messages transmitted by plIpcChannel.
Definition RemoteMessage.h:64
A Unique ptr manages an object and destroys that object when it goes out of scope....
Definition UniquePtr.h:10
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12
PL_ALWAYS_INLINE static constexpr plTime MakeZero()
Creates an instance of plTime that was initialized with zero.
Definition Time.h:42