From d9ad1f9d3d241413263ebee7bbbae89886fd7efe Mon Sep 17 00:00:00 2001 From: Luc Date: Wed, 30 Nov 2016 10:57:21 +0100 Subject: [PATCH] Change LinkedList to GenLinkedList to avoid conflict like with AsyncWebServer library --- esp3d/{LinkedList.h => GenLinkedList.h} | 48 ++++++++++++------------- esp3d/storestrings.h | 4 +-- esp3d/webinterface.cpp | 4 +-- 3 files changed, 28 insertions(+), 28 deletions(-) rename esp3d/{LinkedList.h => GenLinkedList.h} (85%) diff --git a/esp3d/LinkedList.h b/esp3d/GenLinkedList.h similarity index 85% rename from esp3d/LinkedList.h rename to esp3d/GenLinkedList.h index 85b2b097..f2051cec 100644 --- a/esp3d/LinkedList.h +++ b/esp3d/GenLinkedList.h @@ -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 search the entire List to find the last one; @@ -11,8 +11,8 @@ */ -#ifndef LinkedList_h -#define LinkedList_h +#ifndef GenLinkedList_h +#define GenLinkedList_h template struct ListNode { @@ -21,7 +21,7 @@ struct ListNode { }; template -class LinkedList +class GenLinkedList { protected: @@ -39,26 +39,26 @@ protected: ListNode* getNode(int index); public: - LinkedList(); - ~LinkedList(); + GenLinkedList(); + ~GenLinkedList(); /* - Returns current size of LinkedList + Returns current size of GenLinkedList */ virtual int size(); /* Adds a T object in the specified index; - Unlink and link the LinkedList correcly; + Unlink and link the GenLinkedList correcly; Increment _size */ 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; */ 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; */ virtual bool unshift(T); @@ -95,9 +95,9 @@ public: }; -// Initialize LinkedList with false values +// Initialize GenLinkedList with false values template -LinkedList::LinkedList() +GenLinkedList::GenLinkedList() { root=NULL; last=NULL; @@ -110,7 +110,7 @@ LinkedList::LinkedList() // Clear Nodes and free Memory template -LinkedList::~LinkedList() +GenLinkedList::~GenLinkedList() { ListNode* tmp; while(root!=NULL) { @@ -128,7 +128,7 @@ LinkedList::~LinkedList() */ template -ListNode* LinkedList::getNode(int index) +ListNode* GenLinkedList::getNode(int index) { int _pos = 0; @@ -160,13 +160,13 @@ ListNode* LinkedList::getNode(int index) } template -int LinkedList::size() +int GenLinkedList::size() { return _size; } template -bool LinkedList::add(int index, T _t) +bool GenLinkedList::add(int index, T _t) { if(index >= _size) { @@ -190,7 +190,7 @@ bool LinkedList::add(int index, T _t) } template -bool LinkedList::add(T _t) +bool GenLinkedList::add(T _t) { ListNode *tmp = new ListNode(); @@ -214,7 +214,7 @@ bool LinkedList::add(T _t) } template -bool LinkedList::unshift(T _t) +bool GenLinkedList::unshift(T _t) { if(_size == 0) { @@ -233,7 +233,7 @@ bool LinkedList::unshift(T _t) } template -bool LinkedList::set(int index, T _t) +bool GenLinkedList::set(int index, T _t) { // Check if index position is in bounds if(index < 0 || index >= _size) { @@ -245,7 +245,7 @@ bool LinkedList::set(int index, T _t) } template -T LinkedList::pop() +T GenLinkedList::pop() { if(_size <= 0) { return T(); @@ -273,7 +273,7 @@ T LinkedList::pop() } template -T LinkedList::shift() +T GenLinkedList::shift() { if(_size <= 0) { return T(); @@ -296,7 +296,7 @@ T LinkedList::shift() } template -T LinkedList::remove(int index) +T GenLinkedList::remove(int index) { if (index < 0 || index >= _size) { return T(); @@ -322,7 +322,7 @@ T LinkedList::remove(int index) template -T LinkedList::get(int index) +T GenLinkedList::get(int index) { ListNode *tmp = getNode(index); @@ -330,7 +330,7 @@ T LinkedList::get(int index) } template -void LinkedList::clear() +void GenLinkedList::clear() { while(size() > 0) { shift(); diff --git a/esp3d/storestrings.h b/esp3d/storestrings.h index 6589f50b..a9012c07 100644 --- a/esp3d/storestrings.h +++ b/esp3d/storestrings.h @@ -21,7 +21,7 @@ #ifndef STORESTRINGS_h #define STORESTRINGS_h #include -#include "LinkedList.h" +#include "GenLinkedList.h" class STORESTRINGS_CLASS { public: @@ -55,7 +55,7 @@ public: private: int _maxsize; int _maxstringlength; - LinkedList _charlist; + GenLinkedList _charlist; }; #endif diff --git a/esp3d/webinterface.cpp b/esp3d/webinterface.cpp index 464f1ed4..8f53b4e3 100644 --- a/esp3d/webinterface.cpp +++ b/esp3d/webinterface.cpp @@ -27,7 +27,7 @@ #include #include #include -#include "LinkedList.h" +#include "GenLinkedList.h" #include "storestrings.h" #include "command.h" #include "bridge.h" @@ -220,7 +220,7 @@ bool WEBINTERFACE_CLASS::processTemplate(const char * filename, STORESTRINGS_CL return false; } - LinkedList myFileList = LinkedList(); + GenLinkedList myFileList = GenLinkedList(); String buffer2send; bool header_sent=false;