Implements Mapping for NodeBasedGraph -> EdgeBasedgraph Translation
This commit is contained in:
committed by
Patrick Niklaus
parent
299d071e9d
commit
f71d742b5e
+26
-8
@@ -43,6 +43,7 @@ class FileReader
|
||||
VerifyFingerprint,
|
||||
HasNoFingerprint
|
||||
};
|
||||
|
||||
FileReader(const std::string &filename, const FingerprintFlag flag)
|
||||
: FileReader(boost::filesystem::path(filename), flag)
|
||||
{
|
||||
@@ -210,10 +211,6 @@ class FileReader
|
||||
|
||||
class FileWriter
|
||||
{
|
||||
private:
|
||||
const boost::filesystem::path filepath;
|
||||
boost::filesystem::ofstream output_stream;
|
||||
|
||||
public:
|
||||
enum FingerprintFlag
|
||||
{
|
||||
@@ -227,7 +224,7 @@ class FileWriter
|
||||
}
|
||||
|
||||
FileWriter(const boost::filesystem::path &filepath_, const FingerprintFlag flag)
|
||||
: filepath(filepath_)
|
||||
: filepath(filepath_), fingerprint(flag)
|
||||
{
|
||||
output_stream.open(filepath, std::ios::binary);
|
||||
if (!output_stream)
|
||||
@@ -278,9 +275,30 @@ class FileWriter
|
||||
const auto fingerprint = util::FingerPrint::GetValid();
|
||||
return WriteOne(fingerprint);
|
||||
}
|
||||
|
||||
template <typename T> void Skip(const std::size_t element_count)
|
||||
{
|
||||
boost::iostreams::seek(output_stream, element_count * sizeof(T), BOOST_IOS::cur);
|
||||
}
|
||||
|
||||
void SkipToBeginning()
|
||||
{
|
||||
boost::iostreams::seek(output_stream, 0, std::ios::beg);
|
||||
|
||||
// If we wrote a Fingerprint, skip over it
|
||||
if (fingerprint == FingerprintFlag::GenerateFingerprint)
|
||||
Skip<util::FingerPrint>(1);
|
||||
|
||||
// Should probably return a functor for jumping back to the current pos.
|
||||
}
|
||||
|
||||
private:
|
||||
const boost::filesystem::path filepath;
|
||||
boost::filesystem::ofstream output_stream;
|
||||
FingerprintFlag fingerprint;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // ns io
|
||||
} // ns storage
|
||||
} // ns osrm
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user