Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
GenericPlatformNamedPipe.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/ContainersFwd.h"
6#include "CoreTypes.h"
7
9
10/**
11 * Wrapper for platform named pipe communication.
12 */
13class FGenericPlatformNamedPipe
14{
15public:
16
17 /** Default constructor. */
18 FGenericPlatformNamedPipe();
19
20 /** Virtual destructor. */
21 virtual ~FGenericPlatformNamedPipe();
22
23 FGenericPlatformNamedPipe(const FGenericPlatformNamedPipe&) = delete;
24 FGenericPlatformNamedPipe& operator=(const FGenericPlatformNamedPipe&) = delete;
25
26public:
27
28 /** Create a named pipe as a server or client, using overlapped IO if bAsync=1. */
29 virtual bool Create(const FString& PipeName, bool bServer, bool bAsync) { return false; }
30
31 /** Get the pipe name used on Create(). */
32 virtual const FString& GetName() const
33 {
34 return *NamePtr;
35 }
36
37 /** Destroy the pipe. */
38 virtual bool Destroy() { return false; }
39
40 /** Open a connection from a client. */
41 virtual bool OpenConnection() { return false; }
42
43 /** Block if there's an IO operation in progress until it's done or errors out. */
44 virtual bool BlockForAsyncIO() { return false; }
45
46 /** Let the user know if the pipe is ready to send or receive data. */
47 virtual bool IsReadyForRW() const { return false; }
48
49 /** Update status of async state of the current pipe. */
50 virtual bool UpdateAsyncStatus() { return false; }
51
52 /** Write a buffer out. */
53 virtual bool WriteBytes(int32 NumBytes, const void* Data) { return false; }
54
55 /** Write a single int32. */
56 inline bool WriteInt32(int32 In)
57 {
58 return WriteBytes(sizeof(int32), &In);
59 }
60
61 /* Read a buffer in. */
62 virtual bool ReadBytes(int32 NumBytes, void* OutData) { return false; }
63
64 /** Read a single int32. */
65 inline bool ReadInt32(int32& Out)
66 {
67 return ReadBytes(sizeof(int32), &Out);
68 }
69
70 /** Returns true if the pipe has been created and hasn't been destroyed. */
71 virtual bool IsCreated() const { return false; }
72
73 /** Return true if the pipe has had any communication error. */
74 virtual bool HasFailed() const { return true; }
75
76protected:
77
78 FString* NamePtr;
79};
80
81
82#endif
#define PLATFORM_SUPPORTS_NAMED_PIPES
Definition Platform.h:405