University of Sheffield   

    The Simons
    Component Library

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

Collection.h

00001 
00002 //
00003 //  SCL : Simons Component Library
00004 //
00006 //
00007 //  Filename:   Collection.h
00008 //  Contents:   Collection class
00009 //  Author:     Anthony J H Simons
00010 //  Revised:    31 October 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_COLLECTION
00020 #define SCL_COLLECTION
00021 
00022 #include "Object.h"             // Include my superclass type
00023 #include "CollectionID.h"       // Include my pointer type
00024 
00025 #include "StringID.h"           // Depends on the pointer types
00026 #include "OutOfRangeID.h"
00027 #include "ReaderID.h"
00028 #include "WriterID.h"
00029 
00045 class Collection : public Object {
00046 protected:
00047         Collection(const Collection&);
00048         Void rangeExceeded(StringID, Integer) const;
00049         Void hasNoElements(StringID) const;
00050         Void hasNoElements(StringID, OutOfRangeID) const;
00051 public:
00052         Collection();
00053         virtual ~Collection();
00054         virtual Void readOn(ReaderID);
00055         virtual Void writeOn(WriterID) const;
00056         virtual Natural size() const;
00057         Boolean empty() const;
00058         virtual Boolean has(ObjectID) const;
00059         virtual ObjectID item(Integer) const;
00060         virtual Void add(ObjectID);
00061         virtual Void addAll(CollectionID);
00062 };
00063 
00065 
00068 inline CollectionID::CollectionID() {}
00069 
00071 inline CollectionID::~CollectionID() {}
00072 
00076 inline CollectionID::CollectionID(const Null* null) :
00077         ObjectID(null) {}
00078         
00082 inline CollectionID::CollectionID(const Collection* collection) :
00083         ObjectID(collection) {}
00084         
00088 inline CollectionID::CollectionID(const CollectionID& pointer) :
00089         ObjectID(pointer) {}
00090         
00094 inline CollectionID& CollectionID::operator=(const Collection* collection) {
00095         assign(collection);
00096         return *this;
00097 }
00098 
00103 inline CollectionID& CollectionID::operator=(const CollectionID& pointer) {
00104         assign(pointer);
00105         return *this;
00106 }
00107 
00108 
00109 #endif

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