Pull everthing in the facades

This commit is contained in:
Patrick Niklaus
2017-03-01 22:55:18 +00:00
committed by Patrick Niklaus
parent ff0a98196f
commit 108fce896b
17 changed files with 478 additions and 283 deletions
+7
View File
@@ -141,6 +141,13 @@ class FileReader
return sizeof(count) + sizeof(T) * count;
}
template <typename T> std::size_t ReadVectorSize()
{
const auto count = ReadElementCount64();
Skip<T>(count);
return count;
}
template <typename T> void *DeserializeVector(void *begin, const void *end)
{
auto count = ReadElementCount64();
+18 -2
View File
@@ -57,7 +57,9 @@ const constexpr char *block_id_to_name[] = {"NAME_CHAR_DATA",
"LANE_DESCRIPTION_MASKS",
"TURN_WEIGHT_PENALTIES",
"TURN_DURATION_PENALTIES",
"MLD_CELL_PARTITION",
"MLD_LEVEL_DATA",
"MLD_PARTITION",
"MLD_CELL_TO_CHILDREN",
"MLD_CELL_STORAGE"};
struct DataLayout
@@ -103,7 +105,9 @@ struct DataLayout
LANE_DESCRIPTION_MASKS,
TURN_WEIGHT_PENALTIES,
TURN_DURATION_PENALTIES,
MLD_CELL_PARTITION,
MLD_LEVEL_DATA,
MLD_PARTITION,
MLD_CELL_TO_CHILDREN,
MLD_CELL_STORAGE,
NUM_BLOCKS
};
@@ -122,6 +126,11 @@ struct DataLayout
entry_align[bid] = alignof(T);
}
inline uint64_t GetBlockEntries(BlockID bid) const
{
return num_entries[bid];
}
inline uint64_t GetBlockSize(BlockID bid) const
{
// special bit encoding
@@ -169,6 +178,13 @@ struct DataLayout
return ptr;
}
template <typename T>
inline T *GetBlockEnd(char *shared_memory, BlockID bid) const
{
auto begin = GetBlockPtr<T>(shared_memory, bid);
return begin + GetBlockEntries(bid);
}
template <typename T, bool WRITE_CANARY = false>
inline T *GetBlockPtr(char *shared_memory, BlockID bid) const
{