From: Eric C. <eri...@us...> - 2002-04-24 20:18:55
|
Update of /cvsroot/zoolib/zoolib/src_other/ZDBase In directory usw-pr-cvs1:/tmp/cvs-serv3020/zoolib/src_other/ZDBase Modified Files: ZDBase.cpp Log Message: Removed class ZVectorP and replaced all occurrences of ZVectorP<...> with vector<...*>. Index: ZDBase.cpp =================================================================== RCS file: /cvsroot/zoolib/zoolib/src_other/ZDBase/ZDBase.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ZDBase.cpp 19 Mar 2002 20:10:25 -0000 1.3 --- ZDBase.cpp 24 Apr 2002 20:18:49 -0000 1.4 *************** *** 767,771 **** { this->Flush(); ! for (ZVectorP<ZDBTable>::iterator i = fTables.begin(); i != fTables.end(); ++i) delete *i; } --- 767,771 ---- { this->Flush(); ! for (vector<ZDBTable*>::iterator i = fTables.begin(); i != fTables.end(); ++i) delete *i; } *************** *** 793,798 **** void ZDBDatabase::DeleteTable(ZDBTable* inTable) { ! ZVectorP<ZDBTable>::iterator foundIter = fTables.end(); ! for (ZVectorP<ZDBTable>::iterator i = fTables.begin(); i != fTables.end(); ++i) { if (*i == inTable) --- 793,798 ---- void ZDBDatabase::DeleteTable(ZDBTable* inTable) { ! vector<ZDBTable*>::iterator foundIter = fTables.end(); ! for (vector<ZDBTable*>::iterator i = fTables.begin(); i != fTables.end(); ++i) { if (*i == inTable) *************** *** 809,813 **** ZDBTable* ZDBDatabase::GetTable(const string& inName) { ! for (ZVectorP<ZDBTable>::iterator i = fTables.begin(); i != fTables.end(); ++i) { if (inName == (*i)->GetTableName()) --- 809,813 ---- ZDBTable* ZDBDatabase::GetTable(const string& inName) { ! for (vector<ZDBTable*>::iterator i = fTables.begin(); i != fTables.end(); ++i) { if (inName == (*i)->GetTableName()) *************** *** 817,821 **** } ! void ZDBDatabase::GetTableVector(ZVectorP<ZDBTable>& outTableVector) const { // We don't return a reference as we will not always be using a vector internally --- 817,822 ---- } ! //void ZDBDatabase::GetTableVector(vector<ZDBTable*>& outTableVector) const ! void ZDBDatabase::GetTableVector(vector<ZDBTable*>& outTableVector) const { // We don't return a reference as we will not always be using a vector internally *************** *** 838,842 **** if (fDirty) this->WriteBack(); ! for (ZVectorP<ZDBTable>::iterator i = fTables.begin(); i != fTables.end(); ++i) (*i)->Flush(); fBlockStore->Flush(); --- 839,843 ---- if (fDirty) this->WriteBack(); ! for (vector<ZDBTable*>::iterator i = fTables.begin(); i != fTables.end(); ++i) (*i)->Flush(); fBlockStore->Flush(); *************** *** 850,854 **** bool allGood = true; ! for (ZVectorP<ZDBTable>::iterator i = fTables.begin(); i != fTables.end(); ++i) { if (!(*i)->ValidateQuick(iProgressWatcher)) --- 851,855 ---- bool allGood = true; ! for (vector<ZDBTable*>::iterator i = fTables.begin(); i != fTables.end(); ++i) { if (!(*i)->ValidateQuick(iProgressWatcher)) *************** *** 866,870 **** if (inProgressWatcher) inProgressWatcher->Push("Checking tables", fTables.size()); ! for (ZVectorP<ZDBTable>::iterator i = fTables.begin(); i != fTables.end(); ++i) (*i)->ValidateAndFix(inProgressWatcher); if (inProgressWatcher) --- 867,871 ---- if (inProgressWatcher) inProgressWatcher->Push("Checking tables", fTables.size()); ! for (vector<ZDBTable*>::iterator i = fTables.begin(); i != fTables.end(); ++i) (*i)->ValidateAndFix(inProgressWatcher); if (inProgressWatcher) *************** *** 883,887 **** theStream.WriteInt32(fRefCon); theStream.WriteInt32(fTables.size()); ! for (ZVectorP<ZDBTable>::iterator i = fTables.begin(); i != fTables.end(); ++i) theStream.WriteUInt32((*i)->GetHeaderBlockHandle()); --- 884,888 ---- theStream.WriteInt32(fRefCon); theStream.WriteInt32(fTables.size()); ! for (vector<ZDBTable*>::iterator i = fTables.begin(); i != fTables.end(); ++i) theStream.WriteUInt32((*i)->GetHeaderBlockHandle()); *************** *** 893,897 **** { // Ensure that our list is empty -- this should really only be called once anyway, at construct time ! for (ZVectorP<ZDBTable>::iterator i = fTables.begin(); i != fTables.end(); ++i) delete *i; fTables.erase(fTables.begin(), fTables.end()); --- 894,898 ---- { // Ensure that our list is empty -- this should really only be called once anyway, at construct time ! for (vector<ZDBTable*>::iterator i = fTables.begin(); i != fTables.end(); ++i) delete *i; fTables.erase(fTables.begin(), fTables.end()); *************** *** 936,940 **** ZDBIndex* theIndex(inTreeItem->GetIndex()); ! const ZVectorP<ZDBFieldRep>& fieldReps(inTreeItem->GetFieldReps()); const vector<ZDBFieldName>& fieldNames(theIndex->GetIndexedFieldNames()); --- 937,941 ---- ZDBIndex* theIndex(inTreeItem->GetIndex()); ! const vector<ZDBFieldRep*>& fieldReps(inTreeItem->GetFieldReps()); const vector<ZDBFieldName>& fieldNames(theIndex->GetIndexedFieldNames()); *************** *** 947,951 **** // keeps its ZDBFieldReps in the same order (sort order) as the index keeps its field IDs fFieldList.reserve(fieldReps.size()); ! ZVectorP<ZDBFieldRep>::const_iterator fieldRepIterator = fieldReps.begin(); vector<ZDBFieldName>::const_iterator fieldNameIterator = fieldNames.begin(); for (;fieldRepIterator != fieldReps.end(); ++fieldRepIterator, ++fieldNameIterator) --- 948,952 ---- // keeps its ZDBFieldReps in the same order (sort order) as the index keeps its field IDs fFieldList.reserve(fieldReps.size()); ! vector<ZDBFieldRep*>::const_iterator fieldRepIterator = fieldReps.begin(); vector<ZDBFieldName>::const_iterator fieldNameIterator = fieldNames.begin(); for (;fieldRepIterator != fieldReps.end(); ++fieldRepIterator, ++fieldNameIterator) *************** *** 980,984 **** // Walk our field list telling each to allocate its extra storage. This only affects // DBFieldBLOB, as it keeps its data in a separate block ! for (ZVectorP<ZDBField>::iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) (*x)->CreateExtraStorage(fTable->GetBlockStore()); --- 981,985 ---- // Walk our field list telling each to allocate its extra storage. This only affects // DBFieldBLOB, as it keeps its data in a separate block ! for (vector<ZDBField*>::iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) (*x)->CreateExtraStorage(fTable->GetBlockStore()); *************** *** 991,995 **** { // Delete our owned fields ! for (ZVectorP<ZDBField>::iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) delete (*x); } --- 992,996 ---- { // Delete our owned fields ! for (vector<ZDBField*>::iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) delete (*x); } *************** *** 1053,1057 **** ZDBField* theField = nil; ! for (ZVectorP<ZDBField>::const_iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) { if ((*x)->GetFieldName() == inFieldName) --- 1054,1058 ---- ZDBField* theField = nil; ! for (vector<ZDBField*>::const_iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) { if ((*x)->GetFieldName() == inFieldName) *************** *** 1069,1073 **** ZDBField* theField = nil; ! for (ZVectorP<ZDBField>::const_iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) { if ((*x)->GetFieldName() == inFieldName) --- 1070,1074 ---- ZDBField* theField = nil; ! for (vector<ZDBField*>::const_iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) { if ((*x)->GetFieldName() == inFieldName) *************** *** 1081,1085 **** } ! const ZVectorP<ZDBField>& ZDBRecord::GetFields() const { return fFieldList; } --- 1082,1086 ---- } ! const vector<ZDBField*>& ZDBRecord::GetFields() const { return fFieldList; } *************** *** 1100,1111 **** // Used (currently) when we're making a new table based on the contents of an old one ! const ZVectorP<ZDBField>& otherFields(inOther->GetFields()); ! for (ZVectorP<ZDBField>::iterator myIter = fFieldList.begin(); myIter != fFieldList.end(); ++myIter) { ZDBField* myField = *myIter; if (!inCopyRecordID && (myField->GetFieldName() == ZDBFieldName::ID)) continue; ! for (ZVectorP<ZDBField>::const_iterator otherIter = otherFields.begin(); otherIter != otherFields.end(); ++otherIter) { ZDBField* otherField = *otherIter; --- 1101,1112 ---- // Used (currently) when we're making a new table based on the contents of an old one ! const vector<ZDBField*>& otherFields(inOther->GetFields()); ! for (vector<ZDBField*>::iterator myIter = fFieldList.begin(); myIter != fFieldList.end(); ++myIter) { ZDBField* myField = *myIter; if (!inCopyRecordID && (myField->GetFieldName() == ZDBFieldName::ID)) continue; ! for (vector<ZDBField*>::const_iterator otherIter = otherFields.begin(); otherIter != otherFields.end(); ++otherIter) { ZDBField* otherField = *otherIter; *************** *** 1137,1141 **** long dummy = inStream.ReadInt32(); ! for (ZVectorP<ZDBField>::iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) (*x)->FromStream(inStream); fDirty = false; --- 1138,1142 ---- long dummy = inStream.ReadInt32(); ! for (vector<ZDBField*>::iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) (*x)->FromStream(inStream); fDirty = false; *************** *** 1147,1151 **** inStream.WriteInt32(0); ! for (ZVectorP<ZDBField>::iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) (*x)->ToStream(inStream); fDirty = false; --- 1148,1152 ---- inStream.WriteInt32(0); ! for (vector<ZDBField*>::iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) (*x)->ToStream(inStream); fDirty = false; *************** *** 1154,1158 **** bool ZDBRecord::CheckAllFieldsOkay() { ! for (ZVectorP<ZDBField>::iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) { if (!(*x)->CheckExtraStorageOkay(fTable->GetBlockStore())) --- 1155,1159 ---- bool ZDBRecord::CheckAllFieldsOkay() { ! for (vector<ZDBField*>::iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) { if (!(*x)->CheckExtraStorageOkay(fTable->GetBlockStore())) *************** *** 1176,1183 **** // Walk our list of fields, compare each against the other's matching field ! for (ZVectorP<ZDBField>::const_iterator i = fFieldList.begin(); i != fFieldList.end(); ++i) { bool gotIt = false; ! for (ZVectorP<ZDBField>::const_iterator j = inRecord->fFieldList.begin(); j != inRecord->fFieldList.end(); ++j) { if ((*i)->GetFieldName() == (*j)->GetFieldName()) --- 1177,1184 ---- // Walk our list of fields, compare each against the other's matching field ! for (vector<ZDBField*>::const_iterator i = fFieldList.begin(); i != fFieldList.end(); ++i) { bool gotIt = false; ! for (vector<ZDBField*>::const_iterator j = inRecord->fFieldList.begin(); j != inRecord->fFieldList.end(); ++j) { if ((*i)->GetFieldName() == (*j)->GetFieldName()) *************** *** 1207,1216 **** // Walk our list of fields, compare each against the other's matching field ! for (ZVectorP<ZDBField>::const_iterator i = first->fFieldList.begin(); i != first->fFieldList.end(); ++i) { #if ZCONFIG_Debug bool gotIt = false; #endif // ZCONFIG_Debug ! for (ZVectorP<ZDBField>::const_iterator j = second->fFieldList.begin(); j != second->fFieldList.end(); ++j) { if ((*i)->GetFieldName() == (*j)->GetFieldName()) --- 1208,1217 ---- // Walk our list of fields, compare each against the other's matching field ! for (vector<ZDBField*>::const_iterator i = first->fFieldList.begin(); i != first->fFieldList.end(); ++i) { #if ZCONFIG_Debug bool gotIt = false; #endif // ZCONFIG_Debug ! for (vector<ZDBField*>::const_iterator j = second->fFieldList.begin(); j != second->fFieldList.end(); ++j) { if ((*i)->GetFieldName() == (*j)->GetFieldName()) *************** *** 1245,1249 **** // Walk our field list telling each to delete its storage. This only actually affects // DBFieldBLOB, as it keeps its data in a separate block ! for (ZVectorP<ZDBField>::iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) #if 1 //## let's not crash deleting a record (usually in deleting table.old) -ec 00.11.01 { --- 1246,1250 ---- // Walk our field list telling each to delete its storage. This only actually affects // DBFieldBLOB, as it keeps its data in a separate block ! for (vector<ZDBField*>::iterator x = fFieldList.begin(); x != fFieldList.end(); ++x) #if 1 //## let's not crash deleting a record (usually in deleting table.old) -ec 00.11.01 { *************** *** 1312,1317 **** ZLocker theLock(this->GetLock()->GetRead()); ! const ZVectorP<ZDBField>& theFieldList = this->GetFields(); ! for (ZVectorP<ZDBField>::const_iterator x = theFieldList.begin(); x !=theFieldList.end(); ++x) { ZDBFieldName fieldName = (*x)->GetFieldName(); --- 1313,1318 ---- ZLocker theLock(this->GetLock()->GetRead()); ! const vector<ZDBField*>& theFieldList = this->GetFields(); ! for (vector<ZDBField*>::const_iterator x = theFieldList.begin(); x !=theFieldList.end(); ++x) { ZDBFieldName fieldName = (*x)->GetFieldName(); *************** *** 2396,2400 **** // We're the sole owners of indices, others should only take a temporary // reference to them ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) delete *i; --- 2397,2401 ---- // We're the sole owners of indices, others should only take a temporary // reference to them ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) delete *i; *************** *** 2402,2406 **** // does a ZAssert on its ref count, so when we delete one of these records, that's // still ZRefed by someone, that's the assertion that will trip. ! for (ZVectorP<ZDBRecord>::iterator i = fLoadedRecords.begin(); i != fLoadedRecords.end(); ++i) delete *i; --- 2403,2407 ---- // does a ZAssert on its ref count, so when we delete one of these records, that's // still ZRefed by someone, that's the assertion that will trip. ! for (vector<ZDBRecord*>::iterator i = fLoadedRecords.begin(); i != fLoadedRecords.end(); ++i) delete *i; *************** *** 2414,2418 **** iProgressWatcher->Push("table \""+fTableName+"\"", fIndexList.size()); ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { string indexName = ZDBIndex::sIndexNameToString((*i)->GetIndexedFieldNames()); --- 2415,2419 ---- iProgressWatcher->Push("table \""+fTableName+"\"", fIndexList.size()); ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { string indexName = ZDBIndex::sIndexNameToString((*i)->GetIndexedFieldNames()); *************** *** 2447,2457 **** // Check each index to see if we can load all of its nodes. At the same time build a list // of all record handles referenced by valid nodes in the indices ! ZVectorP<ZDBIndex> okayIndices; ! ZVectorP<ZDBIndex> badIndices; if (inProgressWatcher) inProgressWatcher->Push("check indices", fIndexList.size()); set<ZBlockStore::BlockHandle, less<ZBlockStore::BlockHandle> > allRecordHandles; set<ZDBRecord*, ZDBRecord::CompareForCheck> allDBRecords; ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { set<ZBlockStore::BlockHandle, less<ZBlockStore::BlockHandle> >* foundRecordHandles = nil; --- 2448,2458 ---- // Check each index to see if we can load all of its nodes. At the same time build a list // of all record handles referenced by valid nodes in the indices ! vector<ZDBIndex*> okayIndices; ! vector<ZDBIndex*> badIndices; if (inProgressWatcher) inProgressWatcher->Push("check indices", fIndexList.size()); set<ZBlockStore::BlockHandle, less<ZBlockStore::BlockHandle> > allRecordHandles; set<ZDBRecord*, ZDBRecord::CompareForCheck> allDBRecords; ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { set<ZBlockStore::BlockHandle, less<ZBlockStore::BlockHandle> >* foundRecordHandles = nil; *************** *** 2534,2538 **** vector<vector<ZDBFieldName> > indicesToRebuild; // Delete all the bad indices ! for (ZVectorP<ZDBIndex>::iterator i = badIndices.begin(); i != badIndices.end(); ++i) { string indexName = ZDBIndex::sIndexNameToString((*i)->GetIndexedFieldNames()); --- 2535,2539 ---- vector<vector<ZDBFieldName> > indicesToRebuild; // Delete all the bad indices ! for (vector<ZDBIndex*>::iterator i = badIndices.begin(); i != badIndices.end(); ++i) { string indexName = ZDBIndex::sIndexNameToString((*i)->GetIndexedFieldNames()); *************** *** 2564,2568 **** for (set<ZDBRecord*, ZDBRecord::CompareForCheck>::iterator i = allDBRecords.begin(); i != allDBRecords.end(); ++i) { ! for (ZVectorP<ZDBIndex>::iterator j = fIndexList.begin(); j != fIndexList.end(); ++j) { if (inProgressWatcher) --- 2565,2569 ---- for (set<ZDBRecord*, ZDBRecord::CompareForCheck>::iterator i = allDBRecords.begin(); i != allDBRecords.end(); ++i) { ! for (vector<ZDBIndex*>::iterator j = fIndexList.begin(); j != fIndexList.end(); ++j) { if (inProgressWatcher) *************** *** 2580,2584 **** { ZRef<ZDBRecord> theRecord(this->LoadRecord(*i)); ! for (ZVectorP<ZDBIndex>::iterator j = fIndexList.begin(); j != fIndexList.end(); ++j) { if (inProgressWatcher) --- 2581,2585 ---- { ZRef<ZDBRecord> theRecord(this->LoadRecord(*i)); ! for (vector<ZDBIndex*>::iterator j = fIndexList.begin(); j != fIndexList.end(); ++j) { if (inProgressWatcher) *************** *** 2627,2637 **** // Check each index to see if we can load all of its nodes. At the same time build a list // of all record handles referenced by valid nodes in the indices ! // ZVectorP<ZDBIndex> okayIndices; ! // ZVectorP<ZDBIndex> badIndices; // if (inProgressWatcher) // inProgressWatcher->Push("check indices", fIndexList.size()); set<ZBlockStore::BlockHandle, less<ZBlockStore::BlockHandle> > allRecordHandles; set<ZDBRecord*, ZDBRecord::CompareForCheck> allDBRecords; ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { set<ZBlockStore::BlockHandle, less<ZBlockStore::BlockHandle> >* foundRecordHandles = nil; --- 2628,2638 ---- // Check each index to see if we can load all of its nodes. At the same time build a list // of all record handles referenced by valid nodes in the indices ! // vector<ZDBIndex*> okayIndices; ! // vector<ZDBIndex*> badIndices; // if (inProgressWatcher) // inProgressWatcher->Push("check indices", fIndexList.size()); set<ZBlockStore::BlockHandle, less<ZBlockStore::BlockHandle> > allRecordHandles; set<ZDBRecord*, ZDBRecord::CompareForCheck> allDBRecords; ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { set<ZBlockStore::BlockHandle, less<ZBlockStore::BlockHandle> >* foundRecordHandles = nil; *************** *** 2735,2739 **** ZDBIndex* ZDBTable::GetIndex(const vector<ZDBFieldName>& inFieldNames) { ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { if ((*i)->DoYouIndexOnTheseFieldsPrecisely(inFieldNames)) --- 2736,2740 ---- ZDBIndex* ZDBTable::GetIndex(const vector<ZDBFieldName>& inFieldNames) { ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { if ((*i)->DoYouIndexOnTheseFieldsPrecisely(inFieldNames)) *************** *** 2747,2752 **** ZLocker locker(this->GetLock()->GetWrite()); ! ZVectorP<ZDBIndex>::iterator foundIter = fIndexList.end(); ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { if (*i == inIndex) --- 2748,2753 ---- ZLocker locker(this->GetLock()->GetWrite()); ! vector<ZDBIndex*>::iterator foundIter = fIndexList.end(); ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { if (*i == inIndex) *************** *** 2868,2872 **** // We don't increment the i pointer in the for loop, because we may not want to advance it if // we end up deleting the thing it references ! for (ZVectorP<ZDBRecord>::iterator i = fLoadedRecords.begin(); i != fLoadedRecords.end();) { // Is this record unreferenced? --- 2869,2873 ---- // We don't increment the i pointer in the for loop, because we may not want to advance it if // we end up deleting the thing it references ! for (vector<ZDBRecord*>::iterator i = fLoadedRecords.begin(); i != fLoadedRecords.end();) { // Is this record unreferenced? *************** *** 2925,2929 **** if (!inCreatePulledFromIndices) { ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->AddedNewRecord(newRecord); } --- 2926,2930 ---- if (!inCreatePulledFromIndices) { ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->AddedNewRecord(newRecord); } *************** *** 2941,2945 **** // Tell our indices to remove any reference to this record ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->DeletedRecord(inRecord.GetObject()); --- 2942,2946 ---- // Tell our indices to remove any reference to this record ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->DeletedRecord(inRecord.GetObject()); *************** *** 2952,2956 **** // Remove the record from our loaded record cache bool doneIt = false; ! for (ZVectorP<ZDBRecord>::iterator i = fLoadedRecords.begin(); i != fLoadedRecords.end(); ++i) { if ((*i) == inRecord.GetObject()) --- 2953,2957 ---- // Remove the record from our loaded record cache bool doneIt = false; ! for (vector<ZDBRecord*>::iterator i = fLoadedRecords.begin(); i != fLoadedRecords.end(); ++i) { if ((*i) == inRecord.GetObject()) *************** *** 2994,2998 **** // First, find an index who indexes on our search expression precisely ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { if ((*i)->DoYouIndexOnTheseFieldsPrecisely(theFieldNames)) --- 2995,2999 ---- // First, find an index who indexes on our search expression precisely ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { if ((*i)->DoYouIndexOnTheseFieldsPrecisely(theFieldNames)) *************** *** 3001,3005 **** // If that fails, use an index where our search expression is a proper prefix // of the index's field list ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { if ((*i)->DoYouIndexOnThisFieldListPrefix(theFieldNames)) --- 3002,3006 ---- // If that fails, use an index where our search expression is a proper prefix // of the index's field list ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { if ((*i)->DoYouIndexOnThisFieldListPrefix(theFieldNames)) *************** *** 3031,3035 **** { // First, find an index who indexes on our field names exactly ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { if ((*i)->DoYouIndexOnTheseFieldsPrecisely(inFieldNames)) --- 3032,3036 ---- { // First, find an index who indexes on our field names exactly ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { if ((*i)->DoYouIndexOnTheseFieldsPrecisely(inFieldNames)) *************** *** 3038,3042 **** // If that fails, use an index where our field names form a proper prefix // of the index's field list ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { if ((*i)->DoYouIndexOnThisFieldListPrefix(inFieldNames)) --- 3039,3043 ---- // If that fails, use an index where our field names form a proper prefix // of the index's field list ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) { if ((*i)->DoYouIndexOnThisFieldListPrefix(inFieldNames)) *************** *** 3092,3096 **** // Tell our indices to flush as well ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->Flush(); --- 3093,3097 ---- // Tell our indices to flush as well ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->Flush(); *************** *** 3103,3107 **** // Now, walk our loaded records, writing them out if necessary ! for (ZVectorP<ZDBRecord>::iterator i = fLoadedRecords.begin(); i != fLoadedRecords.end(); ++i) { ZBlockStore::BlockHandle theHandle = (*i)->GetBlockHandle(); --- 3104,3108 ---- // Now, walk our loaded records, writing them out if necessary ! for (vector<ZDBRecord*>::iterator i = fLoadedRecords.begin(); i != fLoadedRecords.end(); ++i) { ZBlockStore::BlockHandle theHandle = (*i)->GetBlockHandle(); *************** *** 3118,3122 **** } // Tell our indices to flush as well ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->Flush(); // We don't do the same for the index header info, because that's handled below, as part of our own writeback --- 3119,3123 ---- } // Tell our indices to flush as well ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->Flush(); // We don't do the same for the index header info, because that's handled below, as part of our own writeback *************** *** 3143,3147 **** } ! for (ZVectorP<ZDBIndex>::iterator j = fIndexList.begin(); j != fIndexList.end(); ++j) (*j)->ChangeFieldName(inOldName, inNewName); --- 3144,3148 ---- } ! for (vector<ZDBIndex*>::iterator j = fIndexList.begin(); j != fIndexList.end(); ++j) (*j)->ChangeFieldName(inOldName, inNewName); *************** *** 3149,3153 **** } ! void ZDBTable::GetIndexVector(ZVectorP<ZDBIndex>& outIndexVector) const { // We don't return a reference as we may not always be using a vector internally --- 3150,3154 ---- } ! void ZDBTable::GetIndexVector(vector<ZDBIndex*>& outIndexVector) const { // We don't return a reference as we may not always be using a vector internally *************** *** 3173,3177 **** // Note that the order of the fields in theFieldsToIndex is *very* important. It indicates primary, secondary... // ordering. ! ZVectorP<ZDBIndex> createdIndices; for (vector<vector<ZDBFieldName> >::const_iterator indexIterator = inIndexSpecs.begin(); indexIterator != inIndexSpecs.end(); ++indexIterator) { --- 3174,3178 ---- // Note that the order of the fields in theFieldsToIndex is *very* important. It indicates primary, secondary... // ordering. ! vector<ZDBIndex*> createdIndices; for (vector<vector<ZDBFieldName> >::const_iterator indexIterator = inIndexSpecs.begin(); indexIterator != inIndexSpecs.end(); ++indexIterator) { *************** *** 3250,3254 **** { ZRef<ZDBRecord> theRecord(*theIter); ! for (ZVectorP<ZDBIndex>::iterator j = createdIndices.begin(); j != createdIndices.end(); ++j) { if (inProgressWatcher) --- 3251,3255 ---- { ZRef<ZDBRecord> theRecord(*theIter); ! for (vector<ZDBIndex*>::iterator j = createdIndices.begin(); j != createdIndices.end(); ++j) { if (inProgressWatcher) *************** *** 3357,3361 **** // loaded from disk. If all our indices span, then this will never be called. // Walk our list of loaded records ! for (ZVectorP<ZDBRecord>::iterator i = fLoadedRecords.begin(); i != fLoadedRecords.end(); ++i) { if ((*i)->GetBlockHandle() == inHandle) --- 3358,3362 ---- // loaded from disk. If all our indices span, then this will never be called. // Walk our list of loaded records ! for (vector<ZDBRecord*>::iterator i = fLoadedRecords.begin(); i != fLoadedRecords.end(); ++i) { if ((*i)->GetBlockHandle() == inHandle) *************** *** 3389,3393 **** // loaded from disk. If all our indices span, then this will never be called. // Walk our list of loaded records ! for (ZVectorP<ZDBRecord>::iterator i = fLoadedRecords.begin(); i != fLoadedRecords.end(); ++i) { if ((*i)->GetBlockHandle() == inHandle) --- 3390,3394 ---- // loaded from disk. If all our indices span, then this will never be called. // Walk our list of loaded records ! for (vector<ZDBRecord*>::iterator i = fLoadedRecords.begin(); i != fLoadedRecords.end(); ++i) { if ((*i)->GetBlockHandle() == inHandle) *************** *** 3422,3426 **** ZAssert(!inRecord->IsDeleted()); ! ZVectorP<ZDBRecord>::iterator where = find(fLoadedRecords.begin(), fLoadedRecords.end(), inRecord.GetObject()); ZAssert(where != fLoadedRecords.end()); --- 3423,3427 ---- ZAssert(!inRecord->IsDeleted()); ! vector<ZDBRecord*>::iterator where = find(fLoadedRecords.begin(), fLoadedRecords.end(), inRecord.GetObject()); ZAssert(where != fLoadedRecords.end()); *************** *** 3436,3440 **** fRecordCount += 1; fDirty = true; ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->AddedNewRecord(inRecord.GetObject()); return true; --- 3437,3441 ---- fRecordCount += 1; fDirty = true; ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->AddedNewRecord(inRecord.GetObject()); return true; *************** *** 3452,3456 **** } ! ZVectorP<ZDBRecord>::iterator where = find(fLoadedRecords.begin(), fLoadedRecords.end(), inRecord); ZAssert(where != fLoadedRecords.end()); --- 3453,3457 ---- } ! vector<ZDBRecord*>::iterator where = find(fLoadedRecords.begin(), fLoadedRecords.end(), inRecord); ZAssert(where != fLoadedRecords.end()); *************** *** 3489,3493 **** void ZDBTable::RecordPreChange(ZDBRecord* inRecord, ZDBField* inField) { ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->RecordPreChange(inRecord, inField->GetFieldName()); fDirty = true; --- 3490,3494 ---- void ZDBTable::RecordPreChange(ZDBRecord* inRecord, ZDBField* inField) { ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->RecordPreChange(inRecord, inField->GetFieldName()); fDirty = true; *************** *** 3496,3500 **** void ZDBTable::RecordPostChange(ZDBRecord* inRecord, ZDBField* inField) { ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->RecordPostChange(inRecord, inField->GetFieldName()); fDirty = true; --- 3497,3501 ---- void ZDBTable::RecordPostChange(ZDBRecord* inRecord, ZDBField* inField) { ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->RecordPostChange(inRecord, inField->GetFieldName()); fDirty = true; *************** *** 3505,3509 **** // The record in question is about to have all of its fields modified, so // remove it from all our indices ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->RecordPreRead(inRecord); fDirty = true; --- 3506,3510 ---- // The record in question is about to have all of its fields modified, so // remove it from all our indices ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->RecordPreRead(inRecord); fDirty = true; *************** *** 3514,3518 **** // The record in question has had all its fields modified, so it can be // reinserted into our indices ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->RecordPostRead(inRecord); fDirty = true; --- 3515,3519 ---- // The record in question has had all its fields modified, so it can be // reinserted into our indices ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->RecordPostRead(inRecord); fDirty = true; *************** *** 3528,3532 **** // based on field values, otherwise instantiating a new record ZDBRecord* theRecord = this->MakeRecord(inItem); ! for (ZVectorP<ZDBRecord>::iterator i = fLoadedRecords.begin(); i != fLoadedRecords.end(); ++i) { if ((*i)->IsIdenticalTo(theRecord)) --- 3529,3533 ---- // based on field values, otherwise instantiating a new record ZDBRecord* theRecord = this->MakeRecord(inItem); ! for (vector<ZDBRecord*>::iterator i = fLoadedRecords.begin(); i != fLoadedRecords.end(); ++i) { if ((*i)->IsIdenticalTo(theRecord)) *************** *** 3640,3644 **** // And the info for each extant index theStream.WriteInt32(fIndexList.size()); ! for (ZVectorP<ZDBIndex>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->ToStream(theStream, 0); --- 3641,3645 ---- // And the info for each extant index theStream.WriteInt32(fIndexList.size()); ! for (vector<ZDBIndex*>::iterator i = fIndexList.begin(); i != fIndexList.end(); ++i) (*i)->ToStream(theStream, 0); *************** *** 4072,4076 **** // We'll have to walk the field reps, cloning each one fFieldReps.reserve(inOther.fFieldReps.size()); ! for (ZVectorP<ZDBFieldRep>::const_iterator i = inOther.fFieldReps.begin(); i != inOther.fFieldReps.end(); ++i) fFieldReps.push_back((*i)->Clone()); } --- 4073,4077 ---- // We'll have to walk the field reps, cloning each one fFieldReps.reserve(inOther.fFieldReps.size()); ! for (vector<ZDBFieldRep*>::const_iterator i = inOther.fFieldReps.begin(); i != inOther.fFieldReps.end(); ++i) fFieldReps.push_back((*i)->Clone()); } *************** *** 4172,4176 **** { // Trash our copies of the fieldReps ! for (ZVectorP<ZDBFieldRep>::iterator i = fFieldReps.begin(); i != fFieldReps.end(); ++i) delete *i; } --- 4173,4177 ---- { // Trash our copies of the fieldReps ! for (vector<ZDBFieldRep*>::iterator i = fFieldReps.begin(); i != fFieldReps.end(); ++i) delete *i; } *************** *** 4195,4200 **** // The theory is this -- we can bail anytime one of our leading fields is not equal to their corresponding // field. The overall result of the comparison is the result of that particular comparison ! ZVectorP<ZDBFieldRep>::iterator us = fFieldReps.begin(); ! ZVectorP<ZDBFieldRep>::iterator them = realItem->fFieldReps.begin(); for (;us != fFieldReps.end() && result == 0; ++us, ++them) result = (*us)->Compare(*them); --- 4196,4201 ---- // The theory is this -- we can bail anytime one of our leading fields is not equal to their corresponding // field. The overall result of the comparison is the result of that particular comparison ! vector<ZDBFieldRep*>::iterator us = fFieldReps.begin(); ! vector<ZDBFieldRep*>::iterator them = realItem->fFieldReps.begin(); for (;us != fFieldReps.end() && result == 0; ++us, ++them) result = (*us)->Compare(*them); *************** *** 4239,4244 **** // field. The overall result of the comparison is the result of that particular comparison, (so long // as we're the same length) ! ZVectorP<ZDBFieldRep>::iterator us = fFieldReps.begin(); ! ZVectorP<ZDBFieldRep>::iterator them = realItem->fFieldReps.begin(); for (; us != fFieldReps.end() && them !=realItem->fFieldReps.end() && result == 0; ++us, ++them) result = (*us)->Compare(*them); --- 4240,4245 ---- // field. The overall result of the comparison is the result of that particular comparison, (so long // as we're the same length) ! vector<ZDBFieldRep*>::iterator us = fFieldReps.begin(); ! vector<ZDBFieldRep*>::iterator them = realItem->fFieldReps.begin(); for (; us != fFieldReps.end() && them !=realItem->fFieldReps.end() && result == 0; ++us, ++them) result = (*us)->Compare(*them); *************** *** 4281,4286 **** // The theory is this -- we can bail anytime one of our leading fields is not equal to their corresponding // field. The overall result of the comparison is the result of that particular comparison ! ZVectorP<ZDBFieldRep>::iterator us = fFieldReps.begin(); ! ZVectorP<ZDBFieldRep>::iterator them = realItem->fFieldReps.begin(); for (;us != fFieldReps.end() && them !=realItem->fFieldReps.end() && result == 0; ++us, ++them) result = (*us)->Compare((*them)); --- 4282,4287 ---- // The theory is this -- we can bail anytime one of our leading fields is not equal to their corresponding // field. The overall result of the comparison is the result of that particular comparison ! vector<ZDBFieldRep*>::iterator us = fFieldReps.begin(); ! vector<ZDBFieldRep*>::iterator them = realItem->fFieldReps.begin(); for (;us != fFieldReps.end() && them !=realItem->fFieldReps.end() && result == 0; ++us, ++them) result = (*us)->Compare((*them)); *************** *** 4296,4300 **** // We don't have to write out either a count of the number of fields, nor their types -- both // items of info can be derived from our index ! for (ZVectorP<ZDBFieldRep>::iterator i = fFieldReps.begin(); i != fFieldReps.end(); ++i) (*i)->ToStream(inStream); if (!fIndex->GetAllIndicesSpan()) --- 4297,4301 ---- // We don't have to write out either a count of the number of fields, nor their types -- both // items of info can be derived from our index ! for (vector<ZDBFieldRep*>::iterator i = fFieldReps.begin(); i != fFieldReps.end(); ++i) (*i)->ToStream(inStream); if (!fIndex->GetAllIndicesSpan()) |