10Duke Scale C++ Client
Loading...
Searching...
No Matches
FixedSizeBinaryData.h
1#ifndef TENDUKE_UTL_FIXEDSIZEBINARYDATA_H
2#define TENDUKE_UTL_FIXEDSIZEBINARYDATA_H
3
4#include "./BinaryData.h"
5
6#include <memory>
7
8namespace tenduke { namespace utl {
9
10
16{
17public:
22 explicit FixedSizeBinaryData(std::size_t length);
23
29 FixedSizeBinaryData(std::unique_ptr<unsigned char[]> data, std::size_t length);
30
36
42
46
52 static std::unique_ptr<unsigned char[]> allocateData(size_t length);
53
54// BinaryData interface
55public:
60 unsigned char *getData() const override;
61
66 std::size_t getLength() const override;
67
68private:
69 const std::unique_ptr<unsigned char[]> data;
70 const std::size_t length;
71};
72
73
74}}
75
76#endif // TENDUKE_UTL_FIXEDSIZEBINARYDATA_H
A holder of binary data.
Definition BinaryData.h:13
Utility class for fixed size binary data.
Definition FixedSizeBinaryData.h:16
FixedSizeBinaryData(std::unique_ptr< unsigned char[]> data, std::size_t length)
Constructs new instance by taking ownership of given data.
~FixedSizeBinaryData() override
Destructs the instance, frees contained data.
std::size_t getLength() const override
Returns length of the data.
Definition FixedSizeBinaryData.cpp:48
FixedSizeBinaryData(std::size_t length)
Constructs new instance by allocating memory of length bytes.
unsigned char * getData() const override
Returns pointer to the data.
Definition FixedSizeBinaryData.cpp:43
static std::unique_ptr< unsigned char[]> allocateData(size_t length)
Allocates memory for length bytes.
Definition FixedSizeBinaryData.cpp:53
Utilities.
Definition Base64Decoder.h:10
Root for classes, functions and globals of 10Duke C++ Client.
Definition BackendConfiguration.h:7