10Duke Scale C++ Client
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.

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

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 FixedSizeBinaryData &copy)
 Copy constructs new instance.
 
 FixedSizeBinaryData (const BinaryData &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.
 

Static Public Member Functions

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

Constructor & Destructor Documentation

◆ FixedSizeBinaryData() [1/4]

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/4]

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/4]

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

Copy constructs new instance.

Parameters
copy-

◆ FixedSizeBinaryData() [4/4]

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

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: