A generic field template class for fixed-size arrays. More...
#include "murl_field.h"
Public Types | |
using | ValueType = DataType |
The template parameter value type. | |
using | ConstIterator = const DataType * |
Definition of the const iterator. | |
using | Iterator = DataType * |
Definition of the iterator. | |
Public Member Functions | |
Field () | |
Default constructor. | |
Field (const Field &other) | |
Construct a field from an already existing one, performing a deep copy. More... | |
~Field () | |
Destroy the field and all of its contents. | |
void | operator= (const Field &other) |
Assign the content of another field to this one, performing a deep copy. More... | |
DataType & | Set (SInt32 index, const DataType &item) |
Initialize an item with a given item. More... | |
Bool | Set (SInt32 index, const DataType &item, SInt32 count) |
Initialize a range of items with a given item. More... | |
void | Fill (const DataType &item) |
Fill all items with a given item. More... | |
void | Swap (SInt32 index1, SInt32 index2) |
Swap two field items. More... | |
SInt32 | Find (const DataType &item) const |
Find the first occurrence of a given item in the field. More... | |
SInt32 | Find (const DataType &item, SInt32 firstIndex) const |
Find the first occurrence of a given item in the field. More... | |
SInt32 | FindLast (const DataType &item) const |
Find the last occurrence of a given item in the field. More... | |
SInt32 | FindLast (const DataType &item, SInt32 lastIndex) const |
Find the last occurrence of a given item in the field. More... | |
DataType & | Front () |
Retrieve the first item from the field. More... | |
const DataType & | Front () const |
Retrieve the first item from the field. More... | |
DataType & | Back () |
Retrieve the last item from the field. More... | |
const DataType & | Back () const |
Retrieve the last item from the field. More... | |
DataType & | Bottom () |
Retrieve the first item from the field. More... | |
const DataType & | Bottom () const |
Retrieve the first item from the field. More... | |
DataType & | Top () |
Retrieve the last item from the field. More... | |
const DataType & | Top () const |
Retrieve the last item from the field. More... | |
DataType & | At (SInt32 index) |
Retrieve the item at a given position from the field. More... | |
DataType & | At (SInt32 index, const DataType &item) |
Retrieve the item at a given position from the field. More... | |
SInt32 | GetCount () const |
Get the number of items in the field. More... | |
Bool | IsEqual (const Field &other) const |
Compare the field to another one. More... | |
bool | operator== (const Field &rhs) const |
The "equal to" comparison operator, calls IsEqual(). More... | |
bool | operator!= (const Field &rhs) const |
The "not equal to" comparison operator, calls IsEqual(). More... | |
Bool | IsIndexValid (SInt32 index) const |
Check if a given index is a valid index. More... | |
DataType & | operator[] (SInt32 index) |
Retrieve the item at a given position from the field. More... | |
const DataType & | operator[] (SInt32 index) const |
Retrieve the item at a given position from the field. More... | |
DataType & | Get (SInt32 index) |
Get the item at a given position from the field. More... | |
const DataType & | Get (SInt32 index) const |
Get the item at a given position from the field. More... | |
operator DataType * () | |
Conversion operator to the underlying raw array. More... | |
operator const DataType * () const | |
Conversion operator to the underlying raw array. More... | |
UInt32 | GetByteSize () const |
Get the number of bytes of the underlying raw array. More... | |
ConstIterator | Begin () const |
Get the const iterator to the first item. More... | |
ConstIterator | End () const |
Get the const iterator next to the last item. More... | |
ConstIterator | GetIter (SInt32 index) const |
Get the const iterator of a specified index. More... | |
SInt32 | GetIterIndex (ConstIterator iterator) const |
Get the item index by iterator. More... | |
void | Swap (Field &other) |
Exchange the content of the field with a given second one. More... | |
Iterator | Begin () |
Get the iterator to the first item. More... | |
Iterator | End () |
Get the iterator next to the last item. More... | |
Iterator | GetIter (SInt32 index) |
Get the iterator of a specified index. More... | |
Detailed Description
template<class DataType, UInt32 COUNT>
class Murl::Field< DataType, COUNT >
A generic field template class for fixed-size arrays.
- Template Parameters
-
DataType The value's data type of the field.
Constructor & Destructor Documentation
◆ Field()
|
inline |
Construct a field from an already existing one, performing a deep copy.
- Parameters
-
other The field to copy.
Member Function Documentation
◆ operator=()
|
inline |
Assign the content of another field to this one, performing a deep copy.
- Parameters
-
other The source field.
◆ Set() [1/2]
|
inline |
Initialize an item with a given item.
- Parameters
-
index The index of the item to set. item The source item to copy.
- Returns
- A reference to the set item.
Referenced by Murl::Field< DataType, COUNT >::Fill().
◆ Set() [2/2]
|
inline |
Initialize a range of items with a given item.
- Parameters
-
index The index of the first item to set. item The source item to copy. count The number of items to set.
- Returns
- true if successful.
◆ Fill()
|
inline |
Fill all items with a given item.
- Parameters
-
item The source item to copy.
References Murl::Field< DataType, COUNT >::Set().
◆ Swap() [1/2]
|
inline |
Swap two field items.
- Parameters
-
index1 The index of the first item. index2 The index of the second item.
References Murl::Util::Swap().
◆ Find() [1/2]
|
inline |
Find the first occurrence of a given item in the field.
- Parameters
-
item The item to find.
- Returns
- The index of the item, or -1 if the item was not found.
◆ Find() [2/2]
|
inline |
Find the first occurrence of a given item in the field.
- Parameters
-
item The item to find. firstIndex The index where to start searching.
- Returns
- The index of the item, or -1 if the item was not found.
◆ FindLast() [1/2]
|
inline |
Find the last occurrence of a given item in the field.
- Parameters
-
item The item to find.
- Returns
- The index of the item, or -1 if the item was not found.
◆ FindLast() [2/2]
|
inline |
Find the last occurrence of a given item in the field.
- Parameters
-
item The item to find. lastIndex The index where to start searching.
- Returns
- The index of the item, or -1 if the item was not found.
◆ Front() [1/2]
|
inline |
Retrieve the first item from the field.
Synonymous to Bottom().
- Returns
- A reference to the first item.
References Murl::Field< DataType, COUNT >::Bottom().
◆ Front() [2/2]
|
inline |
Retrieve the first item from the field.
Synonymous to Bottom().
- Returns
- A const reference to the first item.
References Murl::Field< DataType, COUNT >::Bottom().
◆ Back() [1/2]
|
inline |
Retrieve the last item from the field.
Synonymous to Top().
- Returns
- A reference to the last item.
References Murl::Field< DataType, COUNT >::Top().
◆ Back() [2/2]
|
inline |
Retrieve the last item from the field.
Synonymous to Top().
- Returns
- A const reference to the last item.
References Murl::Field< DataType, COUNT >::Top().
◆ Bottom() [1/2]
|
inline |
Retrieve the first item from the field.
- Returns
- A reference to the first item.
Referenced by Murl::Field< DataType, COUNT >::Front().
◆ Bottom() [2/2]
|
inline |
Retrieve the first item from the field.
- Returns
- A const reference to the first item.
◆ Top() [1/2]
|
inline |
Retrieve the last item from the field.
- Returns
- A reference to the last item.
Referenced by Murl::Field< DataType, COUNT >::Back().
◆ Top() [2/2]
|
inline |
Retrieve the last item from the field.
- Returns
- A const reference to the last item.
◆ At() [1/2]
|
inline |
Retrieve the item at a given position from the field.
- Parameters
-
index The zero-based index of the item to retrieve.
- Returns
- A reference to the specified item.
◆ At() [2/2]
|
inline |
Retrieve the item at a given position from the field.
- Parameters
-
index The zero-based index of the item to retrieve. item The reference item used for initialization.
- Returns
- A reference to the specified item.
◆ GetCount()
|
inline |
Get the number of items in the field.
- Returns
- The number of items.
◆ IsEqual()
|
inline |
Compare the field to another one.
- Parameters
-
other The field to compare.
- Returns
- true if both fields have identical contents.
Referenced by Murl::Field< DataType, COUNT >::operator!=(), and Murl::Field< DataType, COUNT >::operator==().
◆ operator==()
|
inline |
The "equal to" comparison operator, calls IsEqual().
- Parameters
-
rhs The right hand side field to compare.
- Returns
- true if both fields have identical contents.
References Murl::Field< DataType, COUNT >::IsEqual().
◆ operator!=()
|
inline |
The "not equal to" comparison operator, calls IsEqual().
- Parameters
-
rhs The right hand side field to compare.
- Returns
- true if both fields do not have identical contents.
References Murl::Field< DataType, COUNT >::IsEqual().
◆ IsIndexValid()
|
inline |
Check if a given index is a valid index.
- Parameters
-
index The index to check.
- Returns
- true if index >= 0 and index < GetCount().
◆ operator[]() [1/2]
|
inline |
Retrieve the item at a given position from the field.
- Parameters
-
index The zero-based index of the item to retrieve.
- Returns
- A reference to the specified item.
◆ operator[]() [2/2]
|
inline |
Retrieve the item at a given position from the field.
- Parameters
-
index The zero-based index of the item to retrieve.
- Returns
- A const reference to the specified item.
◆ Get() [1/2]
|
inline |
Get the item at a given position from the field.
- Parameters
-
index The zero-based index of the item to retrieve.
- Returns
- A reference to the specified item.
◆ Get() [2/2]
|
inline |
Get the item at a given position from the field.
- Parameters
-
index The zero-based index of the item to retrieve.
- Returns
- A const reference to the specified item.
◆ operator DataType *()
|
inline |
Conversion operator to the underlying raw array.
- Returns
- A pointer to the raw array.
◆ operator const DataType *()
|
inline |
Conversion operator to the underlying raw array.
- Returns
- A pointer to the constant raw array.
◆ GetByteSize()
|
inline |
Get the number of bytes of the underlying raw array.
- Returns
- The number of bytes of the underlying raw array.
◆ Begin() [1/2]
|
inline |
Get the const iterator to the first item.
- Returns
- The const iterator to the first item.
Referenced by Murl::Field< DataType, COUNT >::GetIterIndex().
◆ End() [1/2]
|
inline |
Get the const iterator next to the last item.
- Returns
- The const iterator next to the last item.
Referenced by Murl::Field< DataType, COUNT >::GetIterIndex().
◆ GetIter() [1/2]
|
inline |
Get the const iterator of a specified index.
- Parameters
-
index The index for the iterator.
- Returns
- The const iterator or null if the index is out of range.
◆ GetIterIndex()
|
inline |
Get the item index by iterator.
(!) Adding or removing items will invalidate iterators.
- Parameters
-
iterator The iterator of the item.
- Returns
- The index of the item, or -1 if the iterator is invalid.
References Murl::Field< DataType, COUNT >::Begin(), and Murl::Field< DataType, COUNT >::End().
◆ Swap() [2/2]
|
inline |
Exchange the content of the field with a given second one.
- Parameters
-
other The second field.
References Murl::Util::Swap().
◆ Begin() [2/2]
|
inline |
Get the iterator to the first item.
- Returns
- The iterator to the first item.
◆ End() [2/2]
|
inline |
Get the iterator next to the last item.
- Returns
- The iterator next to the last item.
◆ GetIter() [2/2]
|
inline |
Get the iterator of a specified index.
- Parameters
-
index The index for the iterator.
- Returns
- The iterator or null if the index is out of range.
The documentation for this class was generated from the following file:
- murl_field.h