/src/bag/api/bag_simplelayerdescriptor.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | |
2 | | #include "bag_dataset.h" |
3 | | #include "bag_simplelayerdescriptor.h" |
4 | | |
5 | | |
6 | | namespace BAG { |
7 | | |
8 | | //! Constructor. |
9 | | /*! |
10 | | \param id |
11 | | The unique layer id. |
12 | | \param type |
13 | | The layer type. |
14 | | \param chunkSize |
15 | | The chunk size the HDF5 DataSet will use. |
16 | | \param compressionLevel |
17 | | The compression level the HDF5 DataSet will use. |
18 | | */ |
19 | | SimpleLayerDescriptor::SimpleLayerDescriptor( |
20 | | uint32_t id, |
21 | | LayerType type, |
22 | | uint64_t chunkSize, |
23 | | int compressionLevel) |
24 | 0 | : LayerDescriptor(id, Layer::getInternalPath(type), |
25 | 0 | kLayerTypeMapString.at(type), type, chunkSize, compressionLevel) |
26 | 0 | , m_elementSize(Layer::getElementSize(Layer::getDataType(type))) |
27 | 0 | { |
28 | 0 | } |
29 | | |
30 | | //! Constructor. |
31 | | /*! |
32 | | \param dataset |
33 | | The BAG Dataset this layer will belong to. |
34 | | \param type |
35 | | The layer type. |
36 | | */ |
37 | | SimpleLayerDescriptor::SimpleLayerDescriptor( |
38 | | const Dataset& dataset, |
39 | | LayerType type) |
40 | 179 | : LayerDescriptor(dataset, type) |
41 | 179 | , m_elementSize(Layer::getElementSize(Layer::getDataType(type))) |
42 | 179 | { |
43 | 179 | } |
44 | | |
45 | | //! Create a new simple layer descriptor. |
46 | | /*! |
47 | | \param dataset |
48 | | The BAG Dataset this layer will belong to. |
49 | | \param type |
50 | | The layer type. |
51 | | \param chunkSize |
52 | | The chunk size the HDF5 DataSet will use. |
53 | | \param compressionLevel |
54 | | The compression level the HDF5 DataSet will use. |
55 | | |
56 | | \return |
57 | | The new simple layer descriptor. |
58 | | */ |
59 | | std::shared_ptr<SimpleLayerDescriptor> SimpleLayerDescriptor::create( |
60 | | const Dataset& dataset, |
61 | | LayerType type, |
62 | | uint64_t chunkSize, |
63 | | int compressionLevel) |
64 | 0 | { |
65 | 0 | return std::shared_ptr<SimpleLayerDescriptor>( |
66 | 0 | new SimpleLayerDescriptor{dataset.getNextId(), type, chunkSize, |
67 | 0 | compressionLevel}); |
68 | 0 | } |
69 | | |
70 | | //! Open an existing simple layer descriptor. |
71 | | /*! |
72 | | \param dataset |
73 | | The BAG Dataset this layer will belong to. |
74 | | \param type |
75 | | The layer type. |
76 | | |
77 | | \return |
78 | | The simple layer descriptor. |
79 | | */ |
80 | | std::shared_ptr<SimpleLayerDescriptor> SimpleLayerDescriptor::open( |
81 | | const Dataset& dataset, |
82 | | LayerType type) |
83 | 179 | { |
84 | 179 | return std::shared_ptr<SimpleLayerDescriptor>( |
85 | 179 | new SimpleLayerDescriptor{dataset, type}); |
86 | 179 | } |
87 | | |
88 | | |
89 | | //! \copydoc LayerDescriptor::getDataType |
90 | | DataType SimpleLayerDescriptor::getDataTypeProxy() const noexcept |
91 | 33 | { |
92 | 33 | return Layer::getDataType(this->getLayerType()); |
93 | 33 | } |
94 | | |
95 | | //! \copydoc LayerDescriptor::getElementSize |
96 | | uint8_t SimpleLayerDescriptor::getElementSizeProxy() const noexcept |
97 | 33 | { |
98 | 33 | return m_elementSize; |
99 | 33 | } |
100 | | |
101 | | } // namespace BAG |
102 | | |