[hint_array] move hint_traits to .cc file
This commit is contained in:
@ -7,7 +7,25 @@ using namespace persistent_data;
|
|||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
using namespace caching::hint_array_detail;
|
template <uint32_t WIDTH>
|
||||||
|
struct hint_traits {
|
||||||
|
typedef unsigned char byte;
|
||||||
|
typedef byte disk_type[WIDTH];
|
||||||
|
typedef vector<byte> value_type;
|
||||||
|
typedef no_op_ref_counter<value_type> ref_counter;
|
||||||
|
|
||||||
|
// FIXME: slow copying for now
|
||||||
|
static void unpack(disk_type const &disk, value_type &value) {
|
||||||
|
for (unsigned byte = 0; byte < WIDTH; byte++)
|
||||||
|
value.at(byte) = disk[byte];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void pack(value_type const &value, disk_type &disk) {
|
||||||
|
for (unsigned byte = 0; byte < WIDTH; byte++)
|
||||||
|
disk[byte] = value.at(byte);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// We've got into a bit of a mess here. Templates are compile
|
// We've got into a bit of a mess here. Templates are compile
|
||||||
// time, and we don't know the hint width until run time. We're
|
// time, and we don't know the hint width until run time. We're
|
||||||
|
@ -9,24 +9,6 @@
|
|||||||
|
|
||||||
namespace caching {
|
namespace caching {
|
||||||
namespace hint_array_detail {
|
namespace hint_array_detail {
|
||||||
template <uint32_t WIDTH>
|
|
||||||
struct hint_traits {
|
|
||||||
typedef unsigned char byte;
|
|
||||||
typedef byte disk_type[WIDTH];
|
|
||||||
typedef vector<byte> value_type;
|
|
||||||
typedef no_op_ref_counter<value_type> ref_counter;
|
|
||||||
|
|
||||||
// FIXME: slow copying for now
|
|
||||||
static void unpack(disk_type const &disk, value_type &value) {
|
|
||||||
for (unsigned byte = 0; byte < WIDTH; byte++)
|
|
||||||
value.at(byte) = disk[byte];
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pack(value_type const &value, disk_type &disk) {
|
|
||||||
for (unsigned byte = 0; byte < WIDTH; byte++)
|
|
||||||
disk[byte] = value.at(byte);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// FIXME: data visitor stuff
|
// FIXME: data visitor stuff
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user