58 static bool exists(std::string path);
71 static std::string
getFilePath(
const std::string& path);
87 const std::string& path);
98 static bool isSocket(
const std::string& name);
111 static bool isAbsolute(
const std::string& path);
126 const std::string& basePath);
140 static std::ostream&
writeInt(std::ostream& strm,
int value);
149 static std::ostream&
writeUInt(std::ostream& strm,
unsigned int value);
169 static std::ostream&
writeByte(std::ostream& strm,
unsigned char value);
182 static std::ostream&
writeString(std::ostream& strm,
const std::string& value);
203 template <
typename E>
204 static std::ostream&
writeEdgeVector(std::ostream& os,
const std::vector<E>& edges);
213 template <
typename E>
214 static void readEdgeVector(std::istream& in, std::vector<const E*>& edges,
const std::string& rid);
221 template <
typename E>
224 std::vector<unsigned int> follow;
225 unsigned int maxFollow = 0;
226 E prev = edges.front();
227 for (
typename std::vector<E>::const_iterator i = edges.begin() + 1; i != edges.end(); ++i) {
228 unsigned int idx = 0;
229 for (; idx < prev->getNoFollowing(); ++idx) {
233 if (prev->getFollower(idx) == (*i)) {
234 follow.push_back(idx);
235 if (idx > maxFollow) {
241 if (idx > 15 || idx == prev->getNoFollowing()) {
247 if (follow.empty()) {
248 for (
typename std::vector<E>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
252 const int bits = maxFollow > 3 ? 4 : 2;
253 const unsigned int numFields = 8 *
sizeof(
unsigned int) / bits;
256 unsigned int data = 0;
257 unsigned int field = 0;
258 for (std::vector<unsigned int>::const_iterator i = follow.begin(); i != follow.end(); ++i) {
261 if (field == numFields) {
277 template <
typename E>
280 in.read((
char*) &size,
sizeof(
int));
283 in.read((
char*) &bitsOrEntry,
sizeof(
int));
284 if (bitsOrEntry < 0) {
285 const unsigned int bits = -bitsOrEntry;
286 const unsigned int numFields = 8 *
sizeof(
unsigned int) / bits;
287 const unsigned int mask = (1 << bits) - 1;
289 in.read((
char*) &edgeID,
sizeof(
int));
290 const E* prev = E::dictionary(edgeID);
292 edges.push_back(prev);
294 unsigned int data = 0;
295 unsigned int field = numFields;
296 for (; size > 0; size--) {
297 if (field == numFields) {
298 in.read((
char*) &data,
sizeof(
int));
301 unsigned int followIndex = (data >> ((numFields - field - 1) * bits)) & mask;
302 if (followIndex >= prev->getNoFollowing()) {
303 throw ProcessError(
"Invalid follower index in route '" + rid +
"'!");
305 prev = prev->getFollower(followIndex);
306 edges.push_back(prev);
311 const E* edge = E::dictionary(bitsOrEntry);
313 throw ProcessError(
"An edge within the route '" + rid +
"' is not known!");
315 edges.push_back(edge);
318 in.read((
char*) &bitsOrEntry,
sizeof(
int));
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 bool isSocket(const std::string &name)
Returns the information whether the given name represents a socket.
static std::ostream & writeFloat(std::ostream &strm, SUMOReal value)
Writes a float binary.
static std::ostream & writeUInt(std::ostream &strm, unsigned int value)
Writes an unsigned integer binary.
static std::ostream & writeTime(std::ostream &strm, SUMOTime value)
Writes a time description binary.
static bool isAbsolute(const std::string &path)
Returns the information whether the given path is absolute.
Functions for an easier usage of files and paths.
static bool exists(std::string path)
Checks whether the given file exists.
static std::ostream & writeInt(std::ostream &strm, int value)
Writes an integer binary.
static std::ostream & writeByte(std::ostream &strm, unsigned char value)
Writes a byte binary.
static std::string checkForRelativity(const std::string &filename, const std::string &basePath)
Returns the path from a configuration so that it is accessable from the current working directory...
static void readEdgeVector(std::istream &in, std::vector< const E * > &edges, const std::string &rid)
Reads an edge vector binary.
static std::ostream & writeEdgeVector(std::ostream &os, const std::vector< E > &edges)
Writes an edge vector binary.
static std::string getFilePath(const std::string &path)
Removes the file information from the given path.
static std::ostream & writeString(std::ostream &strm, const std::string &value)
Writes a string binary.