FreeNOS
|
Vectors are dynamically resizeable Arrays. More...
#include <Vector.h>
Public Member Functions | |
Vector (Size size=VECTOR_DEFAULT_SIZE) | |
Constructor. More... | |
Vector (const Vector< T > &a) | |
Copy constructor. More... | |
virtual | ~Vector () |
Destructor. More... | |
virtual int | insert (const T &item) |
Adds the given item to the Vector, if possible. More... | |
virtual bool | insert (Size position, const T &item) |
Inserts the given item at the given position. More... | |
virtual const T * | get (Size position) const |
Returns the item at the given position. More... | |
virtual const T & | at (Size position) const |
Return item at the given position as a reference. More... | |
virtual void | clear () |
Remove all items from the vector. More... | |
virtual bool | removeAt (Size position) |
Removes the item at the given position. More... | |
virtual Size | size () const |
Returns the maximum size of this Vector. More... | |
virtual Size | count () const |
Returns the number of items inside the Vector. More... | |
virtual const T * | vector () const |
Get Vector data pointer. More... | |
virtual bool | resize (Size size) |
Resize the Vector. More... | |
Public Member Functions inherited from Sequence< T > | |
virtual void | fill (T value) |
Fill the Sequence with the given value. More... | |
virtual int | remove (T value) |
Remove all items with the given value. More... | |
virtual bool | contains (const T value) const |
Check if the given item is stored in this Sequence. More... | |
virtual int | compareTo (const Sequence< T > &s) const |
Compare this Sequence to another Sequence. More... | |
virtual bool | equals (const Sequence< T > &s) const |
Test if this Sequence is equal to an other Sequence. More... | |
const T & | operator[] (int i) const |
Returns the item at the given position in the Sequence. More... | |
const T & | operator[] (Size i) const |
Returns the item at the given position in the Sequence. More... | |
T & | operator[] (int i) |
Returns the item at the given position in the Sequence. More... | |
T & | operator[] (Size i) |
Returns the item at the given position in the Sequence. More... | |
Public Member Functions inherited from Container | |
Container () | |
Constructor. More... | |
virtual | ~Container () |
Destructor. More... | |
virtual bool | isEmpty () const |
Check if the Container is empty. More... | |
virtual bool | reserve (Size size) |
Ensure that at least the given size is available. More... | |
virtual bool | shrink (Size size) |
Shrink the container size by the given amount of items. More... | |
virtual Size | squeeze () |
Try to minimize the memory required in the Container. More... | |
Public Member Functions inherited from Comparable< Sequence< T > > | |
virtual | ~Comparable () |
Class destructor. More... | |
Private Attributes | |
T * | m_array |
The actual array where the data is stored. More... | |
Size | m_size |
The maximum size of the array. More... | |
Size | m_count |
Number of used items in the array. More... | |
Vectors are dynamically resizeable Arrays.
|
inline |
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.
Referenced by ArgumentParser::registerPositional().
|
inlinevirtual |
Remove all items from the vector.
Reimplemented from Sequence< T >.
Returns the number of items inside the Vector.
Implements Container.
Definition at line 204 of file Vector.h.
Referenced by Decompress::exec(), Echo::exec(), FileStatus::exec(), CreateFile::exec(), ListFiles::exec(), Remove::exec(), SysControl::exec(), Shell::exec(), Cat::exec(), BootImageCreate::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.
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.
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 >.
Removes the item at the given position.
position | The position of the item to remove. |
Reimplemented from Sequence< T >.
Returns the maximum size of this Vector.
Implements Container.
Definition at line 194 of file Vector.h.
Referenced by Vector< Argument * >::resize(), ProcessManager::unregisterInterruptNotify(), and Vector< Argument * >::Vector().
|
inlinevirtual |
|
private |
The actual array where the data is stored.
Definition at line 247 of file Vector.h.
Referenced by Vector< Argument * >::at(), Vector< Argument * >::get(), Vector< Argument * >::insert(), Vector< Argument * >::removeAt(), Vector< Argument * >::resize(), Vector< Argument * >::Vector(), Vector< Argument * >::vector(), and Vector< Argument * >::~Vector().
Number of used items in the array.
Definition at line 253 of file Vector.h.
Referenced by Vector< Argument * >::clear(), Vector< Argument * >::count(), Vector< Argument * >::get(), Vector< Argument * >::insert(), Vector< Argument * >::removeAt(), and Vector< Argument * >::Vector().
The maximum size of the array.
Definition at line 250 of file Vector.h.
Referenced by Vector< Argument * >::insert(), Vector< Argument * >::resize(), Vector< Argument * >::size(), and Vector< Argument * >::Vector().