72 static std::string
getFilePath(
const std::string& path);
88 const std::string& path);
99 static bool isSocket(
const std::string& name);
112 static bool isAbsolute(
const std::string& path);
127 const std::string& basePath);
141 static std::ostream&
writeInt(std::ostream& strm,
int value);
150 static std::ostream&
writeUInt(std::ostream& strm,
unsigned int value);
170 static std::ostream&
writeByte(std::ostream& strm,
unsigned char value);
183 static std::ostream&
writeString(std::ostream& strm,
const std::string& value);
204 template <
typename E>
205 static std::ostream&
writeEdgeVector(std::ostream& os,
const std::vector<E>& edges);
214 template <
typename E>
215 static void readEdgeVector(std::istream& in, std::vector<const E*>& edges,
const std::string& rid);
222 template <
typename E>
225 std::vector<unsigned int> follow;
226 unsigned int maxFollow = 0;
227 E prev = edges.front();
228 for (
typename std::vector<E>::const_iterator i = edges.begin() + 1; i != edges.end(); ++i) {
229 unsigned int idx = 0;
230 for (; idx < prev->getNoFollowing(); ++idx) {
234 if (prev->getFollower(idx) == (*i)) {
235 follow.push_back(idx);
236 if (idx > maxFollow) {
242 if (idx > 15 || idx == prev->getNoFollowing()) {
248 if (follow.empty()) {
249 for (
typename std::vector<E>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
253 const int bits = maxFollow > 3 ? 4 : 2;
254 const unsigned int numFields = 8 *
sizeof(
unsigned int) / bits;
257 unsigned int data = 0;
258 unsigned int field = 0;
259 for (std::vector<unsigned int>::const_iterator i = follow.begin(); i != follow.end(); ++i) {
262 if (field == numFields) {
278 template <
typename E>
281 in.read((
char*) &size,
sizeof(
int));
284 in.read((
char*) &bitsOrEntry,
sizeof(
int));
285 if (bitsOrEntry < 0) {
286 const unsigned int bits = -bitsOrEntry;
287 const unsigned int numFields = 8 *
sizeof(
unsigned int) / bits;
288 const unsigned int mask = (1 << bits) - 1;
290 in.read((
char*) &edgeID,
sizeof(
int));
291 const E* prev = E::dictionary(edgeID);
293 edges.push_back(prev);
295 unsigned int data = 0;
296 unsigned int field = numFields;
297 for (; size > 0; size--) {
298 if (field == numFields) {
299 in.read((
char*) &data,
sizeof(
int));
302 unsigned int followIndex = (data >> ((numFields - field - 1) * bits)) & mask;
303 if (followIndex >= prev->getNoFollowing()) {
304 throw ProcessError(
"Invalid follower index in route '" + rid +
"'!");
306 prev = prev->getFollower(followIndex);
307 edges.push_back(prev);
312 const E* edge = E::dictionary(bitsOrEntry);
314 throw ProcessError(
"An edge within the route '" + rid +
"' is not known!");
316 edges.push_back(edge);
319 in.read((
char*) &bitsOrEntry,
sizeof(
int));