Merge branch 'upstream/OpenFOAM' into master
[freefoam.git] / applications / test / HashTable2 / hashTableTest2.C
blob5038babbaec7aa12dda3f5cb0f47d42af4c35636
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Description
27 \*---------------------------------------------------------------------------*/
29 #include <OpenFOAM/HashTable.H>
30 #include <OpenFOAM/HashPtrTable.H>
31 #include <OpenFOAM/Map.H>
33 using namespace Foam;
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 // Main program:
38 int main(int argc, char *argv[])
40     HashTable<label, Foam::string> table1(0);
42     table1.insert("kjhk", 10);
43     table1.insert("kjhk2", 12);
45     Info<< "table1: " << table1 << nl
46         << "toc: " << table1.toc() << endl;
48     HashTable<label, label, Hash<label> > table2(10);
50     table2.insert(3, 10);
51     table2.insert(5, 12);
52     table2.insert(7, 16);
54     Info<< "table2: " << table2 << nl
55         << "toc: " << table2.toc() << endl;
57     Map<label> table3(1);
58     table3.transfer(table2);
60     Info<< "table2: " << table2 << nl
61         << "toc: " << table2.toc() << endl;
63     Info<< "table3: " << table3 << nl
64         << "toc: " << table3.toc() << endl;
66     Map<label> table4(table3.xfer());
68     Info<< "table3: " << table3 << nl
69         << "toc: " << table3.toc() << endl;
71     Info<< "table4: " << table4 << nl
72         << "toc: " << table4.toc() << endl;
74     HashPtrTable<label, Foam::string> ptable1(0);
75     ptable1.insert("kjhkjh", new label(10));
77     Info<< "PtrTable toc: " << ptable1.toc() << endl;
79     Info<< "End\n" << endl;
81     return 0;
85 // ************************ vim: set sw=4 sts=4 et: ************************ //