From 7a6d09866a9bc95a87ca39d5ea00aee701565a4d Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Tue, 29 Jan 2013 11:35:37 +0000 Subject: [PATCH] [array] add array_t --- persistent-data/data-structures/array.h | 6 +++++- persistent-data/data-structures/array.tcc | 4 ++-- unit-tests/Makefile.in | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/persistent-data/data-structures/array.h b/persistent-data/data-structures/array.h index 3792df8..7043742 100644 --- a/persistent-data/data-structures/array.h +++ b/persistent-data/data-structures/array.h @@ -142,9 +142,13 @@ namespace persistent_data { tm_ptr tm_; bool destroy_; unsigned entries_per_block_; // FIXME: initialise - btree<1, array_block_traits > block_tree_; + + typedef array_block_traits btree_traits; + btree<1, btree_traits> block_tree_; typename ValueTraits::ref_counter rc_; }; + + // FIXME: we need an array checker } #include "array.tcc" diff --git a/persistent-data/data-structures/array.tcc b/persistent-data/data-structures/array.tcc index 88faec3..0cf638c 100644 --- a/persistent-data/data-structures/array.tcc +++ b/persistent-data/data-structures/array.tcc @@ -71,8 +71,8 @@ array::array(typename persistent_data::transaction_manager::ptr tm, value_type const &default_value) : tm_(tm), destroy_(false), - block_tree_(tm, array_block_traits()), entries_per_block_(calc_max_entries(sizeof(value_type), MD_BLOCK_SIZE)), + block_tree_(tm, typename btree_traits::ref_counter()), rc_(rc) { } @@ -83,8 +83,8 @@ array::array(typename persistent_data::transaction_manager::ptr tm, block_address root) : tm_(tm), destroy_(false), - block_tree_(tm, root, array_block_traits()), entries_per_block_(calc_max_entries(sizeof(value_type), MD_BLOCK_SIZE)), + block_tree_(tm, root, typename btree_traits::ref_counter()), rc_(rc) { } diff --git a/unit-tests/Makefile.in b/unit-tests/Makefile.in index 6d7e377..7bd4ad8 100644 --- a/unit-tests/Makefile.in +++ b/unit-tests/Makefile.in @@ -17,6 +17,7 @@ # . TEST_SOURCE=\ + unit-tests/array_t.cc \ unit-tests/buffer_t.cc \ unit-tests/cache_t.cc \ unit-tests/block_t.cc \ @@ -32,6 +33,9 @@ unit-test: $(TEST_PROGRAMS) .PHONY: unit-test +unit-tests/array_t: unit-tests/array_t.o $(OBJECTS) + g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT) + unit-tests/buffer_t: unit-tests/buffer_t.o $(OBJECTS) g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT)