University of Sheffield   

    The Simons
    Component Library

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

ObjectID.h

00001 
00002 //
00003 //  SCL : Simons Component Library
00004 //
00006 //
00007 //  Filename:   ObjectID.h
00008 //  Contents:   ObjectID pointer
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_OBJECT_ID
00020 #define SCL_OBJECT_ID
00021 
00022 #include "Basic.h"
00023 
00024 class Null;
00025 class Object;
00026 
00047 
00048 class ObjectID {
00049 private:
00050         static ObjectID nullReference;  // Ensures that null's refcount >= 1
00051 protected:
00052         Object* basicPointer;           
00053         Void assign(const Object*);
00054         Void assign(const ObjectID&);
00055         Void nullPointer(ObjectID) const;
00056         Void typeFailure(ObjectID) const;
00057 public:
00058         ObjectID();
00059         ~ObjectID();
00060         ObjectID(const Null*);
00061         ObjectID(const Object*);
00062         ObjectID(const ObjectID&);
00063         ObjectID& operator=(const Object*);
00064         ObjectID& operator=(const ObjectID&);
00065         Object* operator->() const;
00066         const Object* pointer() const;
00067         friend bool operator==(const ObjectID&, const ObjectID&);
00068         friend bool operator!=(const ObjectID&, const ObjectID&);
00069         template<class T> friend T* toType(const ObjectID&);
00070         template<class T> friend T* tryType(const ObjectID&);
00071 };
00072 
00073 #endif

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