diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2016-09-18 15:45:13 +0000 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2016-09-18 15:45:13 +0000 |
commit | 2fce43d484e4148ae858f410d51dcd9951d34374 (patch) | |
tree | 80c204799cd38349b3bb209d4d37962b11aa6222 /omegalib/omega_lib/include/basic/SimpleList.h | |
parent | f433eae7a1408cca20f3b72fb4c136d9b62de3b8 (diff) | |
download | chill-2fce43d484e4148ae858f410d51dcd9951d34374.tar.gz chill-2fce43d484e4148ae858f410d51dcd9951d34374.tar.bz2 chill-2fce43d484e4148ae858f410d51dcd9951d34374.zip |
remove include & rename
Diffstat (limited to 'omegalib/omega_lib/include/basic/SimpleList.h')
-rw-r--r-- | omegalib/omega_lib/include/basic/SimpleList.h | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/omegalib/omega_lib/include/basic/SimpleList.h b/omegalib/omega_lib/include/basic/SimpleList.h deleted file mode 100644 index a08b307..0000000 --- a/omegalib/omega_lib/include/basic/SimpleList.h +++ /dev/null @@ -1,93 +0,0 @@ -#if ! defined _Simple_List_h -#define _Simple_List_h 1 - -/* - * Linked lists with an interface like a bit of libg++'s SLSimple_List class - */ - -#include <assert.h> -#include <basic/Iterator.h> -#include <basic/Collection.h> -#include <basic/Link.h> - -namespace omega { - -#define Simple_List Omega_Simple_List -#define Simple_List_Iterator Omega_Simple_List_Iterator - -template<class T> class Simple_List_Iterator; - -// A TEMPORARY HACK - ERROR IF YOU TRY TO USE "INDEX" - FERD - -template<class T> class Simple_List : public Sequence<T> { -public: - Simple_List(const Simple_List<T> &l) - { contents = l.contents ? new List_Element<T>(*l.contents) : 0; } - Simple_List() { contents = 0; } - virtual ~Simple_List() { delete contents; } - - Iterator<T> *new_iterator(); - const T &operator[](int) const; - T &operator[](int); - - - int size() const; - int length() const { return size(); } - int empty() const { return size() == 0; } - - T &front() const; - -// insertion/deletion on a list invalidates any iterators -// that are on/after the element added/removed - - T remove_front(); - - void prepend(const T &item); - void append(const T &item); - - void del_front(); - void clear(); - - void join(Simple_List<T> &consumed); - - int index(const T &) const { - assert(0&&"ILLEGAL SimpleList operation\n"); - return -1; - } - -private: - friend class Simple_List_Iterator<T>; - List_Element<T> **end() - { - List_Element<T> **e = &contents; - while (*e) - e = &((*e)->tail); - return e; - } - - List_Element<T> *contents; -}; - - -template<class T> class Simple_List_Iterator : public List_Element_Iterator<T> { -public: - Simple_List_Iterator(Simple_List<T> &l); - Simple_List_Iterator(const Simple_List<T> &l); - Simple_List_Iterator(); -private: - List_Element<T> &element() { return *this->i; } ; - friend class Simple_List<T>; -}; - -} // namespace - -#if ! defined DONT_INCLUDE_TEMPLATE_CODE -#include <basic/SimpleList.c> -#endif - -#define instantiate_Simple_List(T) template class Simple_List<T>; \ - template class Simple_List_Iterator<T>; \ - instantiate_Only_List_Element(T) \ - instantiate_Sequence(T) - -#endif |