![]() |
The Simons
|
00001 00002 // 00003 // SCL : Simons Component Library 00004 // 00006 // 00007 // Filename: Relation.h 00008 // Contents: Relation class 00009 // Author: Anthony J H Simons 00010 // Revised: 5 January 2006 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_RELATION 00020 #define SCL_RELATION 00021 00022 #include "Bag.h" // Include my superclass type 00023 #include "RelationID.h" // Include my pointer type 00024 00025 #include "SetID.h" // Depends on the pointer type 00026 00047 00048 class Relation : public Bag { 00049 protected: 00050 Relation(const Relation&); 00051 public: 00052 Relation(); 00053 virtual ~Relation(); 00054 Relation(CollectionID); 00055 virtual ObjectID clone() const; 00056 virtual Void add(ObjectID); 00057 virtual Void remove(ObjectID); 00058 virtual Void retainAll(CollectionID); 00059 Void addAt(ObjectID, ObjectID); 00060 Void removeAt(ObjectID); 00061 SetID getAt(ObjectID) const; 00062 SetID domain() const; 00063 SetID range() const; 00064 ObjectID domain(Integer) const; 00065 ObjectID range(Integer) const; 00066 RelationID compose(RelationID) const; 00067 }; 00068 00070 00073 inline RelationID::RelationID() {} 00074 00076 inline RelationID::~RelationID() {} 00077 00081 inline RelationID::RelationID(const Null* null) : 00082 BagID(null) {} 00083 00087 inline RelationID::RelationID(const Relation* relation) : 00088 BagID(relation) {} 00089 00093 inline RelationID::RelationID(const RelationID& pointer) : 00094 BagID(pointer) {} 00095 00099 inline RelationID& RelationID::operator=(const Relation* relation) { 00100 assign(relation); 00101 return *this; 00102 } 00103 00108 inline RelationID& RelationID::operator=(const RelationID& pointer) { 00109 assign(pointer); 00110 return *this; 00111 } 00112 00113 #endif 00114