| 37 | // Main program: |
| 38 | |
| 39 | int main() |
| 40 | { |
| 41 | HASHTABLE_CLASS<double> table1(13); |
| 42 | |
| 43 | table1.insert("aaa", 1.0); |
| 44 | table1.insert("aba", 2.0); |
| 45 | table1.insert("aca", 3.0); |
| 46 | table1.insert("ada", 4.0); |
| 47 | table1.insert("aeq", 5.0); |
| 48 | table1.insert("aaw", 6.0); |
| 49 | table1.insert("abs", 7.0); |
| 50 | table1.insert("acr", 8.0); |
| 51 | table1.insert("adx", 9.0); |
| 52 | table1.insert("aec", 10.0); |
| 53 | |
| 54 | table1.erase("aaw"); |
| 55 | table1.erase("abs"); |
| 56 | |
| 57 | Info<< "\ntable1 toc: " << table1.toc() << endl; |
| 58 | table1.printInfo(Info) |
| 59 | << "table1 [" << table1.size() << "] " << endl; |
| 60 | forAllIter(HASHTABLE_CLASS<double>, table1, iter) |
| 61 | { |
| 62 | Info<< iter.key() << " => " << iter() << nl; |
| 63 | } |
| 64 | |
| 65 | table1.set("acr", 108); |
| 66 | table1.set("adx", 109); |
| 67 | table1.set("aec", 100); |
| 68 | table1("aaw") -= 1000; |
| 69 | table1("aeq") += 1000; |
| 70 | |
| 71 | Info<< "\noverwrote some values table1: " << table1 << endl; |
| 72 | |
| 73 | Info<< "\ntest find:" << endl; |
| 74 | Info<< table1.find("aaa")() << nl |
| 75 | << table1.find("aba")() << nl |
| 76 | << table1.find("aca")() << nl |
| 77 | << table1.find("ada")() << nl |
| 78 | << table1.find("aeq")() << nl |
| 79 | << table1.find("acr")() << nl |
| 80 | << table1.find("adx")() << nl |
| 81 | << table1.find("aec")() << nl |
| 82 | << table1["aaa"] << nl; |
| 83 | |
| 84 | { |
| 85 | OStringStream os; |
| 86 | os << table1; |
| 87 | HASHTABLE_CLASS<double> readTable(IStringStream(os.str())(), 100); |
| 88 | |
| 89 | Info<< "Istream constructor:" << readTable << endl; |
| 90 | } |
| 91 | |
| 92 | |
| 93 | HASHTABLE_CLASS<double> table2(table1); |
| 94 | HASHTABLE_CLASS<double> table3(table1.xfer()); |
| 95 | |
| 96 | Info<< "\ncopy table1 -> table2" << nl |
nothing calls this directly
no test coverage detected