10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
tenduke::utl::FixedSizeBinaryData Class Reference

#include <FixedSizeBinaryData.h>

Detailed Description

Utility class for fixed size binary data.

Maintains memory for the contained memory area. The memory is wiped (overwritten with zeros) when the instance is destroyed.

Inheritance diagram for tenduke::utl::FixedSizeBinaryData:
tenduke::utl::BinaryData tenduke::utl::MutableDataSpan tenduke::utl::DataSpan

Public Member Functions

 FixedSizeBinaryData (std::size_t length)
 Constructs new instance by allocating memory of length bytes.
 FixedSizeBinaryData (std::unique_ptr< unsigned char[]> data, std::size_t length)
 Constructs new instance by taking ownership of given data.
 FixedSizeBinaryData (const unsigned char *data, std::size_t length)
 Constructs new instance by copying the provided data.
 FixedSizeBinaryData (const FixedSizeBinaryData &copy)
 Copy constructs new instance.
 FixedSizeBinaryData (const BinaryData &copy)
 Copy constructs new instance.
 FixedSizeBinaryData (const ::tenduke::utl::DataSpan &copy)
 Copy constructs new instance.
 ~FixedSizeBinaryData () override
 Destructs the instance, frees contained data.
unsigned char * getData () const override
 Returns pointer to the data.
std::size_t getLength () const override
 Returns length of the data.
Public Member Functions inherited from tenduke::utl::BinaryData
unsigned char * data () override
 Returns a mutable view of the underlying data.
const unsigned char * data () const override
 Returns a pointer to the beginning of the underlying sequence.
std::size_t size_bytes () const override
 Returns the size of the span in bytes.
Public Member Functions inherited from tenduke::utl::MutableDataSpan
virtual const unsigned char * data () const=0
 Returns a pointer to the beginning of the underlying sequence.

Static Public Member Functions

static std::unique_ptr< unsigned char[]> allocateData (size_t length)
 Allocates memory for length bytes.

Constructor & Destructor Documentation

◆ FixedSizeBinaryData() [1/6]

tenduke::utl::FixedSizeBinaryData::FixedSizeBinaryData ( std::size_t length)
explicit

Constructs new instance by allocating memory of length bytes.

Parameters
lengthnum bytes to allocate.

◆ FixedSizeBinaryData() [2/6]

tenduke::utl::FixedSizeBinaryData::FixedSizeBinaryData ( std::unique_ptr< unsigned char[]> data,
std::size_t length )

Constructs new instance by taking ownership of given data.

Parameters
datathe data to wrap
lengthsize of the data

◆ FixedSizeBinaryData() [3/6]

tenduke::utl::FixedSizeBinaryData::FixedSizeBinaryData ( const unsigned char * data,
std::size_t length )

Constructs new instance by copying the provided data.

Parameters
datapointer to the data to copy
lengthsize of the data in bytes

◆ FixedSizeBinaryData() [4/6]

tenduke::utl::FixedSizeBinaryData::FixedSizeBinaryData ( const FixedSizeBinaryData & copy)

Copy constructs new instance.

Parameters
copy-

◆ FixedSizeBinaryData() [5/6]

tenduke::utl::FixedSizeBinaryData::FixedSizeBinaryData ( const BinaryData & copy)
explicit

Copy constructs new instance.

Parameters
copy-

◆ FixedSizeBinaryData() [6/6]

tenduke::utl::FixedSizeBinaryData::FixedSizeBinaryData ( const ::tenduke::utl::DataSpan & copy)
explicit

Copy constructs new instance.

Parameters
copy-

Member Function Documentation

◆ allocateData()

std::unique_ptr< unsigned char[]> tenduke::utl::FixedSizeBinaryData::allocateData ( size_t length)
static

Allocates memory for length bytes.

Parameters
length-
Returns
-

◆ getData()

unsigned char * tenduke::utl::FixedSizeBinaryData::getData ( ) const
overridevirtual

Returns pointer to the data.

Do not free or deallocate this!

Returns
-

Implements tenduke::utl::BinaryData.

◆ getLength()

size_t tenduke::utl::FixedSizeBinaryData::getLength ( ) const
overridevirtual

Returns length of the data.

Returns
-

Implements tenduke::utl::BinaryData.


The documentation for this class was generated from the following files: