Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
LargeMemoryWriter.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/UnrealString.h"
6#include "CoreTypes.h"
7#include "Memory/MemoryFwd.h"
8#include "Memory/MemoryView.h"
9#include "Serialization/LargeMemoryData.h"
10#include "Serialization/MemoryArchive.h"
11#include "UObject/NameTypes.h"
12
13/**
14* Archive for storing a large amount of arbitrary data to memory
15*/
17{
18public:
19
20 FLargeMemoryWriter(const int64 PreAllocateBytes = 0, bool bIsPersistent = false, const TCHAR* InFilename = nullptr);
21
22 virtual void Serialize(void* InData, int64 Num) override;
23
24 /**
25 * Returns the name of the Archive. Useful for getting the name of the package a struct or object
26 * is in when a loading error occurs.
27 *
28 * This is overridden for the specific Archive Types
29 **/
30 virtual FString GetArchiveName() const override;
31
32 /**
33 * Gets the total size of the data written
34 */
35 virtual int64 TotalSize() override
36 {
37 return Data.GetSize();
38 }
39
40 /**
41 * Returns the written data. To release this archive's ownership of the data, call ReleaseOwnership()
42 */
43 uint8* GetData() const;
44
45 /**
46 * Returns a view on the written data
47 *
48 * The view does not own the memory, so you must make sure you keep the memory writer
49 * alive while you are using the returned view.
50 *
51 */
52 inline FMemoryView GetView() const { return MakeMemoryView(GetData(), Data.GetSize()); }
53
54 /**
55 * Releases ownership of the written data
56 *
57 * Also returns the pointer, so that the caller only needs to call this function to take control
58 * of the memory.
59 */
61 {
63 }
64
65 /**
66 * Reserves memory such that the writer can contain at least Size number of bytes.
67 */
68 void Reserve(int64 Size)
69 {
71 }
72
73private:
74
76
77 /** Non-copyable */
80
81
82 /** Archive name, used for debugging, by default set to NAME_None. */
84};
#define FORCEINLINE
Definition Platform.h:644
void Reserve(int64 Size)
uint8 * ReleaseOwnership()
FORCEINLINE int64 GetSize() const
FORCEINLINE uint8 * ReleaseOwnership()
uint8 * GetData() const
void Reserve(int64 Size)
virtual int64 TotalSize() override
FLargeMemoryWriter & operator=(const FLargeMemoryWriter &)=delete
FLargeMemoryWriter(const FLargeMemoryWriter &)=delete
FLargeMemoryWriter(const int64 PreAllocateBytes=0, bool bIsPersistent=false, const TCHAR *InFilename=nullptr)
virtual void Serialize(void *InData, int64 Num) override
FLargeMemoryData Data
FMemoryView GetView() const
virtual FString GetArchiveName() const override
const FString ArchiveName