diff options
author | tomsmeding <hallo@tomsmeding.nl> | 2015-05-11 21:24:57 +0200 |
---|---|---|
committer | tomsmeding <hallo@tomsmeding.nl> | 2015-05-11 21:24:57 +0200 |
commit | ce356164bac0f739fea97b8bee61c066b9f2ae87 (patch) | |
tree | bf73239c76e0288de9378f06c322766889ef1fb9 /engine.cpp | |
parent | bfd76241386fe54c4394171c861f4b1676b5bf32 (diff) |
Add <<debug<< log, clean up some code and let find return a list instead of 1 element
Diffstat (limited to 'engine.cpp')
-rw-r--r-- | engine.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -1,10 +1,11 @@ +#include "enginedata.h" +#include "Maybe.h" #include <iostream> #include <vector> #include <map> +#include <list> #include <cstdlib> #include <climits> -#include "enginedata.h" -#include "Maybe.h" using namespace std; @@ -24,10 +25,13 @@ int main(int argc,char **argv){ row.items[1].u.rh_uint32=UINT_MAX; row.items[2].u.rh_bytes=new unsigned char[10]; strcpy((char*)row.items[2].u.rh_bytes,"hallo daar"); - hoitb->insert(row); - Maybe<Row> found=hoitb->find(serialise((int32_t)-1)); + if(!hoitb->insert(row))cout<<"Failed to insert row!"<<endl; else cout<<"Success."<<endl; + if(!hoitb->insert(row))cout<<"Failed to insert row!"<<endl; else cout<<"Success."<<endl; cout<<"hoitb has "<<hoitb->rows.size()<<" row"<<(hoitb->rows.size()==1?"":"s")<<'.'<<endl; - if(found)cout<<found.value()<<endl; - else cout<<"No row with key -1 found"<<endl; + list<Row> found=hoitb->find(serialise((int32_t)-1)); + cout<<"Found for key -1:"<<endl; + for(Row r : found){ + cout<<r<<endl; + } return 0; } |