|
Data Structures in C++
|
Doubly-linked list implementation with dynamic memory allocation. More...
#include <ProtectedLinkedList.hpp>
Public Member Functions | |
| string | getName () |
| Provides the name of the data structure as a string representation. More... | |
| ProtectedLinkedList () | |
| ~ProtectedLinkedList () | |
| int | getSize () |
| Outputs the number of elements stored in the structure. More... | |
| bool | isEmpty () |
| Check whether the structure is empty. More... | |
| bool | isFull () |
| Check whether the structure is full. More... | |
Protected Member Functions | |
| Node< T > * | getNode (int index) |
| ProtectedLinkedList (const T data[]) | |
| create the structure and populate it with the data from the array More... | |
| Node< T > * | getFirst () const |
| Node< T > * | getLast () const |
| virtual void | insert (const T val) |
| Insert an element at the end of the list. More... | |
| virtual void | insert (const T val, const int index) |
| Insert an element at the specified position in the list. More... | |
| virtual T | remove (const int index) |
| Remove an element from the list. More... | |
| virtual T | get (const int index) |
| Get the element at the specified position in the list, without removing. More... | |
| virtual Iterator< T > | iterator () |
| Creates an Iterator, an object that allows the sequential access of values in a Linked List without the search overhead. More... | |
Private Attributes | |
| Node< T > * | first |
| Node< T > * | last |
| int | size = 0 |
Doubly-linked list implementation with dynamic memory allocation.
Many methods in this class are protected so the class can be used as an extension for other data structures.
| T | The type of object the data structure will contain |
Definition at line 22 of file ProtectedLinkedList.hpp.
|
inline |
Definition at line 35 of file ProtectedLinkedList.hpp.
|
inline |
Definition at line 39 of file ProtectedLinkedList.hpp.
|
inlineexplicitprotected |
create the structure and populate it with the data from the array
| data | an array with data with which the structure will be |
Definition at line 73 of file ProtectedLinkedList.hpp.
|
inlineprotectedvirtual |
Get the element at the specified position in the list, without removing.
| index | index of the desired element |
Reimplemented in OrderedList< T >, and LinkedList< T >.
Definition at line 182 of file ProtectedLinkedList.hpp.
<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD
|
inlineprotected |
Definition at line 79 of file ProtectedLinkedList.hpp.
|
inlineprotected |
Definition at line 83 of file ProtectedLinkedList.hpp.
|
inlinevirtual |
Provides the name of the data structure as a string representation.
Implements DataStructure.
Reimplemented in LinkedList< T >, OrderedList< T >, and DynamicQueue< T >.
Definition at line 31 of file ProtectedLinkedList.hpp.
|
inlineprotected |
|
inlinevirtual |
Outputs the number of elements stored in the structure.
Implements DataStructure.
Reimplemented in DynamicQueue< T >.
Definition at line 200 of file ProtectedLinkedList.hpp.
|
inlineprotectedvirtual |
Insert an element at the end of the list.
| val | the value to be inserted |
Reimplemented in OrderedList< T >, and LinkedList< T >.
Definition at line 89 of file ProtectedLinkedList.hpp.
|
inlineprotectedvirtual |
Insert an element at the specified position in the list.
| val | the value to be inserted |
| index | position of the list that the element will be inserted on |
Reimplemented in OrderedList< T >, and LinkedList< T >.
Definition at line 96 of file ProtectedLinkedList.hpp.
<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD
|
inlinevirtual |
Check whether the structure is empty.
Implements DataStructure.
Reimplemented in DynamicQueue< T >.
Definition at line 204 of file ProtectedLinkedList.hpp.
|
inlinevirtual |
Check whether the structure is full.
Implements DataStructure.
Reimplemented in DynamicQueue< T >.
Definition at line 208 of file ProtectedLinkedList.hpp.
<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD
|
inlineprotectedvirtual |
Creates an Iterator, an object that allows the sequential access of values in a Linked List without the search overhead.
Reimplemented in LinkedList< T >.
Definition at line 194 of file ProtectedLinkedList.hpp.
<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD
|
inlineprotectedvirtual |
Remove an element from the list.
| index | position of the element to be removed |
Reimplemented in OrderedList< T >, and LinkedList< T >.
Definition at line 151 of file ProtectedLinkedList.hpp.
<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD
|
private |
Definition at line 25 of file ProtectedLinkedList.hpp.
|
private |
Definition at line 26 of file ProtectedLinkedList.hpp.
|
private |
Definition at line 27 of file ProtectedLinkedList.hpp.
1.8.13