Utility template functions (memory manipulation). More...
Modules | |
Coding Functions | |
Encoding / Decoding functions. | |
Compression Functions | |
Data compression functions. | |
Sort Functions | |
Sorting functions. | |
String Functions | |
String manipulation and test functions. | |
Functions | |
template<class DataType > | |
void | Murl::Util::Release (DataType &p) |
Release an object. More... | |
template<class DataType > | |
void | Murl::Util::ReleaseArray (DataType &p) |
Release an object array. More... | |
template<class DestType , class SrcType > | |
bool | Murl::Util::ReleaseType (SrcType &p) |
Release an object of specified type. More... | |
template<class DataType > | |
void | Murl::Util::MemClear (DataType &memory) |
Clear the memory of a concrete type. More... | |
template<class DataType > | |
void | Murl::Util::MemSet (DataType memory, UInt8 value, UInt64 byteSize) |
Set memory bytes to a given value. More... | |
template<class DestType , class SrcType > | |
void | Murl::Util::MemCopy (DestType destination, const SrcType source, UInt64 byteSize) |
Copy memory bytes. More... | |
template<class DataType > | |
void | Murl::Util::MemCopyArray (DataType &destination, const DataType &source) |
Copy the memory of a concrete type. More... | |
template<class DestType , class SrcType > | |
void | Murl::Util::MemMove (DestType destination, const SrcType source, UInt64 byteSize) |
Move overlapping memory bytes. More... | |
template<class DataType1 , class DataType2 > | |
SInt32 | Murl::Util::MemCompare (const DataType1 source1, const DataType2 source2, UInt64 byteSize) |
Compare memory bytes. More... | |
template<class DataType > | |
void | Murl::Util::Fill (DataType *dstPtr, const DataType *dstEnd, const DataType &value) |
Fill the memory of a concrete type. More... | |
template<class ArrayType , class DataType > | |
void | Murl::Util::FillArray (ArrayType &array, const DataType &value) |
Set all C-array elements to a given value. More... | |
template<class DataType > | |
UInt32 | Murl::Util::Find (const DataType *memory, const DataType &item, UInt32 maxElements) |
Find the first appearance of a concrete type in memory. More... | |
template<class ArrayType , class DataType > | |
UInt32 | Murl::Util::FindArray (ArrayType &array, const DataType &item) |
Find the first appearance of an item in a C-array. More... | |
template<class DataType > | |
void | Murl::Util::Swap (DataType &a, DataType &b) |
Swap two values. More... | |
template<class DataType > | |
DataType | Murl::Util::RoundToNextPowerOfTwo (DataType value) |
Round a value to the next power of two. More... | |
template<class DataType > | |
Bool | Murl::Util::IsPowerOfTwo (DataType value) |
Check if a given value equals a power of two. More... | |
template<class DataType > | |
DataType | Murl::Util::RoundToNextFourByteBoundary (DataType value) |
Round a value to the next 4 byte boundary. More... | |
template<class DataType > | |
DataType | Murl::Util::RoundToNextEightByteBoundary (DataType value) |
Round a value to the next 8 byte boundary. More... | |
template<class DataType > | |
DataType | Murl::Util::RoundToNextSixteenByteBoundary (DataType value) |
Round a value to the next 16 byte boundary. More... | |
template<class DataType > | |
DataType | Murl::Util::RoundToRaster (DataType value, DataType raster, DataType &diff) |
Round a value to the next raster and return the rounded value and the difference to the previous raster before rounding. More... | |
template<class DataType > | |
DataType | Murl::Util::RoundToRaster (DataType value, DataType raster) |
Round a value to the next raster. More... | |
template<class DataType > | |
UInt32 | Murl::Util::GetNumberOfSetBits (DataType value) |
Compute the number of set bits. More... | |
template<class DataType > | |
UInt32 | Murl::Util::GetNumberOfClearedBits (DataType value) |
Compute the number of cleared bits. More... | |
template<class DataType > | |
UInt32 | Murl::Util::GetNumberOfDigits (DataType value, DataType base=10) |
Compute the number of digits. More... | |
const Data & | Murl::Util::StaticEmptyData () |
Get a constant static empty data object. More... | |
UInt64 | Murl::Util::SwapBytes (UInt64 value) |
Swap all bytes of a 64 bit value. More... | |
UInt32 | Murl::Util::SwapBytes (UInt32 value) |
Swap all bytes of a 32 bit value. More... | |
UInt16 | Murl::Util::SwapBytes (UInt16 value) |
Swap all bytes of a 16 bit value. More... | |
Bool | Murl::Util::IsDebugBuild () |
Check if the engine was built using the debug configuration. More... | |
Bool | Murl::Util::IsReleaseBuild () |
Check if the engine was built using the release configuration. More... | |
Detailed Description
Utility template functions (memory manipulation).
Function Documentation
◆ Release()
void Murl::Util::Release | ( | DataType & | p | ) |
Release an object.
After destruction the object pointer is set to null.
- Parameters
-
p The reference to the object to delete.
◆ ReleaseArray()
void Murl::Util::ReleaseArray | ( | DataType & | p | ) |
Release an object array.
After destruction the object pointer is set to null.
- Parameters
-
p The reference to the object array to delete.
Referenced by Murl::Data::AssignData(), Murl::Data::ObtainData(), Murl::Data::ReleaseData(), Murl::Data::ResizeData(), and Murl::Data::~Data().
◆ ReleaseType()
bool Murl::Util::ReleaseType | ( | SrcType & | p | ) |
Release an object of specified type.
The object is dynamic_cast'ed to the specified type. After destruction the object pointer is set to null.
- Template Parameters
-
DestType The type to dynamic_cast the object pointer to.
- Parameters
-
p The reference to the object to delete.
- Returns
- true if the pointer was deleted successfully.
◆ MemClear()
void Murl::Util::MemClear | ( | DataType & | memory | ) |
Clear the memory of a concrete type.
- Parameters
-
memory A reference to the memory to clear.
References Murl::System::CLib::MemSet().
◆ MemSet()
Set memory bytes to a given value.
- Parameters
-
memory The memory to set. value The byte value to write into the memory. byteSize The byte size of the memory location.
References Murl::System::CLib::MemSet().
Referenced by Murl::Math::Matrix< DataType >::Clear().
◆ MemCopy()
void Murl::Util::MemCopy | ( | DestType | destination, |
const SrcType | source, | ||
UInt64 | byteSize | ||
) |
Copy memory bytes.
- Parameters
-
destination The destination memory. source The source memory. byteSize The number of bytes to copy.
References Murl::System::CLib::MemCopy().
Referenced by Murl::Data::AssignData(), Murl::MutableData::CopyFrom(), and Murl::ConstData::CopyTo().
◆ MemCopyArray()
void Murl::Util::MemCopyArray | ( | DataType & | destination, |
const DataType & | source | ||
) |
Copy the memory of a concrete type.
The source and destination memory must be the same type.
- Parameters
-
destination A reference to the destination memory. source A reference to the source memory.
References Murl::System::CLib::MemCopy().
◆ MemMove()
void Murl::Util::MemMove | ( | DestType | destination, |
const SrcType | source, | ||
UInt64 | byteSize | ||
) |
Move overlapping memory bytes.
- Parameters
-
destination The destination memory. source The source memory. byteSize The number of bytes to move.
References Murl::System::CLib::MemMove().
◆ MemCompare()
SInt32 Murl::Util::MemCompare | ( | const DataType1 | source1, |
const DataType2 | source2, | ||
UInt64 | byteSize | ||
) |
Compare memory bytes.
- Parameters
-
source1 The 1st source memory. source2 The 2nd source memory. byteSize The number of bytes to compare.
- Returns
- Zero if source1 is equal to source2, negative if source1 is lesser than source2, positive if source1 is greater than source2.
References Murl::System::CLib::MemCompare().
Referenced by Murl::ConstData::operator==().
◆ Fill()
void Murl::Util::Fill | ( | DataType * | dstPtr, |
const DataType * | dstEnd, | ||
const DataType & | value | ||
) |
Fill the memory of a concrete type.
- Parameters
-
dstPtr The destination memory start pointer. dstEnd The destination memory end pointer. value The value to fill.
Referenced by Murl::Hash::Reindex().
◆ FillArray()
void Murl::Util::FillArray | ( | ArrayType & | array, |
const DataType & | value | ||
) |
Set all C-array elements to a given value.
- Parameters
-
array A reference to the C-array to set. value The value to set for each array item.
◆ Find()
UInt32 Murl::Util::Find | ( | const DataType * | memory, |
const DataType & | item, | ||
UInt32 | maxElements | ||
) |
Find the first appearance of a concrete type in memory.
- Parameters
-
memory The source memory pointer. item The item to find. maxElements The maximum number of items to scan.
- Returns
- The zero-based index of the item or maxElements if the item was not found.
◆ FindArray()
UInt32 Murl::Util::FindArray | ( | ArrayType & | array, |
const DataType & | item | ||
) |
Find the first appearance of an item in a C-array.
- Parameters
-
array A reference to the C-array. item The item to find.
- Returns
- The zero-based index of the item or (sizeof(array) / sizeof(array[0])) if the item was not found.
◆ Swap()
void Murl::Util::Swap | ( | DataType & | a, |
DataType & | b | ||
) |
Swap two values.
- Parameters
-
a The 1st value to swap. b The 2nd value to swap.
Referenced by Murl::Array< DataType >::Swap(), Murl::Hash::Swap(), Murl::Queue< DataType >::Swap(), Murl::Field< DataType, COUNT >::Swap(), and Murl::ObjectArray< DataType >::Swap().
◆ RoundToNextPowerOfTwo()
DataType Murl::Util::RoundToNextPowerOfTwo | ( | DataType | value | ) |
Round a value to the next power of two.
- Parameters
-
value The value to round.
- Returns
- The value rounded to the next power of two.
Referenced by Murl::BufferedData::AppendData().
◆ IsPowerOfTwo()
Bool Murl::Util::IsPowerOfTwo | ( | DataType | value | ) |
Check if a given value equals a power of two.
- Parameters
-
value The value to check.
- Returns
- true if the value is a power of two.
◆ RoundToNextFourByteBoundary()
DataType Murl::Util::RoundToNextFourByteBoundary | ( | DataType | value | ) |
Round a value to the next 4 byte boundary.
- Parameters
-
value The value to round.
- Returns
- The value rounded to the next 4 byte boundary.
◆ RoundToNextEightByteBoundary()
DataType Murl::Util::RoundToNextEightByteBoundary | ( | DataType | value | ) |
Round a value to the next 8 byte boundary.
- Parameters
-
value The value to round.
- Returns
- The value rounded to the next 8 byte boundary.
◆ RoundToNextSixteenByteBoundary()
DataType Murl::Util::RoundToNextSixteenByteBoundary | ( | DataType | value | ) |
Round a value to the next 16 byte boundary.
- Parameters
-
value The value to round.
- Returns
- The value rounded to the next 16 byte boundary.
◆ RoundToRaster() [1/2]
DataType Murl::Util::RoundToRaster | ( | DataType | value, |
DataType | raster, | ||
DataType & | diff | ||
) |
Round a value to the next raster and return the rounded value and the difference to the previous raster before rounding.
- Parameters
-
value The value to round. raster The raster to round to. diff The difference return value.
- Returns
- The value rounded to the next raster.
Referenced by Murl::BufferedData::AppendData(), and Murl::Util::RoundToRaster().
◆ RoundToRaster() [2/2]
DataType Murl::Util::RoundToRaster | ( | DataType | value, |
DataType | raster | ||
) |
Round a value to the next raster.
- Parameters
-
value The value to round. raster The raster to round to.
- Returns
- The value rounded to the next raster.
References Murl::Util::RoundToRaster().
◆ GetNumberOfSetBits()
UInt32 Murl::Util::GetNumberOfSetBits | ( | DataType | value | ) |
Compute the number of set bits.
- Parameters
-
value The value to count the set bits.
- Returns
- The number of set bits.
Referenced by Murl::Util::GetNumberOfClearedBits().
◆ GetNumberOfClearedBits()
UInt32 Murl::Util::GetNumberOfClearedBits | ( | DataType | value | ) |
Compute the number of cleared bits.
- Parameters
-
value The value to count the cleared bits.
- Returns
- The number of cleared bits.
References Murl::Util::GetNumberOfSetBits().
◆ GetNumberOfDigits()
UInt32 Murl::Util::GetNumberOfDigits | ( | DataType | value, |
DataType | base = 10 |
||
) |
Compute the number of digits.
- Parameters
-
value The value to compute the number of digits. base The base of the digits.
- Returns
- The number of digits.
◆ StaticEmptyData()
const Data& Murl::Util::StaticEmptyData | ( | ) |
Get a constant static empty data object.
- Returns
- The constant static empty data object.
◆ SwapBytes() [1/3]
Swap all bytes of a 64 bit value.
- Parameters
-
value The value to swap the bytes.
- Returns
- The value in reverse byte ordering.
◆ SwapBytes() [2/3]
Swap all bytes of a 32 bit value.
- Parameters
-
value The value to swap the bytes.
- Returns
- The value in reverse byte ordering.
◆ SwapBytes() [3/3]
Swap all bytes of a 16 bit value.
- Parameters
-
value The value to swap the bytes.
- Returns
- The value in reverse byte ordering.
◆ IsDebugBuild()
|
inline |
Check if the engine was built using the debug configuration.
- Returns
- true if the engine was built using the debug configuration.
◆ IsReleaseBuild()
|
inline |
Check if the engine was built using the release configuration.
- Returns
- true if the engine was built using the release configuration.