10Duke Enterprise C++ SDK
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
17{
18public:
23 explicit FixedSizeBinaryData(std::size_t length);
24
30 FixedSizeBinaryData(std::unique_ptr<unsigned char[]> data, std::size_t length);
31
37 FixedSizeBinaryData(const unsigned char* data, std::size_t length);
38
44
49 explicit FixedSizeBinaryData(const BinaryData &copy);
50
55 explicit FixedSizeBinaryData(const ::tenduke::utl::DataSpan &copy);
56
57
60 ~FixedSizeBinaryData() override;
61
67 static std::unique_ptr<unsigned char[]> allocateData(size_t length);
68
69// BinaryData interface
70public:
75 unsigned char *getData() const override;
76
81 std::size_t getLength() const override;
82
83private:
84 const std::unique_ptr<unsigned char[]> data_;
85 const std::size_t length_;
86};
87
88
89}}
90
91#endif // TENDUKE_UTL_FIXEDSIZEBINARYDATA_H
FixedSizeBinaryData(std::size_t length)
Constructs new instance by allocating memory of length bytes.
A holder of binary data.
Definition BinaryData.h:14
unsigned char * data() override
Returns a mutable view of the underlying data.
Definition BinaryData.h:28
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.
Definition FixedSizeBinaryData.cpp:47
std::size_t getLength() const override
Returns length of the data.
Definition FixedSizeBinaryData.cpp:58
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:53
FixedSizeBinaryData(const unsigned char *data, std::size_t length)
Constructs new instance by copying the provided data.
static std::unique_ptr< unsigned char[]> allocateData(size_t length)
Allocates memory for length bytes.
Definition FixedSizeBinaryData.cpp:71
Utilities.
Definition Base64Decoder.h:10
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4