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); 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) void Insert(const N index, const T value)
{ {
N newSize = 0; N newSize = 0;
@ -251,6 +254,9 @@ namespace ehs
size = newSize; 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 Remove(const N index)
{ {
T popped = {}; T popped = {};
@ -383,6 +389,7 @@ namespace ehs
return Pop(); return Pop();
} }
/// Releases the resources of the array.
void Clear() void Clear()
{ {
if (!data) if (!data)
@ -418,6 +425,8 @@ namespace ehs
return size; return size;
} }
/// Retrieves the index at the end of the array.
/// @returns The index.
N End() const N End() const
{ {
return size - 1; return size - 1;

View File

@ -21,9 +21,9 @@ namespace ehs
UINT_8 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; return stride;
} }
/// Retrieves the index at the end of the array.
/// @returns The index.
N End() const N End() const
{ {
return size ? size - 1 : size; 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() void Clear()
{ {
if (!size) if (!size)