[hint_array] move hint_traits to .cc file

This commit is contained in:
Joe Thornber 2013-10-08 10:02:25 +01:00
parent 19b5c6193f
commit 7da033d5c1
2 changed files with 19 additions and 19 deletions

View File

@ -7,7 +7,25 @@ using namespace persistent_data;
//----------------------------------------------------------------
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
// time, and we don't know the hint width until run time. We're

View File

@ -9,24 +9,6 @@
namespace caching {
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
}