|
FreeNOS
|
Vectors are dynamically resizeable Arrays. More...
#include <Vector.h>
Public Member Functions | |
| Vector (Size size=VECTOR_DEFAULT_SIZE) | |
| Constructor. | |
| Vector (const Vector< T > &a) | |
| Copy constructor. | |
| virtual | ~Vector () |
| Destructor. | |
| virtual int | insert (const T &item) |
| Adds the given item to the Vector, if possible. | |
| virtual bool | insert (Size position, const T &item) |
| Inserts the given item at the given position. | |
| virtual const T * | get (Size position) const |
| Returns the item at the given position. | |
| virtual const T & | at (Size position) const |
| Return item at the given position as a reference. | |
| virtual void | clear () |
| Remove all items from the vector. | |
| virtual bool | removeAt (Size position) |
| Removes the item at the given position. | |
| virtual Size | size () const |
| Returns the maximum size of this Vector. | |
| virtual Size | count () const |
| Returns the number of items inside the Vector. | |
| virtual const T * | vector () const |
| Get Vector data pointer. | |
| virtual bool | resize (Size size) |
| Resize the Vector. | |
Public Member Functions inherited from Sequence< T > | |
| virtual void | fill (T value) |
| Fill the Sequence with the given value. | |
| virtual int | remove (T value) |
| Remove all items with the given value. | |
| virtual bool | contains (const T value) const |
| Check if the given item is stored in this Sequence. | |
| virtual int | compareTo (const Sequence< T > &s) const |
| Compare this Sequence to another Sequence. | |
| virtual bool | equals (const Sequence< T > &s) const |
| Test if this Sequence is equal to an other Sequence. | |
| const T & | operator[] (int i) const |
| Returns the item at the given position in the Sequence. | |
| const T & | operator[] (Size i) const |
| Returns the item at the given position in the Sequence. | |
| T & | operator[] (int i) |
| Returns the item at the given position in the Sequence. | |
| T & | operator[] (Size i) |
| Returns the item at the given position in the Sequence. | |
Public Member Functions inherited from Container | |
| Container () | |
| Constructor. | |
| virtual | ~Container () |
| Destructor. | |
| virtual bool | isEmpty () const |
| Check if the Container is empty. | |
| virtual bool | reserve (Size size) |
| Ensure that at least the given size is available. | |
| virtual bool | shrink (Size size) |
| Shrink the container size by the given amount of items. | |
| virtual Size | squeeze () |
| Try to minimize the memory required in the Container. | |
Public Member Functions inherited from Comparable< Sequence< T > > | |
| virtual | ~Comparable () |
| Class destructor. | |
Private Attributes | |
| T * | m_array |
| The actual array where the data is stored. | |
| Size | m_size |
| The maximum size of the array. | |
| Size | m_count |
| Number of used items in the array. | |
Vectors are dynamically resizeable Arrays.
|
inline |
Constructor.
Initializes the Vector with the given Size.
| size | The maximum size of the array |
Definition at line 52 of file Vector.h.
References assert, Vector< T >::m_array, Vector< T >::m_count, Vector< T >::m_size, and Vector< T >::size().
Copy constructor.
| a | Vector reference to copy from. |
Definition at line 66 of file Vector.h.
References assert, Vector< T >::m_array, Vector< T >::m_count, and Vector< T >::m_size.
Return item at the given position as a reference.
| position | Position of the item to get. |
Implements Sequence< T >.
Definition at line 153 of file Vector.h.
References Vector< T >::m_array.
Referenced by ArgumentParser::registerPositional().
|
inlinevirtual |
Remove all items from the vector.
Reimplemented from Sequence< T >.
Definition at line 161 of file Vector.h.
References Vector< T >::m_count.
Returns the number of items inside the Vector.
Implements Container.
Definition at line 204 of file Vector.h.
References Vector< T >::m_count.
Referenced by Cat::exec(), Decompress::exec(), Echo::exec(), BootImageCreate::exec(), ListFiles::exec(), Remove::exec(), Shell::exec(), FileStatus::exec(), SysControl::exec(), CreateFile::exec(), ArgumentContainer::get(), ArgumentParser::getUsage(), Cat::initialize(), ArgumentParser::parse(), ArgumentParser::registerPositional(), ArgumentContainer::~ArgumentContainer(), and ArgumentParser::~ArgumentParser().
Returns the item at the given position.
| position | The position of the item to get. |
Implements Sequence< T >.
Definition at line 139 of file Vector.h.
References Vector< T >::m_array, Vector< T >::m_count, and ZERO.
Referenced by API::invoke().
|
inlinevirtual |
Adds the given item to the Vector, if possible.
| item | The item to add to the Vector. |
Reimplemented from Sequence< T >.
Definition at line 93 of file Vector.h.
References Vector< T >::m_array, Vector< T >::m_count, Vector< T >::m_size, and Vector< T >::resize().
Referenced by ArgumentContainer::addPositional(), API::API(), Kernel::hookIntVector(), LinnFileSystem::LinnFileSystem(), BootImageCreate::readBootSymbols(), ProcessManager::registerInterruptNotify(), and ArgumentParser::registerPositional().
Inserts the given item at the given position.
If an item exists at the given position, it will be replaced by the given item.
| position | The position to insert the item. |
| item | The item to insert |
Reimplemented from Sequence< T >.
Definition at line 113 of file Vector.h.
References Vector< T >::m_array, Vector< T >::m_count, Vector< T >::m_size, and Vector< T >::resize().
Removes the item at the given position.
| position | The position of the item to remove. |
Reimplemented from Sequence< T >.
Definition at line 173 of file Vector.h.
References Vector< T >::m_array, and Vector< T >::m_count.
Resize the Vector.
| size | New size of the Vector |
Reimplemented from Container.
Definition at line 224 of file Vector.h.
References assert, Vector< T >::m_array, Vector< T >::m_size, and Vector< T >::size().
Referenced by Vector< T >::insert(), and Vector< T >::insert().
Returns the maximum size of this Vector.
Implements Container.
Definition at line 194 of file Vector.h.
References Vector< T >::m_size.
Referenced by Vector< T >::resize(), ProcessManager::unregisterInterruptNotify(), and Vector< T >::Vector().
|
inlinevirtual |
Get Vector data pointer.
Definition at line 214 of file Vector.h.
References Vector< T >::m_array.
|
private |
The actual array where the data is stored.
Definition at line 247 of file Vector.h.
Referenced by Vector< T >::at(), Vector< T >::get(), Vector< T >::insert(), Vector< T >::insert(), Vector< T >::removeAt(), Vector< T >::resize(), Vector< T >::vector(), Vector< T >::Vector(), Vector< T >::Vector(), and Vector< T >::~Vector().
Number of used items in the array.
Definition at line 253 of file Vector.h.
Referenced by Vector< T >::clear(), Vector< T >::count(), Vector< T >::get(), Vector< T >::insert(), Vector< T >::insert(), Vector< T >::removeAt(), Vector< T >::Vector(), and Vector< T >::Vector().
The maximum size of the array.
Definition at line 250 of file Vector.h.
Referenced by Vector< T >::insert(), Vector< T >::insert(), Vector< T >::resize(), Vector< T >::size(), Vector< T >::Vector(), and Vector< T >::Vector().