00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __CONTAINER_H__
00012 #define __CONTAINER_H__
00013
00018 class FASTDB_DLL_ENTRY dbAnyContainer : public dbAnyReference {
00019 protected:
00020 dbFieldDescriptor* fd;
00021
00022 void create(dbDatabase& db);
00023 void purge(dbDatabase& db);
00024 void free(dbDatabase& db);
00025 void add(dbDatabase& db, dbAnyReference const& ref);
00026 void remove(dbDatabase& db, dbAnyReference const& ref);
00027 int search(dbAnyCursor& cursor, void const* from, void const* till);
00028
00029 dbAnyContainer(char const* fieldName, dbTableDescriptor& desc);
00030 };
00031
00032
00036 template<class T>
00037 class dbContainer : public dbAnyContainer {
00038 public:
00046 int search(dbCursor<T>& cursor, void const* from, void const* till) {
00047 return dbAnyContainer::search(cursor, from, till);
00048 }
00055 int search(dbCursor<T>& cursor, void const* key) {
00056 return dbAnyContainer::search(cursor, key, key);
00057 }
00058
00064 int search(dbCursor<T>& cursor) {
00065 return dbAnyContainer::search(cursor, NULL, NULL);
00066 }
00067
00071 void create() {
00072 dbAnyContainer::create(T::dbDescriptor.db);
00073 }
00074
00078 void purge() {
00079 dbAnyContainer::purge(T::dbDescriptor.db);
00080 }
00081
00085 void free() {
00086 dbAnyContainer::free(T::dbDescriptor.db);
00087 }
00088
00093 void add(dbReference<T> const& ref) {
00094 dbAnyContainer::add(T::dbDescriptor.db, ref);
00095 }
00096
00101 void remove(dbReference<T> const& ref) {
00102 dbAnyContainer::remove(T::dbDescriptor.db, ref);
00103 }
00104
00109 dbContainer(const char* fieldName) : dbAnyContainer(fieldName, T::dbDescriptor) {}
00110 };
00111
00112 #endif
00113
00114
00115
00116