aboutsummaryrefslogtreecommitdiff
path: root/engine.cpp
blob: 67c952445c78d159a384abd6a75735d35976d3a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "enginedata.h"
#include "Maybe.h"
#include <iostream>
#include <vector>
#include <map>
#include <list>
#include <cstdlib>
#include <climits>

using namespace std;


map<string,Table> tables;


int main(int argc,char **argv){
	ColHeader *header=new ColHeader[3];
	header[0]={RH_INT32,0};
	header[1]={RH_UINT32,0};
	header[2]={RH_BYTES,10};
	tables.emplace("hoi",Table("hoi",3,header));
	Table *hoitb=&tables.at("hoi");
	Row row(3,hoitb);
	row.items[0].u.rh_int32=UINT_MAX;
	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");
	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;
	list<Row> found=hoitb->find(serialise((int32_t)-1));
	cout<<"Found for key -1:"<<endl;
	for(Row r : found){
		cout<<r<<endl;
	}
	return 0;
}