Main Page Class List Class Members

NvBlastExtSerialization.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
27
28
29 #pragma once
30
31 #include "NvBlastGlobals.h"
32
33
34 namespace Nv
35 {
36 namespace Blast
37 {
38
42 class ExtSerialization
43 {
44 public:
46 struct EncodingID
47 {
48 enum Enum
49 {
50 CapnProtoBinary = NVBLAST_FOURCC('C', 'P', 'N', 'B'),
51 RawBinary = NVBLAST_FOURCC('R', 'A', 'W', ' '),
52 };
53 };
54
56 class BufferProvider
57 {
58 public:
59 virtual void* requestBuffer(size_t size) = 0;
60 };
61
67 virtual bool setSerializationEncoding(uint32_t encodingID) = 0;
68
75 virtual uint32_t getSerializationEncoding() const = 0;
76
84 virtual void setBufferProvider(BufferProvider* bufferProvider) = 0;
85
96 virtual bool peekHeader(uint32_t* objectTypeID, uint32_t* encodingID, uint64_t* dataSize, const void* buffer, uint64_t bufferSize) = 0;
97
106 virtual const void* skipObject(uint64_t& bufferSize, const void* buffer) = 0;
107
118 virtual void* deserializeFromBuffer(const void* buffer, uint64_t bufferSize, uint32_t* objectTypeIDPtr = nullptr) = 0;
119
129 virtual uint64_t serializeIntoBuffer(void*& buffer, const void* object, uint32_t objectTypeID) = 0;
130
134 virtual void release() = 0;
135
136 protected:
140 virtual ~ExtSerialization() {}
141 };
142
143 } // namespace Blast
144 } // namespace Nv
145
146
148
156 NVBLAST_API Nv::Blast::ExtSerialization* NvBlastExtSerializationCreate();
Nv::Blast::ExtSerialization::peekHeader
virtual bool peekHeader(uint32_t *objectTypeID, uint32_t *encodingID, uint64_t *dataSize, const void *buffer, uint64_t bufferSize)=0
NvBlastGlobals.h
Nv::Blast::ExtSerialization::skipObject
virtual const void * skipObject(uint64_t &bufferSize, const void *buffer)=0
Nv::Blast::ExtSerialization::EncodingID::Enum
Enum
Definition: NvBlastExtSerialization.h:48
Nv::Blast::ExtSerialization::serializeIntoBuffer
virtual uint64_t serializeIntoBuffer(void *&buffer, const void *object, uint32_t objectTypeID)=0
NVBLAST_API
#define NVBLAST_API
Definition: NvBlastPreprocessor.h:37
Nv::Blast::ExtSerialization::setSerializationEncoding
virtual bool setSerializationEncoding(uint32_t encodingID)=0
Nv::Blast::ExtSerialization::EncodingID::RawBinary
Definition: NvBlastExtSerialization.h:51
Nv::Blast::ExtSerialization::release
virtual void release()=0
Nv::Blast::ExtSerialization
Definition: NvBlastExtSerialization.h:42
NVBLAST_FOURCC
#define NVBLAST_FOURCC(_a, _b, _c, _d)
Definition: NvBlastGlobals.h:274
Nv::Blast::ExtSerialization::setBufferProvider
virtual void setBufferProvider(BufferProvider *bufferProvider)=0
Nv::Blast::ExtSerialization::BufferProvider
Definition: NvBlastExtSerialization.h:56
Nv::Blast::ExtSerialization::~ExtSerialization
virtual ~ExtSerialization()
Definition: NvBlastExtSerialization.h:140
NvBlastExtSerializationCreate
Nv::Blast::ExtSerialization * NvBlastExtSerializationCreate()
Nv::Blast::ExtSerialization::deserializeFromBuffer
virtual void * deserializeFromBuffer(const void *buffer, uint64_t bufferSize, uint32_t *objectTypeIDPtr=nullptr)=0
Nv::Blast::ExtSerialization::EncodingID
Definition: NvBlastExtSerialization.h:46
Nv::Blast::ExtSerialization::getSerializationEncoding
virtual uint32_t getSerializationEncoding() const =0
Nv
Definition: NvBlastExtAuthoring.h:34
Nv::Blast::ExtSerialization::EncodingID::CapnProtoBinary
Definition: NvBlastExtSerialization.h:50