University of Sheffield   

    The Simons
    Component Library

Introduction   Class Hierarchy   Class Listing   Index of Classes   Index of Methods   Header Files  

List.h

00001 
00002 //
00003 //  SCL : Simons Component Library
00004 //
00006 //
00007 //  Filename:   List.h
00008 //  Contents:   List class
00009 //  Author:     Anthony J H Simons
00010 //  Revised:    8 November 2005
00011 
00012 // This software is distributed free in the hope that others will
00013 // find it useful.  However, it comes WITHOUT ANY WARRANTY.  No
00014 // liability can be accepted for software failure, merchantability
00015 // or fitness for a particular purpose.  You can redistribute this
00016 // software in its original form, or in a modified form, provided
00017 // that this disclaimer is retained in the file banner.
00018 
00019 #ifndef SCL_LIST
00020 #define SCL_LIST
00021 
00022 #include "Sequence.h"           // Include the superclass type
00023 #include "ListID.h"             // Include the pointer type
00024 
00036 
00037 class List : public Sequence {
00038 private:
00039         Natural items;
00040         struct Link {
00041                 ObjectID item;
00042                 Link* next;
00043                 Link() : item(null), next(0) {}
00044         } *head;
00045         struct Memo {
00046                 Integer index;
00047                 Link* link;
00048                 Memo(Link* hd) : index(0), link(hd) {}
00049         } *memo;
00050         List(const List&);
00051         Void memoSeek(Integer) const;
00052         Void memoReset() const;
00053 public:
00054         List();
00055         virtual ~List();
00056         List(CollectionID);
00057         virtual ObjectID clone() const;
00058         Natural size() const;
00059         virtual ObjectID first() const;
00060         virtual Void addFirst(ObjectID);
00061         virtual Void removeFirst();
00062         virtual ObjectID getAt(Integer) const;
00063         virtual Void putAt(Integer, ObjectID);
00064         virtual Void addAt(Integer, ObjectID);
00065         virtual Void removeAt(Integer);
00066 };
00067 
00069 
00072 inline ListID::ListID() {}
00073 
00075 inline ListID::~ListID() {}
00076 
00080 inline ListID::ListID(const Null* null) :
00081         SequenceID(null) {}
00082         
00086 inline ListID::ListID(const List* list) :
00087         SequenceID(list) {}
00088         
00092 inline ListID::ListID(const ListID& pointer) :
00093         SequenceID(pointer) {}
00094         
00098 inline ListID& ListID::operator=(const List* list) {
00099         assign(list);
00100         return *this;
00101 }
00102 
00107 inline ListID& ListID::operator=(const ListID& pointer) {
00108         assign(pointer);
00109         return *this;
00110 }
00111 
00112 
00113 #endif
00114 

Generated on Fri May 5 17:17:15 2006 for The Simons Component Library by doxygen1.3