Murl::ConstData Class Reference

The ConstData object holds a pointer and size information to a read-only memory data location. More...

#include "murl_data.h"

Inheritance diagram for Murl::ConstData:

Public Member Functions

 ConstData ()
 The default constructor.
 
 ConstData (const void *data, const UInt64 byteSize)
 The constructor taking data and byte size. More...
 
 ~ConstData () override=default
 The destructor.
 
virtual void ReleaseData ()
 Release the data, set data pointer to null and size to zero.
 
virtual void AssignData (const void *data, UInt64 byteSize)
 Assign a memory data location. More...
 
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 ConstData object holds a pointer and size information to a read-only memory data location.

see also Data, BufferedData

Constructor & Destructor Documentation

◆ ConstData()

Murl::ConstData::ConstData ( const void *  data,
const UInt64  byteSize 
)
inline

The constructor taking data and byte size.

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

Member Function Documentation

◆ AssignData()

virtual void Murl::ConstData::AssignData ( const void *  data,
UInt64  byteSize 
)
inlinevirtual

Assign a memory data location.

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

Reimplemented in Murl::BufferedData, and Murl::Data.

◆ IsEmpty()

Bool Murl::ConstData::IsEmpty ( ) const
inline

Check if the data object is empty.

Returns
true if the data pointer is null.

◆ GetByteSize32()

UInt32 Murl::ConstData::GetByteSize32 ( ) const
inline

Get the 32 bit byte size of the memory data location.

Returns
The 32 bit byte size of the memory data location or zero if the memory data byte size does not fit into 32 bit.

◆ GetByteSize()

UInt64 Murl::ConstData::GetByteSize ( ) const
inline

Get the byte size of the memory data location.

Returns
The byte size of the memory data location.

◆ GetData() [1/4]

template<class DataType >
const DataType* Murl::ConstData::GetData ( ) const
inline

Get the pointer to the memory data location.

Template Parameters
DataTypeThe type of the returned pointer.
Returns
The pointer to the memory data location.

◆ GetData() [2/4]

const UInt8* Murl::ConstData::GetData ( ) const
inline

Get the pointer to the memory data location.

Returns
The pointer to the memory data location.

◆ GetData() [3/4]

template<class DataType >
const DataType* Murl::ConstData::GetData ( UInt64  byteOffset) const
inline

Get the pointer to the memory data location including a byte offset.

A valid byte offset is in range [0 .. GetByteSize() - 1].

Template Parameters
DataTypeThe type of the returned pointer.
Parameters
byteOffsetThe byte offset.
Returns
The pointer to the memory data location or null if the byte offset is out of range.

◆ GetData() [4/4]

const UInt8* Murl::ConstData::GetData ( UInt64  byteOffset) const
inline

Get the pointer to the memory data location including a byte offset.

A valid byte offset is in range [0 .. GetByteSize() - 1].

Parameters
byteOffsetThe byte offset.
Returns
The pointer to the memory data location or null if the byte offset is out of range.

◆ CopyTo()

UInt64 Murl::ConstData::CopyTo ( void *  destination,
UInt64  byteSize,
UInt64  byteOffset 
) const
inline

Copy the memory data to a destination.

A valid byte offset is in range [0 .. GetByteSize() - 1].

Parameters
destinationThe pointer to the destination memory.
byteSizeThe destination byte size.
byteOffsetThe source byte offset.
Returns
The number of bytes copied to the destination.

References Murl::Util::MemCopy().

Referenced by Murl::MutableData::CopyDataTo().

◆ GetString() [1/2]

String Murl::ConstData::GetString ( ) const
inline

Get a string from the memory data.

(!) This method does not take care of zero termination.

Returns
The string object containing the memory data.

◆ GetString() [2/2]

String Murl::ConstData::GetString ( UInt64  length) const
inline

Get a string from the memory data with length.

(!) This method does not take care of zero termination.

Parameters
lengthThe length of the string.
Returns
The string object containing the memory data.

◆ GetHashValue()

UInt64 Murl::ConstData::GetHashValue ( ) const
inline

Calculate the data hash value.

Returns
The hash value.

References Murl::Util::Hash::GetMemoryHashValue().

◆ operator==() [1/2]

bool Murl::ConstData::operator== ( const ConstData rhs) const
inline

Equal to comparison operator.

Parameters
rhsThe right hand side data to compare.
Returns
true if the memory bytes are equal.

References Murl::Util::MemCompare().

◆ operator!=() [1/2]

bool Murl::ConstData::operator!= ( const ConstData rhs) const
inline

Not equal to comparison operator.

Parameters
rhsThe right hand side data to compare.
Returns
true if the memory bytes are not equal.

◆ operator==() [2/2]

bool Murl::ConstData::operator== ( const String rhs) const
inline

Equal to comparison operator with string.

Parameters
rhsThe right hand side string to compare.
Returns
true if the memory and string bytes are equal.

References Murl::String::Begin(), Murl::String::GetLength(), and Murl::Util::MemCompare().

◆ operator!=() [2/2]

bool Murl::ConstData::operator!= ( const String rhs) const
inline

Not equal to comparison operator with string.

Parameters
rhsThe right hand side string to compare.
Returns
true if the memory and string bytes are not equal.

◆ CollectObjectStatistics()

void Murl::ConstData::CollectObjectStatistics ( IObjectStatistics *  stat) const
inlineoverride

Implementation of IStatisticsObject::CollectObjectStatistics().

Parameters
statThe object statistics container.

References Murl::IEnums::MEMORY_TYPE_HEAP.


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


Copyright © 2011-2024 Spraylight GmbH.