-
Notifications
You must be signed in to change notification settings - Fork 130
/
BinaryStreamReader.h
133 lines (123 loc) · 5.75 KB
/
BinaryStreamReader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "dna/DataLayer.h"
#include "dna/Defs.h"
#include "dna/StreamReader.h"
#include "dna/types/Aliases.h"
namespace dna {
class DNAAPI BinaryStreamReader : public StreamReader {
public:
/**
@brief Factory method for creation of BinaryStreamReader
@param stream
Source stream from which data is going to be read.
@param layer
Specify the layer up to which the data needs to be loaded.
@note
The Definition data layer depends on and thus implicitly loads the Descriptor layer.
The Behavior data layer depends on and thus implicitly loads the Definition layer.
The Geometry data layer depends on and thus also implicitly loads the Definition layer.
@param maxLOD
The maximum level of details to be loaded.
@note
A value of zero indicates to load all LODs.
@warning
The maxLOD value must be less than the value returned by getLODCount.
@see getLODCount
@param memRes
Memory resource to be used for allocations.
@note
If a memory resource is not given, a default allocation mechanism will be used.
@warning
User is responsible for releasing the returned pointer by calling destroy.
@see destroy
*/
static BinaryStreamReader* create(BoundedIOStream* stream,
DataLayer layer = DataLayer::All,
std::uint16_t maxLOD = 0u,
MemoryResource* memRes = nullptr);
/**
@brief Factory method for creation of BinaryStreamReader
@param stream
Source stream from which data is going to be read.
@param layer
Specify the layer up to which the data needs to be loaded.
@note
The Definition data layer depends on and thus implicitly loads the Descriptor layer.
The Behavior data layer depends on and thus implicitly loads the Definition layer.
The Geometry data layer depends on and thus also implicitly loads the Definition layer.
@param maxLOD
The maximum level of details to be loaded.
@param minLOD
The minimum level of details to be loaded.
@note
A range of [0, LOD count - 1] for maxLOD / minLOD respectively indicates to load all LODs.
@warning
Both maxLOD and minLOD values must be less than the value returned by getLODCount.
@see getLODCount
@param memRes
Memory resource to be used for allocations.
@note
If a memory resource is not given, a default allocation mechanism will be used.
@warning
User is responsible for releasing the returned pointer by calling destroy.
@see destroy
*/
static BinaryStreamReader* create(BoundedIOStream* stream,
DataLayer layer,
std::uint16_t maxLOD,
std::uint16_t minLOD,
MemoryResource* memRes = nullptr);
/**
@brief Factory method for creation of BinaryStreamReader
@param stream
Source stream from which data is going to be read.
@param layer
Specify the layer up to which the data needs to be loaded.
@note
The Definition data layer depends on and thus implicitly loads the Descriptor layer.
The Behavior data layer depends on and thus implicitly loads the Definition layer.
The Geometry data layer depends on and thus also implicitly loads the Definition layer.
@param lods
An array specifying which exact lods to load.
@warning
All values in the array must be less than the value returned by getLODCount.
@see getLODCount
@param lodCount
The number of elements in the lods array.
@warning
There cannot be more elements in the array than the value returned by getLODCount.
@see getLODCount
@param memRes
Memory resource to be used for allocations.
@note
If a memory resource is not given, a default allocation mechanism will be used.
@warning
User is responsible for releasing the returned pointer by calling destroy.
@see destroy
*/
static BinaryStreamReader* create(BoundedIOStream* stream,
DataLayer layer,
std::uint16_t* lods,
std::uint16_t lodCount,
MemoryResource* memRes = nullptr);
/**
@brief Method for freeing a BinaryStreamReader instance.
@param instance
Instance of BinaryStreamReader to be freed.
@see create
*/
static void destroy(BinaryStreamReader* instance);
~BinaryStreamReader() override;
};
} // namespace dna
namespace pma {
template<>
struct DefaultInstanceCreator<dna::BinaryStreamReader> {
using type = pma::FactoryCreate<dna::BinaryStreamReader>;
};
template<>
struct DefaultInstanceDestroyer<dna::BinaryStreamReader> {
using type = pma::FactoryDestroy<dna::BinaryStreamReader>;
};
} // namespace pma