Voffcon Esp32 device server
 All Classes Functions
LinkedList< T > Class Template Reference

A general linked list ready to be used or Inherited More...

Public Member Functions

 LinkedList ()
 The list constructor More...
 
virtual int size ()
 Returns current size of LinkedList More...
 
virtual bool add (int index, T)
 Adds a T object in the specified index; Unlinkand link the LinkedList correcly; Increment _size More...
 
virtual bool add (T)
 Adds a T object in the end of the LinkedList; Increment _size; More...
 
virtual bool unshift (T)
 Adds a T object in the start of the LinkedList; Increment _size; More...
 
virtual bool set (int index, T)
 Set the object at index, with T; Increment _size; More...
 
virtual T remove (int index)
 Remove object at index; If index is not reachable, returns false; else, decrement _size More...
 
virtual T pop ()
 Remove last object; More...
 
virtual T shift ()
 Remove first object; More...
 
virtual T get (int index)
 Get the index'th element on the list; Return Element if accessible, else, return false; More...
 
virtual void clear ()
 Clear the entire array That is remove all objects from the list and delete them from memory More...
 

Protected Member Functions

ListNode< T > * getNode (int index)
 

Protected Attributes

int _size
 
ListNode< T > * root
 
ListNode< T > * last
 
ListNode< T > * lastNodeGot
 
int lastIndexGot
 
bool isCached
 

Detailed Description

template<typename T>
class LinkedList< T >

A general linked list ready to be used or Inherited

Constructor & Destructor Documentation

template<typename T >
LinkedList< T >::LinkedList ( )

The list constructor

Member Function Documentation

template<typename T>
bool LinkedList< T >::add ( int  index,
_t 
)
virtual

Adds a T object in the specified index; Unlinkand link the LinkedList correcly; Increment _size

Parameters
indexWhere to add the object in the zero based index
TThe object to be added
Returns
Success: true. Fail: false.
template<typename T>
bool LinkedList< T >::add ( _t)
virtual

Adds a T object in the end of the LinkedList; Increment _size;

Parameters
TThe object

Reimplemented in PinWatchList.

template<typename T >
void LinkedList< T >::clear ( )
virtual

Clear the entire array That is remove all objects from the list and delete them from memory

template<typename T >
T LinkedList< T >::get ( int  index)
virtual

Get the index'th element on the list; Return Element if accessible, else, return false;

///

Parameters
indexZero based index if the object in the list
Returns
Success: the object. Fail: A object created with a default constructor
template<typename T >
T LinkedList< T >::pop ( )
virtual

Remove last object;

Returns
The data of the removed object
template<typename T >
T LinkedList< T >::remove ( int  index)
virtual

Remove object at index; If index is not reachable, returns false; else, decrement _size

Parameters
index
Returns
Success: The object which was removed. Fail: an object created with the default constructor
template<typename T>
bool LinkedList< T >::set ( int  index,
_t 
)
virtual

Set the object at index, with T; Increment _size;

Parameters
indexZero based index of where the object is
TThe object which values will be overwritten
Returns
template<typename T >
T LinkedList< T >::shift ( )
virtual

Remove first object;

template<typename T >
int LinkedList< T >::size ( )
virtual

Returns current size of LinkedList

Returns
a int number
template<typename T>
bool LinkedList< T >::unshift ( _t)
virtual

Adds a T object in the start of the LinkedList; Increment _size;

Parameters
TThe object to be added at beginning of list
Returns

The documentation for this class was generated from the following file: