Check for valid data files. Implements #224

This commit is contained in:
DennisOSRM
2013-07-22 16:34:06 +02:00
parent 0367399c89
commit 4a39a4af1c
9 changed files with 123 additions and 43 deletions
+3 -1
View File
@@ -121,6 +121,7 @@ void ExtractionContainers::PrepareData(const std::string & output_file_name, con
//serialize restrictions
std::ofstream restrictionsOutstream;
restrictionsOutstream.open(restrictionsFileName.c_str(), std::ios::binary);
restrictionsOutstream.write((char*)&uuid, sizeof(UUID));
restrictionsOutstream.write((char*)&usableRestrictionsCounter, sizeof(unsigned));
for(restrictionsIT = restrictionsVector.begin(); restrictionsIT != restrictionsVector.end(); ++restrictionsIT) {
if(UINT_MAX != restrictionsIT->restriction.fromNode && UINT_MAX != restrictionsIT->restriction.toNode) {
@@ -131,6 +132,7 @@ void ExtractionContainers::PrepareData(const std::string & output_file_name, con
std::ofstream fout;
fout.open(output_file_name.c_str(), std::ios::binary);
fout.write((char*)&uuid, sizeof(UUID));
fout.write((char*)&usedNodeCounter, sizeof(unsigned));
time = get_timestamp();
std::cout << "[extractor] Confirming/Writing used nodes ... " << std::flush;
@@ -158,7 +160,7 @@ void ExtractionContainers::PrepareData(const std::string & output_file_name, con
std::cout << "[extractor] setting number of nodes ... " << std::flush;
std::ios::pos_type positionInFile = fout.tellp();
fout.seekp(std::ios::beg);
fout.seekp(std::ios::beg+sizeof(UUID));
fout.write((char*)&usedNodeCounter, sizeof(unsigned));
fout.seekp(positionInFile);
+2 -1
View File
@@ -23,6 +23,7 @@
#include "ExtractorStructs.h"
#include "../DataStructures/TimingUtil.h"
#include "../Util/UUID.h"
#include <boost/foreach.hpp>
#include <stxxl.h>
@@ -63,7 +64,7 @@ public:
STXXLStringVector nameVector;
STXXLRestrictionsVector restrictionsVector;
STXXLWayIDStartEndVector wayStartEndVector;
const UUID uuid;
};
#endif /* EXTRACTIONCONTAINERS_H_ */