![]() |
Max OS 0.3
|
Dynamically stores an array of elements. More...
#include <vector.h>
Public Types | |
| typedef Type * | iterator |
| The iterator type for the Vector. | |
Public Member Functions | |
| Vector () | |
| ______________________________________Implementation__________________________________________________ | |
| Vector (int size, Type element) | |
| Constructor for Vector. | |
| Vector (const Vector< Type > &other) | |
| Copy constructor for Vector. | |
| Vector (Vector< Type > &&other) | |
| Move constructor for Vector. | |
| ~Vector () | |
| Destructor for Vector, de-allocates the array. | |
| Type & | operator[] (uint32_t index) const |
| Overloads the [] operator to return the element at the index. | |
| Vector< Type > & | operator= (const Vector< Type > &other) |
| Assignment by copy, data is copied into a new buffer stored in this vector. | |
| Vector< Type > & | operator= (Vector< Type > &&other) |
| Assignment by move, data is moved into the buffer stored in this vector and the other vector is cleared. | |
| bool | empty () const |
| Checks if the Vector is empty. | |
| uint32_t | size () const |
| Returns the number of elements in the Vector. | |
| iterator | begin () const |
| Returns the first element of the Vector. | |
| iterator | end () const |
| Returns the last element of the Vector. | |
| iterator | find (Type) const |
| Finds an element in the Vector and returns the iterator of the element. | |
| iterator | push_back (Type) |
| Adds an element to the end of the vector and returns the iterator of the element. | |
| Type | pop_back () |
| Removes the last element from the Vector. | |
| iterator | push_front (Type) |
| Adds an element to the front of the Vector and returns the iterator of the element. | |
| Type | pop_front () |
| Removes the m_first_memory_chunk element from the Vector. | |
| void | erase (Type) |
| Removes all elements from the Vector that are equal to the element. | |
| void | erase (typename Vector< Type >::iterator position) |
| Removes the element at the m_position. | |
| void | clear () |
| Removes all elements from the Vector. | |
| void | reserve (size_t amount) |
| Reserves space in the Vector for a certain amount of elements. | |
| void | increase_size () |
| Increases the size of the Vector by doubling the capacity. | |
| void | iterate (VectorIterationHandler< Type > *) |
| Iterates over the Vector and calls the OnRead function of the handler for each element. | |
| void | iterate (void callback(Type &)) |
| Iterates over the Vector and calls the callback function for each element. | |
Protected Attributes | |
| Type * | m_elements |
| The array of elements. | |
| uint32_t | m_size { 0 } |
| How many elements are currently stored. | |
| uint32_t | m_capacity { 1 } |
| How many elements can be stored without resizing. | |
Dynamically stores an array of elements.
| Type | Type of the Vector |
| MaxOS::common::Vector< Type >::Vector | ( | ) |
______________________________________Implementation__________________________________________________
Constructor for Vector
| Type | Type of the Vector |
Definition at line 88 of file vector.h.
Constructor for Vector.
| Type | Type of the Vector |
Definition at line 102 of file vector.h.
Copy constructor for Vector.
| Type | The type of data to be stored |
| other | The vector to copy from |
Definition at line 120 of file vector.h.
References MaxOS::common::Vector< Type >::m_capacity, MaxOS::common::Vector< Type >::m_elements, and MaxOS::common::Vector< Type >::m_size.
Move constructor for Vector.
| Type | The type of data to be stored |
| other | The vector to copy from |
Definition at line 135 of file vector.h.
| MaxOS::common::Vector< Type >::~Vector | ( | ) |
| Vector< Type >::iterator MaxOS::common::Vector< Type >::begin | ( | ) | const |
| void MaxOS::common::Vector< Type >::clear | ( | ) |
Removes all elements from the Vector.
| Type | Type of the Vector |
Definition at line 461 of file vector.h.
Referenced by MaxOS::common::Map< Key, Value >::clear(), and MaxOS::filesystem::format::ext2::Ext2Directory::read_from_disk().
| bool MaxOS::common::Vector< Type >::empty | ( | ) | const |
Checks if the Vector is empty.
| Type | Type of the Vector |
Definition at line 321 of file vector.h.
Referenced by MaxOS::common::Map< Key, Value >::empty(), and MaxOS::common::BlockingLock::release().
| Vector< Type >::iterator MaxOS::common::Vector< Type >::end | ( | ) | const |
Removes all elements from the Vector that are equal to the element.
| Type | Type of the Vector |
| element | The element to remove |
Definition at line 415 of file vector.h.
References MaxOS::common::Rectangle< Type >::Rectangle().
Referenced by MaxOS::common::Map< Key, Value >::erase(), and MaxOS::common::Map< Key, Value >::erase().
| void MaxOS::common::Vector< Type >::erase | ( | typename Vector< Type >::iterator | position | ) |
Removes the element at the m_position.
| Type | The type of the Vector |
| position | The m_position of the element to remove |
Definition at line 442 of file vector.h.
| Vector< Type >::iterator MaxOS::common::Vector< Type >::find | ( | Type | element | ) | const |
| void MaxOS::common::Vector< Type >::increase_size | ( | ) |
Increases the size of the Vector by doubling the capacity.
| Type | Type of the Vector |
Definition at line 164 of file vector.h.
Referenced by MaxOS::common::Map< Key, Value >::increase_size().
| void MaxOS::common::Vector< Type >::iterate | ( | VectorIterationHandler< Type > * | vector_iteration_handler | ) |
Iterates over the Vector and calls the OnRead function of the handler for each element.
| Type | Type of the Vector |
| vector_iteration_handler | The handler |
Definition at line 471 of file vector.h.
Iterates over the Vector and calls the callback function for each element.
| Type | Type of the Vector |
| callback | The callback function |
Definition at line 488 of file vector.h.
References MaxOS::common::Rectangle< Type >::Rectangle().
Assignment by copy, data is copied into a new buffer stored in this vector.
| Type | Type of the Vector |
| other | The vector to copy from |
Definition at line 221 of file vector.h.
Assignment by move, data is moved into the buffer stored in this vector and the other vector is cleared.
| Type | Type of the Vector |
| other | The vector to copy from |
Definition at line 247 of file vector.h.
Overloads the [] operator to return the element at the index.
| Type | Type of the Vector |
| index | The index of the element |
Definition at line 203 of file vector.h.
| Type MaxOS::common::Vector< Type >::pop_back | ( | ) |
Removes the last element from the Vector.
| Type | Type of the Vector |
Definition at line 350 of file vector.h.
Referenced by MaxOS::common::Map< Key, Value >::pop_back().
| Type MaxOS::common::Vector< Type >::pop_front | ( | ) |
Removes the m_first_memory_chunk element from the Vector.
| Type | Type of the Vector |
Definition at line 390 of file vector.h.
References MaxOS::common::Rectangle< Type >::Rectangle().
Referenced by MaxOS::common::Map< Key, Value >::pop_front(), and MaxOS::common::BlockingLock::release().
| Vector< Type >::iterator MaxOS::common::Vector< Type >::push_back | ( | Type | element | ) |
Adds an element to the end of the vector and returns the iterator of the element.
| Type | Type of the Vector |
| element | The element to add |
Definition at line 333 of file vector.h.
References MaxOS::common::Rectangle< Type >::Rectangle().
Referenced by MaxOS::common::BlockingLock::acquire(), MaxOS::filesystem::format::ext2::InodeHandler::InodeHandler(), MaxOS::common::Map< Key, Value >::insert(), MaxOS::common::Map< Key, Value >::push_back(), and MaxOS::common::EventManager< EventType >::raise_event().
| Vector< Type >::iterator MaxOS::common::Vector< Type >::push_front | ( | Type | element | ) |
Adds an element to the front of the Vector and returns the iterator of the element.
| Type | Type of the Vector |
| element | The element to add |
Definition at line 366 of file vector.h.
References MaxOS::common::Rectangle< Type >::Rectangle().
Referenced by MaxOS::common::Map< Key, Value >::push_front().
Reserves space in the Vector for a certain amount of elements.
| Type | Type of the Vector |
| amount | The amount of elements to reserve space for |
Definition at line 174 of file vector.h.
References MaxOS::common::Rectangle< Type >::Rectangle().
Referenced by MaxOS::common::Map< Key, Value >::reserve().
| uint32_t MaxOS::common::Vector< Type >::size | ( | ) | const |
|
protected |
How many elements can be stored without resizing.
Definition at line 43 of file vector.h.
Referenced by MaxOS::common::Vector< Type >::Vector().
|
protected |
The array of elements.
Definition at line 41 of file vector.h.
Referenced by MaxOS::common::Vector< Type >::Vector().
|
protected |
How many elements are currently stored.
Definition at line 42 of file vector.h.
Referenced by MaxOS::common::Vector< Type >::Vector().