Murl::BufferedData Class Reference

The BufferedData object extends the Data object for appending data portions to pre-allocated memory. More...

#include "murl_data.h"

Inheritance diagram for Murl::BufferedData:

Public Member Functions

 BufferedData ()
 The default constructor. More...
 
void ReleaseData () override
 Release the data. More...
 
void AssignData (const void *data, UInt64 byteSize) override
 Assign data by copying the data to position 0. More...
 
void AppendData (const void *data, UInt64 byteSize) override
 Append data to the current write position. More...
 
void SetSizeThreshold (UInt64 sizeThreshold)
 Set the memory growing size threshold. More...
 
UInt64 GetSizeThreshold () const
 Get the memory growing size threshold. More...
 
void SetWritePosition (UInt64 bytePosition)
 Set the write position. More...
 
UInt64 GetWritePosition () const
 Get the write position. More...
 
DataTrim ()
 Trim the memory size to the write position. More...
 
- Public Member Functions inherited from Murl::Data
 Data ()
 The default constructor.
 
 Data (const UInt64 byteSize)
 Constructor allocating memory. More...
 
 Data (const void *data, UInt64 byteSize)
 Constructor allocating memory and copying data. More...
 
 ~Data () override
 The destructor. More...
 
template<class DataType >
DataType * DetachData (UInt64 &byteSize)
 Return the data memory and give up ownership. More...
 
UInt8DetachData (UInt64 &byteSize)
 Return the data memory and give up ownership. More...
 
void ObtainData (void *data, UInt64 byteSize)
 Obtain a memory data location. More...
 
void ObtainData (Data &data)
 Obtain the memory from a data object. More...
 
void ResizeData (UInt64 newByteSize)
 Resize the memory. More...
 
 Data (const ConstData &data)
 The copy constructor taking a ConstData object. More...
 
 Data (const MutableData &data)
 The copy constructor taking a MutableData object. More...
 
 Data (const Data &data)
 The copy constructor. More...
 
template<class DataType >
 Data (const Array< DataType > &array)
 The copy constructor taking an Array object. More...
 
 Data (const String &string)
 The copy constructor taking a String object. More...
 
Dataoperator= (const ConstData &data)
 Assignment operator taking a ConstData object. More...
 
Dataoperator= (const MutableData &data)
 Assignment operator taking a MutableData object. More...
 
Dataoperator= (const Data &data)
 Assignment operator. More...
 
Dataoperator= (const String &string)
 Assignment operator taking a String object. More...
 
template<class DataType >
Dataoperator= (const Array< DataType > &array)
 Assignment operator taking an Array object. More...
 
Dataoperator+= (const ConstData &data)
 In-place addition operator taking a ConstData object. More...
 
Dataoperator+= (const MutableData &data)
 In-place addition operator taking a MutableData object. More...
 
Dataoperator+= (const Data &data)
 In-place addition operator. More...
 
Dataoperator+= (const String &string)
 In-place addition operator taking a String object. More...
 
template<class DataType >
Dataoperator+= (const Array< DataType > &array)
 In-place addition operator taking an Array object. More...
 
void CollectObjectStatistics (IObjectStatistics *stat) const override
 Implementation of IStatisticsObject::CollectObjectStatistics(). More...
 
- Public Member Functions inherited from Murl::MutableData
 MutableData ()
 The default constructor.
 
 MutableData (void *data, UInt64 byteSize)
 The constructor taking data and byte size. More...
 
 ~MutableData () override
 The destructor.
 
template<class DataType >
DataType * GetMutableData () const
 Get the pointer to the mutable memory data location. More...
 
UInt8GetMutableData () const
 Get the pointer to the mutable memory data location. More...
 
template<class DataType >
DataType * GetMutableData (UInt64 byteOffset) const
 Get the pointer to the mutable memory data location including a byte offset. More...
 
UInt8GetMutableData (UInt64 byteOffset) const
 Get the pointer to the mutable memory data location including a byte offset. More...
 
UInt64 CopyDataTo (MutableData &destination, UInt64 byteOffset) const
 Copy the memory data to a destination data object. More...
 
UInt64 CopyFrom (const void *source, UInt64 byteSize, UInt64 byteOffset) const
 Copy the memory data from a source memory location. More...
 
UInt64 CopyDataFrom (const ConstData &source, UInt64 byteOffset) const
 Copy the memory data from a source data object. More...
 
- Public Member Functions inherited from Murl::ConstData
 ConstData ()
 The default constructor.
 
 ConstData (const void *data, const UInt64 byteSize)
 The constructor taking data and byte size. More...
 
 ~ConstData () override=default
 The destructor.
 
Bool IsEmpty () const
 Check if the data object is empty. More...
 
UInt32 GetByteSize32 () const
 Get the 32 bit byte size of the memory data location. More...
 
UInt64 GetByteSize () const
 Get the byte size of the memory data location. More...
 
template<class DataType >
const DataType * GetData () const
 Get the pointer to the memory data location. More...
 
const UInt8GetData () const
 Get the pointer to the memory data location. More...
 
template<class DataType >
const DataType * GetData (UInt64 byteOffset) const
 Get the pointer to the memory data location including a byte offset. More...
 
const UInt8GetData (UInt64 byteOffset) const
 Get the pointer to the memory data location including a byte offset. More...
 
UInt64 CopyTo (void *destination, UInt64 byteSize, UInt64 byteOffset) const
 Copy the memory data to a destination. More...
 
String GetString () const
 Get a string from the memory data. More...
 
String GetString (UInt64 length) const
 Get a string from the memory data with length. More...
 
UInt64 GetHashValue () const
 Calculate the data hash value. More...
 
bool operator== (const ConstData &rhs) const
 Equal to comparison operator. More...
 
bool operator!= (const ConstData &rhs) const
 Not equal to comparison operator. More...
 
bool operator== (const String &rhs) const
 Equal to comparison operator with string. More...
 
bool operator!= (const String &rhs) const
 Not equal to comparison operator with string. More...
 
void CollectObjectStatistics (IObjectStatistics *stat) const override
 Implementation of IStatisticsObject::CollectObjectStatistics(). More...
 

Detailed Description

The BufferedData object extends the Data object for appending data portions to pre-allocated memory.

The memory grows by doubling the memory size if needed. If the memory exceeds a size threshold, the memory grows in steps of the threshold. The size threshold is ignored if the size threshold is 0.

Constructor & Destructor Documentation

◆ BufferedData()

Murl::BufferedData::BufferedData ( )
inline

The default constructor.

Initializes the write position to 0 and the size threshold to 64 kilobytes.

Member Function Documentation

◆ ReleaseData()

void Murl::BufferedData::ReleaseData ( )
inlineoverridevirtual

Release the data.

Free (delete) the memory and set the write position to 0.

Reimplemented from Murl::Data.

References Murl::Data::ReleaseData().

◆ AssignData()

void Murl::BufferedData::AssignData ( const void *  data,
UInt64  byteSize 
)
inlineoverridevirtual

Assign data by copying the data to position 0.

The memory grows by doubling the memory size if needed. If the memory exceeds the size threshold, the memory grows in steps of the threshold. The size threshold is ignored if the size threshold is 0.

Parameters
dataPointer to the memory data location to copy.
byteSizeByte size of the memory to allocate and copy.

Reimplemented from Murl::Data.

References AppendData().

◆ AppendData()

void Murl::BufferedData::AppendData ( const void *  data,
UInt64  byteSize 
)
inlineoverridevirtual

Append data to the current write position.

The memory grows by doubling the memory size if needed. If the memory exceeds the size threshold, the memory grows in steps of the threshold. The size threshold is ignored if the size threshold is 0.

Parameters
dataPointer to the memory data location to append.
byteSizeByte size of the memory to append.

Reimplemented from Murl::Data.

References Murl::MutableData::CopyFrom(), Murl::Data::ResizeData(), Murl::Util::RoundToNextPowerOfTwo(), and Murl::Util::RoundToRaster().

Referenced by AssignData().

◆ SetSizeThreshold()

void Murl::BufferedData::SetSizeThreshold ( UInt64  sizeThreshold)
inline

Set the memory growing size threshold.

See AppendData().

Parameters
sizeThresholdThe memory growing size threshold in bytes.

◆ GetSizeThreshold()

UInt64 Murl::BufferedData::GetSizeThreshold ( ) const
inline

Get the memory growing size threshold.

See AppendData().

Returns
The memory growing size threshold in bytes.

◆ SetWritePosition()

void Murl::BufferedData::SetWritePosition ( UInt64  bytePosition)
inline

Set the write position.

Parameters
bytePositionThe write position in bytes.

◆ GetWritePosition()

UInt64 Murl::BufferedData::GetWritePosition ( ) const
inline

Get the write position.

Returns
The write position in bytes.

◆ Trim()

Data& Murl::BufferedData::Trim ( )
inline

Trim the memory size to the write position.

Returns
The data object itself.

The documentation for this class was generated from the following file:
  • murl_data.h


Copyright © 2011-2024 Spraylight GmbH.