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