Vector
touchgfx/hal/Types.hpp
A very simple container class using pre-allocated memory.
Template Parameters:
- T The type of objects this container works on.
- capacity The maximum number of objects this container can store.
Public Functions
| void | add(T e) | 
| Adds an element to the Vector if the Vector is not full. | |
| void | clear() | 
| Clears the contents of the container. | |
| bool | contains(T elem) | 
| Checks if the Vector contains an element. | |
| bool | isEmpty() const | 
| Query if this object is empty. | |
| uint16_t | maxCapacity() const | 
| Query the maximum capacity of the vector. | |
| T & | operator[](uint16_t idx) | 
| Index operator. | |
| const T & | operator[](uint16_t idx) const | 
| Const version of the index operator. | |
| void | quickRemoveAt(uint16_t index) | 
| Removes an element at the specified index of the Vector. | |
| void | remove(T e) | 
| Removes an element from the Vector if found in the Vector. | |
| T | removeAt(uint16_t index) | 
| Removes an element at the specified index of the Vector. | |
| void | reverse() | 
| Reverses the ordering of the elements in the Vector. | |
| uint16_t | size() const | 
| Gets the current size of the Vector which is the number of elements contained in the Vector. | |
| Vector() | |
| Default constructor. | |
Public Functions Documentation
add
| void add | ( | T | e | ) | |
clear
| void clear | ( | ) | 
Clears the contents of the container.
It does not destruct any of the elements in the Vector.
contains
| bool contains | ( | T | elem | ) | |
isEmpty
maxCapacity
| uint16_t maxCapacity | ( | ) | const | 
operator[]
| T & operator[] | ( | uint16_t | idx | ) | |
Index operator.
Parameters:
| idx | The index of the element to obtain. | 
Returns:
A reference to the element placed at index idx.
operator[]
| const T & operator[] | ( | uint16_t | idx | ) | |
Const version of the index operator.
Parameters:
| idx | The index of the element to obtain. | 
Returns:
A const reference to the element placed at index idx.
quickRemoveAt
| void quickRemoveAt | ( | uint16_t | index | ) | |
Removes an element at the specified index of the Vector.
The last element in the list is moved to the position where the element is removed.
Parameters:
| index | The index to remove. | 
remove
| void remove | ( | T | e | ) | |
removeAt
| T removeAt | ( | uint16_t | index | ) | |
Removes an element at the specified index of the Vector.
Will "bubble-down" any remaining elements after the specified index.
Parameters:
| index | The index to remove. | 
Returns:
The value of the removed element.
reverse
size
| uint16_t size | ( | ) | const | 
Vector
| Vector | ( | ) | 
Default constructor.
Constructs an empty vector.