bool createDB(string databasePrefix, unsigned int expectedMaxNumberOfItems) { IntelWeb iw; if ( ! iw.createNew(databasePrefix, expectedMaxNumberOfItems)) { cout << "Error: Cannot create database with prefix " << databasePrefix << " with " << expectedMaxNumberOfItems << " items expected." << endl; } return true; }
int main() { //DiskMultiMap x; // //x.createNew("myhashtable.dat", 100); //x.insert("hmm.exe", "pfft.exe", "m52902"); //x.insert("hmm.exe", "pfft.exe", "m52902"); //x.insert("hmm.exe", "pfft.exe", "m10001"); //x.insert("blah.exe", "bletch.exe", "m0003"); //DiskMultiMap::Iterator it = x.search("hmm.exe"); //if (it.isValid()) { // cout << "I found at least 1 item with a key of hmm.exe" << endl; // do // { // MultiMapTuple m = *it; // cout << "The key is: " << m.key << endl; // cout << "The value is: " << m.value << endl; // cout << "The context is: " << m.context << endl; // cout << endl; // ++it; // } while (it.isValid()); //} //it = x.search("goober .exe"); //if (!it.isValid()) // cout << "I couldn't find goober.exe" << endl; //if (x.erase("hmm.exe", "pfft.exe", "m52902") == 2) // std::cout << "Just erased 2 items from the table!" << std::endl; //if (x.erase("hmm.exe", "pfft.exe", "m10001") == 1) // std::cout << "Just erased 1 item from the table!" << std::endl; //if (x.erase("blah.exe", "bletch.exe", "m66666") == 0) // std::cout << "I didn't erase this item cause it wasn't there!" << std::endl; //x.insert("hmm.exe", "pfft.exe", "m52902"); //x.insert("hmm.exe", "pfft.exe", "m52902"); //x.insert("hmm.exe", "pfft.exe", "m10001"); //x.insert("blah.exe", "bletch.exe", "m0003"); //x.close(); //if (x.openExisting("myhashtable.dat")) // std::cout << "Opening my hash table..." << std::endl; //if (x.erase("hmm.exe", "pfft.exe", "m52902") == 2) // std::cout << "Just erased 2 items from the table!" << std::endl; //if (x.erase("hmm.exe", "pfft.exe", "m10001") == 1) // std::cout << "Just erased 1 item from the table!" << std::endl; //if (x.erase("blah.exe", "bletch.exe", "m66666") == 0) // std::cout << "I didn't erase this item cause it wasn't there!" << std::endl; //if (x.erase("hmm.exe", "pfft.exe", "m52902") == 0) // std::cout << "I didn't erase this item cause it wasn't there!" << std::endl; IntelWeb x; if (x.createNew("mydata", 10000)) cout << "Created mydata" << endl; x.ingest("Jan-tel.dat"); x.ingest("Feb-tel.dat"); x.close(); IntelWeb y; if (y.openExisting("mydata")) cout << "Opened mydata" << endl; y.ingest("Mar-tel.dat"); y.ingest("Apr-tel.dat"); y.close(); return 0; }