thin-provisioning-tools/caching/hint_array.h

37 lines
875 B
C
Raw Normal View History

2013-09-12 17:03:32 +05:30
#ifndef CACHE_HINT_ARRAY_H
#define CACHE_HINT_ARRAY_H
#include "persistent-data/data-structures/array.h"
#include <string>
//----------------------------------------------------------------
namespace caching {
namespace hint_array_detail {
template <uint32_t WIDTH>
struct hint_traits {
typedef unsigned char byte;
typedef byte disk_type[WIDTH];
2013-09-12 19:12:59 +05:30
typedef byte value_type[WIDTH];
2013-09-12 17:03:32 +05:30
typedef no_op_ref_counter<value_type> ref_counter;
2013-09-12 19:12:59 +05:30
static void unpack(disk_type const &disk, value_type &value) {
::memcpy(value, disk, sizeof(value));
}
static void pack(value_type const &value, disk_type &disk) {
::memcpy(disk, value, sizeof(disk));
}
2013-09-12 17:03:32 +05:30
};
// FIXME: data visitor stuff
}
// typedef persistent_data::array<mapping_array_detail::hint_traits> hint_array;
}
//----------------------------------------------------------------
#endif