Documented Array and Vector containers.

This commit is contained in:
Arron David Nelson 2024-02-01 20:09:58 -08:00
parent 0996f16482
commit 80744abcc3
3 changed files with 15 additions and 4 deletions

View File

@ -227,6 +227,9 @@ namespace ehs
data[b] = std::move(tmp);
}
/// Inserts a value at the specified index.
/// @param [in] index The index to insert the value at.
/// @param [in] value The value to add.
void Insert(const N index, const T value)
{
N newSize = 0;
@ -251,6 +254,9 @@ namespace ehs
size = newSize;
}
/// Removes a value at the specified index.
/// @param [in] index The index to remove a value.
/// @returns The value that was removed.
T Remove(const N index)
{
T popped = {};
@ -383,6 +389,7 @@ namespace ehs
return Pop();
}
/// Releases the resources of the array.
void Clear()
{
if (!data)
@ -418,6 +425,8 @@ namespace ehs
return size;
}
/// Retrieves the index at the end of the array.
/// @returns The index.
N End() const
{
return size - 1;

View File

@ -21,9 +21,9 @@ namespace ehs
UINT_8
};
DataType FromAudioBitDepth(const UInt_16 bitDepth);
DataType FromAudioBitDepth(UInt_16 bitDepth);
UInt_8 ToByteDepth(const DataType type);
UInt_8 ToByteDepth(DataType type);
UInt_8 ToBitDepth(const DataType type);
UInt_8 ToBitDepth(DataType type);
}

View File

@ -259,6 +259,8 @@ namespace ehs
return stride;
}
/// Retrieves the index at the end of the array.
/// @returns The index.
N End() const
{
return size ? size - 1 : size;
@ -617,7 +619,7 @@ namespace ehs
}
}
/// Clears all values in the vector object.
/// Releases the resources of the vector.
void Clear()
{
if (!size)