3#include <Foundation/Basics.h>
4#include <Foundation/Communication/RemoteInterface.h>
5#include <Foundation/Threading/ThreadSignal.h>
6#include <Foundation/Types/UniquePtr.h>
26 , m_pChannel(pChannel)
30 Type m_Type = NewMessages;
48 using StorageType = plUInt8;
59 using StorageType = plUInt8;
65 Default = Disconnected
84 bool IsConnected()
const {
return m_iConnectionState == ConnectionState::Connected; }
92 void SetReceiveCallback(ReceiveCallback callback);
121 void FlushPendingOperations();
128 MAGIC_VALUE =
'USED',
129 MAX_MESSAGE_SIZE = 1024 * 1024 * 16,
133 plThreadID m_ThreadId = 0;
150 plMutex m_ReceiveCallbackMutex;
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
Integer class that can be manipulated in an atomic (i.e. thread-safe) fashion.
Definition AtomicInteger.h:39
Definition DynamicArray.h:81
Base class for a communication channel between processes.
Definition IpcChannel.h:44
bool IsConnected() const
Returns whether we have a connection.
Definition IpcChannel.h:84
plDynamicArray< plUInt8 > m_MessageAccumulator
Message is assembled in here.
Definition IpcChannel.h:147
plEnum< ConnectionState > GetConnectionState() const
Returns the current state of the connection.
Definition IpcChannel.h:86
virtual bool RequiresRegularTick()
Override this and return true, if the surrounding infrastructure should call the 'Tick()' function.
Definition IpcChannel.h:104
plEvent< const plIpcChannelEvent &, plMutex > m_Events
Will be sent from any thread.
Definition IpcChannel.h:98
virtual void InternalConnect()=0
Called on worker thread after Connect was called.
virtual void InternalDisconnect()=0
Called on worker thread after Disconnect was called.
virtual void Tick()
Can implement regular updates, e.g. for polling network state.
Definition IpcChannel.h:106
Constants
Definition IpcChannel.h:126
virtual bool NeedWakeup() const =0
Called by Send to determine whether the message loop need to be woken up.
virtual void InternalSend()=0
Called on worker thread to sent pending messages.
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
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
Waiting on a thread signal puts the waiting thread to sleep. Other threads can wake it up by raising ...
Definition ThreadSignal.h:19
A generic delegate class which supports static functions and member functions.
Definition Delegate.h:76
A custom enum implementation that allows to define the underlying storage type to control its memory ...
Definition Enum.h:37
Definition Allocator_inl.h:18
Definition IpcChannel.h:58
Enum
Definition IpcChannel.h:61
@ Connecting
In case of the server, this state indicates that the server is ready to be connected to.
Definition IpcChannel.h:63
Definition IpcChannel.h:47
Event data for plIpcChannel::m_Events.
Definition IpcChannel.h:13
Type
Definition IpcChannel.h:15
@ NewMessages
Sent when a new messages have been received or when disconnected to wake up any thread waiting for me...
Definition IpcChannel.h:19
@ Disconnected
Server or client are in a dorment state.
Definition IpcChannel.h:16
@ Connected
Client and server are connected to each other.
Definition IpcChannel.h:18
@ Connecting
The server is listening for clients or the client is trying to find the server.
Definition IpcChannel.h:17
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