|
FreeNOS
|
Simple linked list template class. More...
#include <List.h>
Data Structures | |
| class | Node |
| Represents an item on the List. More... | |
Public Member Functions | |
| List () | |
| Class constructor. | |
| List (const List< T > &lst) | |
| Copy constructor. | |
| virtual | ~List () |
| Class destructor. | |
| void | prepend (T t) |
| Insert an item at the start of the list. | |
| void | append (T t) |
| Insert an item at the end of the list. | |
| virtual int | remove (T t) |
| Remove all items which are equal to the given item. | |
| virtual int | remove (Node *node) |
| Removes the given node from the list. | |
| virtual bool | contains (const T t) const |
| Check whether an element is on the List. | |
| virtual void | clear () |
| Clears the entire List. | |
| Node * | head () |
| Get the first Node on the list. | |
| const Node * | head () const |
| Get the first Node on the List (read-only). | |
| Node * | tail () |
| Get the last Node on the list. | |
| const Node * | tail () const |
| Get the last Node on the List (read-only). | |
| T | first () |
| Get the first value in the list. | |
| const T | first () const |
| Get the first value as constant. | |
| T | last () |
| Get the last value on the list. | |
| const T | last () const |
| Get the last value on the list as constant. | |
| virtual const T * | get (Size position) const |
| Get a pointer to the item at the given position. | |
| virtual const T & | at (Size position) const |
| Get a reference to the item at the given position. | |
| virtual bool | isEmpty () const |
| Check if the List is empty. | |
| Size | size () const |
| Get the size of the list. | |
| Size | count () const |
| Get the number of items on the list. | |
| List & | operator<< (T t) |
| Append operator. | |
| bool | operator== (const List< T > &lst) const |
| Comparison operator. | |
| bool | operator!= (const List< T > &lst) const |
| Inequality operator. | |
Public Member Functions inherited from Sequence< T > | |
| virtual int | insert (const T &item) |
| Adds the given item to the Sequence, if possible. | |
| virtual bool | insert (Size position, const T &item) |
| Inserts the given item at the given position. | |
| virtual void | fill (T value) |
| Fill the Sequence with the given value. | |
| virtual bool | removeAt (Size position) |
| Removes the item at the given position. | |
| 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 | 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. | |
| virtual bool | resize (Size size) |
| Change the size of the Container. | |
Public Member Functions inherited from Comparable< Sequence< T > > | |
| virtual | ~Comparable () |
| Class destructor. | |
Private Attributes | |
| Node * | m_head |
| Head of the List. | |
| Node * | m_tail |
| Tail of the list. | |
| Size | m_count |
| Number of items currently in the List. | |
Simple linked list template class.
Class constructor.
Definition at line 69 of file List.h.
References List< T >::m_count, List< T >::m_head, List< T >::m_tail, and ZERO.
Copy constructor.
| lst | List instance to copy from |
Definition at line 81 of file List.h.
References List< T >::append(), List< T >::m_count, List< T >::m_head, List< T >::m_tail, and ZERO.
Class destructor.
Definition at line 94 of file List.h.
References List< T >::m_head, and List< T >::Node::next.
|
inline |
Insert an item at the end of the list.
| t | Item to insert. |
Definition at line 139 of file List.h.
References List< T >::m_count, List< T >::m_head, List< T >::m_tail, List< T >::Node::next, and List< T >::Node::prev.
Referenced by TestSuite::addTest(), chdir(), SunxiCpuConfig::discover(), ATAController::initialize(), Directory::insert(), List< T >::List(), List< T >::operator<<(), IntelMP::parseEntry(), FileSystemServer::pathHandler(), IntelACPI::scanAPIC(), LinnCreate::setExclude(), String::split(), and ProcessShares::~ProcessShares().
Get a reference to the item at the given position.
| position | Index in the list. |
Implements Sequence< T >.
Definition at line 365 of file List.h.
References List< T >::Node::data, List< T >::m_head, and List< T >::Node::next.
|
inlinevirtual |
Clears the entire List.
Reimplemented from Sequence< T >.
Definition at line 232 of file List.h.
References List< T >::m_count, List< T >::m_head, List< T >::m_tail, List< T >::Node::next, and ZERO.
Referenced by Directory::clear(), IntelACPI::discover(), IntelMP::discover(), and Directory::~Directory().
|
inlinevirtual |
Check whether an element is on the List.
| t | The element to find. |
Reimplemented from Sequence< T >.
Definition at line 219 of file List.h.
References List< T >::m_head, and List< T >::Node::next.
Referenced by Associative< K, V >::compareTo(), HashTable< K, V >::keys(), HashTable< K, V >::keys(), List< T >::operator!=(), List< T >::operator==(), and ProcessShares::~ProcessShares().
Get the number of items on the list.
Implements Container.
Definition at line 402 of file List.h.
References List< T >::m_count.
Referenced by CoreServer::bootAll(), CoreServer::getCoreCount(), List< T >::operator!=(), List< T >::operator==(), MpiHost::parseHostsFile(), CoreServer::prepareCoreInfo(), StdoutReporter::reportBegin(), TAPReporter::reportBegin(), XMLReporter::reportBegin(), CoreServer::setupChannels(), MpiProxy::startLocalProcess(), CoreServer::test(), and IPV4::toAddress().
|
inline |
Get the first value in the list.
Definition at line 292 of file List.h.
References List< T >::Node::data, and List< T >::m_head.
Referenced by ATAController::read().
|
inline |
Get the first value as constant.
Definition at line 304 of file List.h.
References List< T >::Node::data, and List< T >::m_head.
Get a pointer to the item at the given position.
| position | Index in the list |
Implements Sequence< T >.
Definition at line 340 of file List.h.
References List< T >::Node::data, List< T >::m_count, List< T >::m_head, List< T >::Node::next, and ZERO.
Get the first Node on the list.
Definition at line 254 of file List.h.
References List< T >::m_head.
Referenced by HashTable< K, V >::at(), and FileSystemPath::FileSystemPath().
Get the first Node on the List (read-only).
Definition at line 262 of file List.h.
References List< T >::m_head.
|
inlinevirtual |
Check if the List is empty.
Reimplemented from Container.
Definition at line 382 of file List.h.
References List< T >::m_head.
Referenced by ATAController::read().
|
inline |
Get the last value on the list.
Definition at line 316 of file List.h.
References List< T >::Node::data, and List< T >::m_tail.
Referenced by ArgumentParser::parse().
|
inline |
Get the last value on the list as constant.
Definition at line 328 of file List.h.
References List< T >::Node::data, and List< T >::m_tail.
Inequality operator.
Definition at line 434 of file List.h.
References List< T >::contains(), List< T >::count(), List< T >::m_count, List< T >::m_head, and List< T >::Node::next.
Comparison operator.
Definition at line 419 of file List.h.
References List< T >::contains(), List< T >::count(), List< T >::m_count, List< T >::m_head, and List< T >::Node::next.
|
inline |
Insert an item at the start of the list.
| t | Data item to te inserted. |
Definition at line 111 of file List.h.
References List< T >::m_count, List< T >::m_head, List< T >::m_tail, List< T >::Node::next, and List< T >::Node::prev.
Removes the given node from the list.
| node | The Node to remove. |
Definition at line 193 of file List.h.
References List< T >::m_count, List< T >::m_head, List< T >::m_tail, List< T >::Node::next, and List< T >::Node::prev.
|
inlinevirtual |
Remove all items which are equal to the given item.
| t | Item to remove. |
Reimplemented from Sequence< T >.
Definition at line 166 of file List.h.
References List< T >::Node::data, List< T >::m_head, List< T >::Node::next, and List< T >::remove().
Referenced by chdir(), List< T >::remove(), and ProcessManager::unregisterInterruptNotify().
Get the size of the list.
Implements Container.
Definition at line 392 of file List.h.
References List< T >::m_count.
Referenced by ProcessShares::~ProcessShares().
Get the last Node on the list.
Definition at line 272 of file List.h.
References List< T >::m_tail.
Get the last Node on the List (read-only).
Definition at line 280 of file List.h.
References List< T >::m_tail.
Number of items currently in the List.
Definition at line 455 of file List.h.
Referenced by List< T >::append(), List< T >::clear(), List< T >::count(), List< T >::get(), List< T >::List(), List< T >::List(), List< T >::operator!=(), List< T >::operator==(), List< T >::prepend(), List< T >::remove(), and List< T >::size().
Head of the List.
Definition at line 449 of file List.h.
Referenced by List< T >::append(), List< T >::at(), List< T >::clear(), List< T >::contains(), List< T >::first(), List< T >::first(), List< T >::get(), List< T >::head(), List< T >::head(), List< T >::isEmpty(), List< T >::List(), List< T >::List(), List< T >::operator!=(), List< T >::operator==(), List< T >::prepend(), List< T >::remove(), List< T >::remove(), and List< T >::~List().
Tail of the list.
Definition at line 452 of file List.h.
Referenced by List< T >::append(), List< T >::clear(), List< T >::last(), List< T >::last(), List< T >::List(), List< T >::List(), List< T >::prepend(), List< T >::remove(), List< T >::tail(), and List< T >::tail().