66 static std::string
getFilePath(
const std::string& path);
73 static std::string
getFileFromPath(std::string path,
const bool removeExtension);
81 static std::string
addExtension(
const std::string& path,
const std::string& extension);
105 static bool isSocket(
const std::string& name);
117 static bool isAbsolute(
const std::string& path);
130 static std::string
checkForRelativity(
const std::string& filename,
const std::string& basePath);
146 static std::vector<std::string>
splitDirs(
const std::string& filename);
156 static std::string
fixRelative(
const std::string& filename,
const std::string& basePath,
const bool force, std::string curDir =
"");
162 static std::string
appendBeforeExtension(
const std::string& path,
const std::string& suffix,
bool checkSep =
true);
174 static std::ostream&
writeInt(std::ostream& strm,
int value);
184 static std::ostream&
writeFloat(std::ostream& strm,
double value);
192 static std::ostream&
writeByte(std::ostream& strm,
unsigned char value);
204 static std::ostream&
writeString(std::ostream& strm,
const std::string& value);
223 template <
typename E>
224 static std::ostream&
writeEdgeVector(std::ostream& os,
const std::vector<E>& edges);
232 template <
typename E>
233 static void readEdgeVector(std::istream& in, std::vector<const E*>& edges,
const std::string& rid);
241 std::vector<int> follow;
243 E prev = edges.front();
244 for (
typename std::vector<E>::const_iterator i = edges.begin() + 1; i != edges.end(); ++i) {
246 for (; idx < prev->getNumSuccessors(); ++idx) {
250 if (prev->getSuccessors()[idx] == (*i)) {
251 follow.push_back(idx);
252 if (idx > maxFollow) {
258 if (idx > 15 || idx == prev->getNumSuccessors()) {
264 if (follow.empty()) {
265 for (
typename std::vector<E>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
269 const int bits = maxFollow > 3 ? 4 : 2;
270 const int numFields = 8 *
sizeof(int) / bits;
275 for (std::vector<int>::const_iterator i = follow.begin(); i != follow.end(); ++i) {
278 if (field == numFields) {
297 in.read((
char*) &size,
sizeof(
int));
300 in.read((
char*) &bitsOrEntry,
sizeof(
int));
301 if (bitsOrEntry < 0) {
302 const int bits = -bitsOrEntry;
303 const int numFields = 8 *
sizeof(int) / bits;
304 const int mask = (1 << bits) - 1;
306 in.read((
char*) &edgeID,
sizeof(int));
307 const E* prev = E::getAllEdges()[edgeID];
309 edges.push_back(prev);
312 int field = numFields;
313 for (; size > 0; size--) {
314 if (field == numFields) {
315 in.read((
char*) &data,
sizeof(
int));
318 int followIndex = (data >> ((numFields - field - 1) * bits)) & mask;
319 if (followIndex >= prev->getNumSuccessors()) {
322 prev = prev->getSuccessors()[followIndex];
323 edges.push_back(prev);
328 const E* edge = E::getAllEdges()[bitsOrEntry];
330 throw ProcessError(
TLF(
"An edge within the route '%' is not known!", rid));
332 edges.push_back(edge);
335 in.read((
char*) &bitsOrEntry,
sizeof(
int));
Functions for an easier usage of files and paths.
static std::string fixRelative(const std::string &filename, const std::string &basePath, const bool force, std::string curDir="")
Fixes the relative path for the given filename in relation to the basePath (usually a config file).
static bool isAbsolute(const std::string &path)
Returns the information whether the given path is absolute.
static std::ostream & writeFloat(std::ostream &strm, double value)
Writes a float binary.
static std::string getConfigurationRelative(const std::string &configPath, const std::string &path)
Returns the second path as a relative path to the first file.
static void readEdgeVector(std::istream &in, std::vector< const E * > &edges, const std::string &rid)
Reads an edge vector binary.
static std::string checkForRelativity(const std::string &filename, const std::string &basePath)
Returns the path from a configuration so that it is accessible from the current working directory.
static std::string addExtension(const std::string &path, const std::string &extension)
Add an extension to the given file path.
static std::ostream & writeString(std::ostream &strm, const std::string &value)
Writes a string binary.
static bool isReadable(std::string path)
Checks whether the given file is readable.
static std::string appendBeforeExtension(const std::string &path, const std::string &suffix, bool checkSep=true)
append the given suffix after the file name but before the extension
static std::vector< std::string > splitDirs(const std::string &filename)
Splits the given file path into directory components.
static std::string getFilePath(const std::string &path)
Removes the file information from the given path.
static std::ostream & writeTime(std::ostream &strm, SUMOTime value)
Writes a time description binary.
static std::ostream & writeInt(std::ostream &strm, int value)
Writes an integer binary.
static std::ostream & writeEdgeVector(std::ostream &os, const std::vector< E > &edges)
Writes an edge vector binary.
static bool isSocket(const std::string &name)
Returns the information whether the given name represents a socket.
static std::string getFileFromPath(std::string path, const bool removeExtension)
Removes the path information from the given path.
static bool isDirectory(std::string path)
Checks whether the given file is a directory.
static std::string getCurrentDir()
Get the current working directory.
static std::ostream & writeByte(std::ostream &strm, unsigned char value)
Writes a byte binary.
static std::string prependToLastPathComponent(const std::string &prefix, const std::string &path)
prepend the given prefix to the last path component of the given file path