test.cc
00001 #include "Message.hh"
00002 #include "ParameterList.hh"
00003 #include "ConfigHandler.hh"
00004 #include "CommandSwitchFunctions.hh"
00005 #include <stdio.h>
00006 #include <stdlib.h>
00007
00008 #include <vector>
00009 #include <string>
00010
00011 using namespace std;
00012
00013 template<class T> void f(T& t){ cout<<"First implementation"<<endl; }
00014 void f(double d) { cout<<"Second implementation"<<endl; }
00015 template<class T> void f(T* t) { cout<<"Third implementation"<<endl; }
00016 void f(int* i){ cout<<"Fourth implementation"<<endl; }
00017
00018 template<class T> void f(std::vector<T>& v){ cout<<"Fifth implementation"<<endl;}
00019
00020 int main(int argc, char** argv)
00021 {
00022
00023 int a;
00024 double b;
00025 f(a);
00026 f(b);
00027 f(&a);
00028 f(&b);
00029
00030 std::vector<int> v;
00031 f(v);
00032
00033 ParameterList list("mylist","a test list");
00034 int i=14;
00035 list.RegisterParameter("i",i,"an integer");
00036
00037 string s="string";
00038 list.RegisterParameter("s",s,"a string");
00039
00040 std::map<std::string, double> smap;
00041 smap["pi"] = 3.14159;
00042 smap["x"] = -2.11;
00043 list.RegisterParameter("smap", smap, "string:double map");
00044
00045 vector<int> ivec;
00046 ivec.push_back(3);
00047 ivec.push_back(11);
00048 ivec.push_back(-4);
00049 list.RegisterParameter("ivec",ivec, "A vector of integers");
00050
00051 vector<string> svec;
00052 svec.push_back("Hello");
00053 svec.push_back("World");
00054 svec.push_back("A much longer string");
00055 list.RegisterParameter("svec",svec, "A vector of strings");
00056
00057
00058 vector< vector<string> > nest;
00059 vector<string> filler;
00060 filler.push_back("a line");
00061 filler.push_back("a second line");
00062 nest.push_back(filler);
00063 filler.clear();
00064 filler.push_back("one");
00065 filler.push_back("2");
00066 filler.push_back("III");
00067 nest.push_back(filler);
00068 filler.clear();
00069 filler.push_back("done");
00070 nest.push_back(filler);
00071 list.RegisterParameter("nest",nest, "Nested vectors of strings");
00072
00073
00074
00075 cout<<list<<endl;
00076
00077 std::vector<std::string> sv2;
00078
00079
00080
00081 std::map<int, std::string> imap;
00082
00083 ParameterList list2("list2");
00084 list2.RegisterParameter("sv2" , sv2 , "vector of strings");
00085 list2.RegisterParameter("smap",smap,"string:double map");
00086 list2.RegisterParameter("imap",imap,"int:string map");
00087 cin>>list2;
00088 cout<<list2<<endl;
00089
00090
00091 return 0;
00092 }