Change LinkedList to GenLinkedList to avoid conflict

like with AsyncWebServer library
This commit is contained in:
Luc 2016-11-30 10:57:21 +01:00
parent a40192fe67
commit d9ad1f9d3d
3 changed files with 28 additions and 28 deletions

View File

@ -1,5 +1,5 @@
/* /*
LinkedList.h - V1.1 - Generic LinkedList implementation GenLinkedList.h - V1.1 - Generic LinkedList implementation
Works better with FIFO, because LIFO will need to Works better with FIFO, because LIFO will need to
search the entire List to find the last one; search the entire List to find the last one;
@ -11,8 +11,8 @@
*/ */
#ifndef LinkedList_h #ifndef GenLinkedList_h
#define LinkedList_h #define GenLinkedList_h
template<class T> template<class T>
struct ListNode { struct ListNode {
@ -21,7 +21,7 @@ struct ListNode {
}; };
template <typename T> template <typename T>
class LinkedList class GenLinkedList
{ {
protected: protected:
@ -39,26 +39,26 @@ protected:
ListNode<T>* getNode(int index); ListNode<T>* getNode(int index);
public: public:
LinkedList(); GenLinkedList();
~LinkedList(); ~GenLinkedList();
/* /*
Returns current size of LinkedList Returns current size of GenLinkedList
*/ */
virtual int size(); virtual int size();
/* /*
Adds a T object in the specified index; Adds a T object in the specified index;
Unlink and link the LinkedList correcly; Unlink and link the GenLinkedList correcly;
Increment _size Increment _size
*/ */
virtual bool add(int index, T); virtual bool add(int index, T);
/* /*
Adds a T object in the end of the LinkedList; Adds a T object in the end of the GenLinkedList;
Increment _size; Increment _size;
*/ */
virtual bool add(T); virtual bool add(T);
/* /*
Adds a T object in the start of the LinkedList; Adds a T object in the start of the GenLinkedList;
Increment _size; Increment _size;
*/ */
virtual bool unshift(T); virtual bool unshift(T);
@ -95,9 +95,9 @@ public:
}; };
// Initialize LinkedList with false values // Initialize GenLinkedList with false values
template<typename T> template<typename T>
LinkedList<T>::LinkedList() GenLinkedList<T>::GenLinkedList()
{ {
root=NULL; root=NULL;
last=NULL; last=NULL;
@ -110,7 +110,7 @@ LinkedList<T>::LinkedList()
// Clear Nodes and free Memory // Clear Nodes and free Memory
template<typename T> template<typename T>
LinkedList<T>::~LinkedList() GenLinkedList<T>::~GenLinkedList()
{ {
ListNode<T>* tmp; ListNode<T>* tmp;
while(root!=NULL) { while(root!=NULL) {
@ -128,7 +128,7 @@ LinkedList<T>::~LinkedList()
*/ */
template<typename T> template<typename T>
ListNode<T>* LinkedList<T>::getNode(int index) ListNode<T>* GenLinkedList<T>::getNode(int index)
{ {
int _pos = 0; int _pos = 0;
@ -160,13 +160,13 @@ ListNode<T>* LinkedList<T>::getNode(int index)
} }
template<typename T> template<typename T>
int LinkedList<T>::size() int GenLinkedList<T>::size()
{ {
return _size; return _size;
} }
template<typename T> template<typename T>
bool LinkedList<T>::add(int index, T _t) bool GenLinkedList<T>::add(int index, T _t)
{ {
if(index >= _size) { if(index >= _size) {
@ -190,7 +190,7 @@ bool LinkedList<T>::add(int index, T _t)
} }
template<typename T> template<typename T>
bool LinkedList<T>::add(T _t) bool GenLinkedList<T>::add(T _t)
{ {
ListNode<T> *tmp = new ListNode<T>(); ListNode<T> *tmp = new ListNode<T>();
@ -214,7 +214,7 @@ bool LinkedList<T>::add(T _t)
} }
template<typename T> template<typename T>
bool LinkedList<T>::unshift(T _t) bool GenLinkedList<T>::unshift(T _t)
{ {
if(_size == 0) { if(_size == 0) {
@ -233,7 +233,7 @@ bool LinkedList<T>::unshift(T _t)
} }
template<typename T> template<typename T>
bool LinkedList<T>::set(int index, T _t) bool GenLinkedList<T>::set(int index, T _t)
{ {
// Check if index position is in bounds // Check if index position is in bounds
if(index < 0 || index >= _size) { if(index < 0 || index >= _size) {
@ -245,7 +245,7 @@ bool LinkedList<T>::set(int index, T _t)
} }
template<typename T> template<typename T>
T LinkedList<T>::pop() T GenLinkedList<T>::pop()
{ {
if(_size <= 0) { if(_size <= 0) {
return T(); return T();
@ -273,7 +273,7 @@ T LinkedList<T>::pop()
} }
template<typename T> template<typename T>
T LinkedList<T>::shift() T GenLinkedList<T>::shift()
{ {
if(_size <= 0) { if(_size <= 0) {
return T(); return T();
@ -296,7 +296,7 @@ T LinkedList<T>::shift()
} }
template<typename T> template<typename T>
T LinkedList<T>::remove(int index) T GenLinkedList<T>::remove(int index)
{ {
if (index < 0 || index >= _size) { if (index < 0 || index >= _size) {
return T(); return T();
@ -322,7 +322,7 @@ T LinkedList<T>::remove(int index)
template<typename T> template<typename T>
T LinkedList<T>::get(int index) T GenLinkedList<T>::get(int index)
{ {
ListNode<T> *tmp = getNode(index); ListNode<T> *tmp = getNode(index);
@ -330,7 +330,7 @@ T LinkedList<T>::get(int index)
} }
template<typename T> template<typename T>
void LinkedList<T>::clear() void GenLinkedList<T>::clear()
{ {
while(size() > 0) { while(size() > 0) {
shift(); shift();

View File

@ -21,7 +21,7 @@
#ifndef STORESTRINGS_h #ifndef STORESTRINGS_h
#define STORESTRINGS_h #define STORESTRINGS_h
#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
#include "LinkedList.h" #include "GenLinkedList.h"
class STORESTRINGS_CLASS class STORESTRINGS_CLASS
{ {
public: public:
@ -55,7 +55,7 @@ public:
private: private:
int _maxsize; int _maxsize;
int _maxstringlength; int _maxstringlength;
LinkedList<char *> _charlist; GenLinkedList<char *> _charlist;
}; };
#endif #endif

View File

@ -27,7 +27,7 @@
#include <WiFiUdp.h> #include <WiFiUdp.h>
#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
#include <ESP8266WebServer.h> #include <ESP8266WebServer.h>
#include "LinkedList.h" #include "GenLinkedList.h"
#include "storestrings.h" #include "storestrings.h"
#include "command.h" #include "command.h"
#include "bridge.h" #include "bridge.h"
@ -220,7 +220,7 @@ bool WEBINTERFACE_CLASS::processTemplate(const char * filename, STORESTRINGS_CL
return false; return false;
} }
LinkedList<FSFILE> myFileList = LinkedList<FSFILE>(); GenLinkedList<FSFILE> myFileList = GenLinkedList<FSFILE>();
String buffer2send; String buffer2send;
bool header_sent=false; bool header_sent=false;