-
Notifications
You must be signed in to change notification settings - Fork 12
/
bag_simplelayerdescriptor.cpp
102 lines (88 loc) · 2.42 KB
/
bag_simplelayerdescriptor.cpp
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
#include "bag_dataset.h"
#include "bag_simplelayerdescriptor.h"
namespace BAG {
//! Constructor.
/*!
\param id
The unique layer id.
\param type
The layer type.
\param chunkSize
The chunk size the HDF5 DataSet will use.
\param compressionLevel
The compression level the HDF5 DataSet will use.
*/
SimpleLayerDescriptor::SimpleLayerDescriptor(
uint32_t id,
LayerType type,
uint64_t chunkSize,
int compressionLevel)
: LayerDescriptor(id, Layer::getInternalPath(type),
kLayerTypeMapString.at(type), type, chunkSize, compressionLevel)
, m_elementSize(Layer::getElementSize(Layer::getDataType(type)))
{
}
//! Constructor.
/*!
\param dataset
The BAG Dataset this layer will belong to.
\param type
The layer type.
*/
SimpleLayerDescriptor::SimpleLayerDescriptor(
const Dataset& dataset,
LayerType type)
: LayerDescriptor(dataset, type)
, m_elementSize(Layer::getElementSize(Layer::getDataType(type)))
{
}
//! Create a new simple layer descriptor.
/*!
\param dataset
The BAG Dataset this layer will belong to.
\param type
The layer type.
\param chunkSize
The chunk size the HDF5 DataSet will use.
\param compressionLevel
The compression level the HDF5 DataSet will use.
\return
The new simple layer descriptor.
*/
std::shared_ptr<SimpleLayerDescriptor> SimpleLayerDescriptor::create(
const Dataset& dataset,
LayerType type,
uint64_t chunkSize,
int compressionLevel)
{
return std::shared_ptr<SimpleLayerDescriptor>(
new SimpleLayerDescriptor{dataset.getNextId(), type, chunkSize,
compressionLevel});
}
//! Open an existing simple layer descriptor.
/*!
\param dataset
The BAG Dataset this layer will belong to.
\param type
The layer type.
\return
The simple layer descriptor.
*/
std::shared_ptr<SimpleLayerDescriptor> SimpleLayerDescriptor::open(
const Dataset& dataset,
LayerType type)
{
return std::shared_ptr<SimpleLayerDescriptor>(
new SimpleLayerDescriptor{dataset, type});
}
//! \copydoc LayerDescriptor::getDataType
DataType SimpleLayerDescriptor::getDataTypeProxy() const noexcept
{
return Layer::getDataType(this->getLayerType());
}
//! \copydoc LayerDescriptor::getElementSize
uint8_t SimpleLayerDescriptor::getElementSizeProxy() const noexcept
{
return m_elementSize;
}
} // namespace BAG