bool IndexFile::check(int level) { printf("Checking FileAllocator...\n"); try { if (fa.dump(level)) printf("FileAllocator OK\n"); else { printf("FileAllocator ERROR\n"); return false; } NameIterator names; bool have_name; unsigned long channels = 0; unsigned long total_nodes=0, total_used_records=0, total_records=0; unsigned long nodes, records; stdString dir; for (have_name = getFirstChannel(names); have_name; have_name = getNextChannel(names)) { ++channels; AutoPtr<RTree> tree(getTree(names.getName(), dir)); if (!tree) { printf("%s not found\n", names.getName().c_str()); return false; } printf("."); fflush(stdout); if (!tree->selfTest(nodes, records)) { printf("RTree for channel '%s' is broken\n", names.getName().c_str()); return false; } total_nodes += nodes; total_used_records += records; total_records += nodes * tree->getM(); } printf("\nAll RTree self-tests check out fine\n"); printf("%ld channels\n", channels); printf("Total: %ld nodes, %ld records out of %ld are used (%.1lf %%)\n", total_nodes, total_used_records, total_records, total_used_records*100.0/total_records); } catch (GenericException &e) { printf("Exception:\n%s\n", e.what()); } return true; }