Load timestamp string from file
This commit is contained in:
parent
358f12d910
commit
6769f83d5b
@ -28,8 +28,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
|
|
||||||
class TimestampPlugin : public BasePlugin {
|
class TimestampPlugin : public BasePlugin {
|
||||||
public:
|
public:
|
||||||
TimestampPlugin(QueryObjectsStorage * objects) {
|
TimestampPlugin(QueryObjectsStorage * o) : objects(o) {
|
||||||
nodeHelpDesk = objects->nodeHelpDesk;
|
|
||||||
}
|
}
|
||||||
std::string GetDescriptor() const { return std::string("timestamp"); }
|
std::string GetDescriptor() const { return std::string("timestamp"); }
|
||||||
std::string GetVersionString() const { return std::string("0.3 (DL)"); }
|
std::string GetVersionString() const { return std::string("0.3 (DL)"); }
|
||||||
@ -50,7 +49,7 @@ public:
|
|||||||
reply.content += ("\"status\":");
|
reply.content += ("\"status\":");
|
||||||
reply.content += "0,";
|
reply.content += "0,";
|
||||||
reply.content += ("\"timestamp\":\"");
|
reply.content += ("\"timestamp\":\"");
|
||||||
reply.content += "n/a";
|
reply.content += objects->timestamp;
|
||||||
reply.content += "\"";
|
reply.content += "\"";
|
||||||
reply.content += ",\"transactionId\":\"OSRM Routing Engine JSON timestamp (v0.3)\"";
|
reply.content += ",\"transactionId\":\"OSRM Routing Engine JSON timestamp (v0.3)\"";
|
||||||
reply.content += ("}");
|
reply.content += ("}");
|
||||||
@ -72,14 +71,7 @@ public:
|
|||||||
reply.headers[0].value = tmp;
|
reply.headers[0].value = tmp;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
inline bool checkCoord(const _Coordinate & c) {
|
QueryObjectsStorage * objects;
|
||||||
if(c.lat > 90*100000 || c.lat < -90*100000 || c.lon > 180*100000 || c.lon <-180*100000) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
NodeInformationHelpDesk * nodeHelpDesk;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* TIMESTAMPPLUGIN_H_ */
|
#endif /* TIMESTAMPPLUGIN_H_ */
|
||||||
|
@ -22,7 +22,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
#include "QueryObjectsStorage.h"
|
#include "QueryObjectsStorage.h"
|
||||||
#include "../../Util/GraphLoader.h"
|
#include "../../Util/GraphLoader.h"
|
||||||
|
|
||||||
QueryObjectsStorage::QueryObjectsStorage(std::string hsgrPath, std::string ramIndexPath, std::string fileIndexPath, std::string nodesPath, std::string edgesPath, std::string namesPath, std::string psd) {
|
QueryObjectsStorage::QueryObjectsStorage(std::string hsgrPath, std::string ramIndexPath, std::string fileIndexPath, std::string nodesPath, std::string edgesPath, std::string namesPath, std::string timestampPath, std::string psd) {
|
||||||
INFO("loading graph data");
|
INFO("loading graph data");
|
||||||
std::ifstream hsgrInStream(hsgrPath.c_str(), std::ios::binary);
|
std::ifstream hsgrInStream(hsgrPath.c_str(), std::ios::binary);
|
||||||
//Deserialize road network graph
|
//Deserialize road network graph
|
||||||
@ -35,6 +35,14 @@ QueryObjectsStorage::QueryObjectsStorage(std::string hsgrPath, std::string ramIn
|
|||||||
assert(0 == nodeList.size());
|
assert(0 == nodeList.size());
|
||||||
assert(0 == edgeList.size());
|
assert(0 == edgeList.size());
|
||||||
|
|
||||||
|
if(timestampPath.length()) {
|
||||||
|
INFO("Loading Timestamp")
|
||||||
|
std::ifstream timestampInStream(timestampPath.c_str());
|
||||||
|
getline(timestampInStream, timestamp);
|
||||||
|
timestampInStream.close();
|
||||||
|
}
|
||||||
|
if(!timestamp.length())
|
||||||
|
timestamp = "n/a";
|
||||||
|
|
||||||
INFO("Loading auxiliary information");
|
INFO("Loading auxiliary information");
|
||||||
//Init nearest neighbor data structure
|
//Init nearest neighbor data structure
|
||||||
|
@ -36,9 +36,10 @@ struct QueryObjectsStorage {
|
|||||||
NodeInformationHelpDesk * nodeHelpDesk;
|
NodeInformationHelpDesk * nodeHelpDesk;
|
||||||
std::vector<std::string> names;
|
std::vector<std::string> names;
|
||||||
QueryGraph * graph;
|
QueryGraph * graph;
|
||||||
|
std::string timestamp;
|
||||||
unsigned checkSum;
|
unsigned checkSum;
|
||||||
|
|
||||||
QueryObjectsStorage(std::string hsgrPath, std::string ramIndexPath, std::string fileIndexPath, std::string nodesPath, std::string edgesPath, std::string namesPath, std::string psd = "route");
|
QueryObjectsStorage(std::string hsgrPath, std::string ramIndexPath, std::string fileIndexPath, std::string nodesPath, std::string edgesPath, std::string namesPath, std::string timestampPath, std::string psd = "route");
|
||||||
|
|
||||||
~QueryObjectsStorage();
|
~QueryObjectsStorage();
|
||||||
};
|
};
|
||||||
|
@ -101,7 +101,9 @@ int main (int argc, char *argv[]) {
|
|||||||
serverConfig.GetParameter("fileIndex"),
|
serverConfig.GetParameter("fileIndex"),
|
||||||
serverConfig.GetParameter("nodesData"),
|
serverConfig.GetParameter("nodesData"),
|
||||||
serverConfig.GetParameter("edgesData"),
|
serverConfig.GetParameter("edgesData"),
|
||||||
serverConfig.GetParameter("namesData"));
|
serverConfig.GetParameter("namesData"),
|
||||||
|
serverConfig.GetParameter("timestamp")
|
||||||
|
);
|
||||||
|
|
||||||
h.RegisterPlugin(new HelloWorldPlugin());
|
h.RegisterPlugin(new HelloWorldPlugin());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user