write some code
This commit is contained in:
20
btree.h
20
btree.h
@@ -1,6 +1,7 @@
|
||||
#ifndef BTREE_H
|
||||
#define BTREE_H
|
||||
|
||||
#include "endian.h"
|
||||
#include "transaction_manager.h"
|
||||
|
||||
//----------------------------------------------------------------
|
||||
@@ -17,8 +18,8 @@ namespace persistent_data {
|
||||
typedef typename block_manager<BlockSize>::read_ref read_ref;
|
||||
typedef typename block_manager<BlockSize>::write_ref write_ref;
|
||||
|
||||
btree(boost::shared_ptr<transaction_manager<BlockSize> > tm);
|
||||
btree(boost::shared_ptr<transaction_manager<BlockSize> > tm,
|
||||
btree(typename persistent_data::transaction_manager<BlockSize>::ptr tm);
|
||||
btree(typename transaction_manager<BlockSize>::ptr tm,
|
||||
block_address root);
|
||||
~btree();
|
||||
|
||||
@@ -42,8 +43,23 @@ namespace persistent_data {
|
||||
bool destroy_;
|
||||
block_address root_;
|
||||
};
|
||||
|
||||
struct uint64_traits {
|
||||
typedef base::__le64 disk_type;
|
||||
typedef uint64_t value_type;
|
||||
|
||||
static value_type construct(void *data) {
|
||||
// extra memcpy because I'm paranoid about alignment issues
|
||||
base::__le64 disk;
|
||||
|
||||
::memcpy(&disk, data, sizeof(disk));
|
||||
return base::to_cpu<uint64_t>(disk);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#include "btree.tcc"
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user