Commit a58dc6af authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Start trying to write a c++ interface. Addresses #197.

git-svn-id: file:///svn/tokudb@1175 c7de825b-a66e-492c-adef-691d508d4ae1
parent d7319d8d
CPPFLAGS = -I../include
test1: test1.o dbt.o
#include <db.h>
#include <string.h>
class Dbt;
// DBT and Dbt objects are interchangeable. So watch out if you use Dbt to make other classes (e.g., with subclassing)
class Dbt : private DBT
{
public:
void * get_data(void) const { return data; }
void set_data(void *p) { data = p; }
u_int32_t get_size(void) const { return size; }
void set_size(u_int32_t p) { size = p; }
DBT *get_DBT(void) { return (DBT*)this; }
Dbt(void);
~Dbt();
private:
// Nothing here.
}
;
#include "db_cxx.h"
Dbt::Dbt(void) {
DBT *dbt = this;
memset(dbt, 0, sizeof(*dbt));
}
#include <db_cxx.h>
#include <iostream>
using namespace std;
int main()
{
Dbt dbt;
dbt.set_size(3);
cout << "Hello World!" << endl; cout << "Welcome to C++ Programming" << endl;
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment