#include <lib/sconfig.h>
Include dependency graph for linkedlist.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Classes | |
class | LinkedList |
List class holding a list of objects derived from LinkedListBase (not thread-safe). More... | |
struct | LinkedListBase |
Base class for linked list item nodes. More... | |
Defines | |
#define | _TemplateLibrary_LinkedList_H_ 1 |
#define | _LLB LinkedListBase<T> |
This is just what these classes implement:
Node res=NULL; mutex.lock(); // <-- before starting to operate on list for(Node *i=list.first(); i; i=i->next) { if(i->name==name) { res=i; break; } } mutex.unlock(); // <-- done with operations on list
// Item types to be queued: struct ServerDesc : LinkedListBase<ServerDesc> { InetAdr address; int port; ServerDesc(const char *str); int connect(); };
And somewhere else, we have the list:
LinkedList<ServerDesc> slist; ServerDesc *sd=new ServerDesc("localhost:22"); slist.append(sd);
It is easy to traverse the list first-to-last or last-to-first using e.g. (first-to-last here):
for(ServerDesc *i=slist.first(); i; i=i->next) i->connect();
(Note that you do not need all the iterator object fuzz.)
Definition in file linkedlist.h.
|
Definition at line 118 of file linkedlist.h. |
|
Definition at line 19 of file linkedlist.h. |