00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "eyedb_p.h"
00026
00027 namespace eyedb {
00028
00029 int CollectionPeer::coherent = Collection::coherent,
00030 CollectionPeer::added = Collection::added,
00031 CollectionPeer::removed = Collection::removed;
00032
00033 CollSet *CollectionPeer::collSet(const char *name,
00034 const CollImpl *collimpl)
00035 {
00036 return new CollSet(name, 0, True, collimpl);
00037 }
00038
00039 CollSet *CollectionPeer::collSet(const char *name, Class *cls,
00040 const Oid& idx1_oid,
00041 const Oid& idx2_oid, int icnt,
00042 int bottom, int top,
00043 const CollImpl *collimpl,
00044 Object *card,
00045 Bool is_literal,
00046 Bool is_pure_literal,
00047 Data idx_data, Size idx_data_size)
00048 {
00049 return new CollSet(name, cls, idx1_oid, idx2_oid, icnt,
00050 bottom, top, collimpl, card, is_literal, is_pure_literal, idx_data, idx_data_size);
00051 }
00052
00053 CollBag *CollectionPeer::collBag(const char *name,
00054 const CollImpl *collimpl)
00055 {
00056 return new CollBag(name, 0, True, collimpl);
00057 }
00058
00059 CollBag *CollectionPeer::collBag(const char *name, Class *cls,
00060 const Oid& idx1_oid,
00061 const Oid& idx2_oid, int icnt,
00062 int bottom, int top,
00063 const CollImpl *collimpl,
00064 Object *card,
00065 Bool is_literal,
00066 Bool is_pure_literal,
00067 Data idx_data, Size idx_data_size)
00068 {
00069 return new CollBag(name, cls, idx1_oid, idx2_oid, icnt,
00070 bottom, top, collimpl, card, is_literal, is_pure_literal, idx_data, idx_data_size);
00071 }
00072
00073 CollList *CollectionPeer::collList(const char *name,
00074 const CollImpl *collimpl)
00075 {
00076 return new CollList(name, 0, True, collimpl);
00077 }
00078
00079 CollList *CollectionPeer::collList(const char *name, Class *cls,
00080 const Oid& idx1_oid,
00081 const Oid& idx2_oid, int icnt,
00082 int bottom, int top,
00083 const CollImpl *collimpl,
00084 Object *card,
00085 Bool is_literal,
00086 Bool is_pure_literal,
00087 Data idx_data, Size idx_data_size)
00088 {
00089 return new CollList(name, cls, idx1_oid, idx2_oid, icnt,
00090 bottom, top, collimpl, card, is_literal, is_pure_literal, idx_data, idx_data_size);
00091 }
00092
00093 CollArray *CollectionPeer::collArray(const char *name,
00094 const CollImpl *collimpl)
00095 {
00096 return new CollArray(name, 0, True, collimpl);
00097 }
00098
00099 CollArray *CollectionPeer::collArray(const char *name, Class *cls,
00100 const Oid& idx1_oid,
00101 const Oid& idx2_oid, int icnt,
00102 int bottom, int top,
00103 const CollImpl *collimpl,
00104 Object *card,
00105 Bool is_literal,
00106 Bool is_pure_literal,
00107 Data idx_data, Size idx_data_size)
00108 {
00109 return new CollArray(name, cls, idx1_oid, idx2_oid, icnt,
00110 bottom, top, collimpl, card, is_literal, is_pure_literal, idx_data, idx_data_size);
00111 }
00112
00113 void CollectionPeer::setLock(Collection *coll, Bool locked)
00114 {
00115 coll->locked = locked;
00116 }
00117
00118 void CollectionPeer::setInvOid(Collection *coll, const Oid& inv_oid,
00119 int inv_item)
00120 {
00121 coll->inv_oid = inv_oid;
00122 coll->inv_item = inv_item;
00123 }
00124
00125 Bool CollectionPeer::isLocked(Collection *coll)
00126 {
00127 Database *db = coll->getDatabase();
00128 return IDBBOOL(coll->locked && (!db || !(db->getOpenFlag() & _DBAdmin)));
00129 }
00130 }