Added indexed array data type with variable and fixed group blocks

This commit is contained in:
Michael Krasnyk
2017-01-19 15:14:30 +01:00
committed by Patrick Niklaus
parent cedeb15ade
commit 6e1c4bfecd
15 changed files with 781 additions and 193 deletions
+16
View File
@@ -61,6 +61,22 @@ class FileReader
}
}
std::size_t GetSize()
{
const boost::filesystem::ifstream::pos_type positon = input_stream.tellg();
input_stream.seekg(0, std::ios::end);
const boost::filesystem::ifstream::pos_type file_size = input_stream.tellg();
if (file_size == boost::filesystem::ifstream::pos_type(-1))
{
throw util::exception("File size for " + filepath.string() + " failed " + SOURCE_REF);
}
// restore the current position
input_stream.seekg(positon, std::ios::beg);
return file_size;
}
/* Read count objects of type T into pointer dest */
template <typename T> void ReadInto(T *dest, const std::size_t count)
{
+2 -6
View File
@@ -18,9 +18,7 @@ namespace storage
// Added at the start and end of each block as sanity check
const constexpr char CANARY[4] = {'O', 'S', 'R', 'M'};
const constexpr char *block_id_to_name[] = {"NAME_OFFSETS",
"NAME_BLOCKS",
"NAME_CHAR_LIST",
const constexpr char *block_id_to_name[] = {"NAME_CHAR_DATA",
"NAME_ID_LIST",
"VIA_NODE_LIST",
"GRAPH_NODE_LIST",
@@ -64,9 +62,7 @@ struct DataLayout
{
enum BlockID
{
NAME_OFFSETS = 0,
NAME_BLOCKS,
NAME_CHAR_LIST,
NAME_CHAR_DATA = 0,
NAME_ID_LIST,
VIA_NODE_LIST,
GRAPH_NODE_LIST,