Current, uncompileable, work in progress
[GenericStorageContainerTemplate.git] / GenericStorageContainerTest.cpp
1 #include "GenericStorageContainerTemplateImpl.hpp"
2 #include <iostream>
3
4 using namespace tj;
5 using namespace std;
6
7 int
8 main (int argc, char **argv, char **env)
9 {
10   cout << "Generic Storage Template (with Iterator) Test" << endl
11        << "Copyright 2014 TJ <hacker@iam.tj>" << endl
12        << "Licensed on terms of the GNU General Public License version 3.0" << endl;
13
14   int* test = new int(320596); // initial test value
15   GSCTI<int, SC_DA<int>> my_collection_of_ints(*test);
16
17   unsigned menu_choice;
18
19   do
20   {
21     cout << endl << "Menu" << endl
22          << "1. Add node" << endl
23          << "2. Remove node" << endl
24          << "3. List nodes using forward Iterator" << endl
25          << "4. List nodes using reverse Interator" << endl
26          << "0. Exit" << endl;
27
28     cin >> menu_choice;
29
30     switch (menu_choice)
31     {
32       case 0: // exit
33         break;
34       case 1: // Add node
35         test = new int(76543);
36         my_collection_of_ints.add_node(test);
37         break;
38       case 2: // Remove node
39         break;
40       case 3: // List using forward Iterator
41         cout << "size = " << my_collection_of_ints.get_size();
42         for (int i : my_collection_of_ints) // XXX: C++11 'range for' automagically uses the iterator
43         {
44           cout << "Node = " << i << endl;
45         }
46         break;
47       case 4: // List using reverse Iterator
48         break;
49     }
50
51   } while (menu_choice > 0);
52
53   return 0;
54 }
55