Added indexed array data type with variable and fixed group blocks
This commit is contained in:
committed by
Patrick Niklaus
parent
cedeb15ade
commit
6e1c4bfecd
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user