Merge branch 'master' of https://github.com/DennisOSRM/Project-OSRM
This commit is contained in:
commit
913c2e5713
@ -42,7 +42,7 @@ public:
|
|||||||
void Set(const keyT& key, const valueT& value){
|
void Set(const keyT& key, const valueT& value){
|
||||||
table[key] = value;
|
table[key] = value;
|
||||||
}
|
}
|
||||||
valueT Find(const keyT& key) {
|
valueT Find(const keyT& key) const {
|
||||||
if(table.find(key) == table.end())
|
if(table.find(key) == table.end())
|
||||||
return valueT();
|
return valueT();
|
||||||
return table.find(key)->second;
|
return table.find(key)->second;
|
||||||
@ -58,9 +58,10 @@ public:
|
|||||||
table.clear();
|
table.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline valueT operator[] (keyT key) const {
|
||||||
valueT & operator[] (keyT key) {
|
if(table.find(key) == table.end())
|
||||||
return table[key];
|
return valueT();
|
||||||
|
return table.find(key)->second;
|
||||||
}
|
}
|
||||||
unsigned Size() const {
|
unsigned Size() const {
|
||||||
return table.size();
|
return table.size();
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
virtual ~BasePlugin() { }
|
virtual ~BasePlugin() { }
|
||||||
virtual std::string GetDescriptor() = 0;
|
virtual std::string GetDescriptor() = 0;
|
||||||
virtual std::string GetVersionString() = 0;
|
virtual std::string GetVersionString() = 0;
|
||||||
virtual void HandleRequest(RouteParameters routeParameters, http::Reply& reply) = 0;
|
virtual void HandleRequest(const RouteParameters & routeParameters, http::Reply& reply) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BASEPLUGIN_H_ */
|
#endif /* BASEPLUGIN_H_ */
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
HelloWorldPlugin() {}
|
HelloWorldPlugin() {}
|
||||||
virtual ~HelloWorldPlugin() { /*std::cout << GetDescriptor() << " destructor" << std::endl;*/ }
|
virtual ~HelloWorldPlugin() { /*std::cout << GetDescriptor() << " destructor" << std::endl;*/ }
|
||||||
std::string GetDescriptor() { return std::string("hello"); }
|
std::string GetDescriptor() { return std::string("hello"); }
|
||||||
void HandleRequest(RouteParameters routeParameters, http::Reply& reply) {
|
void HandleRequest(const RouteParameters & routeParameters, http::Reply& reply) {
|
||||||
std::cout << "[hello world]: runnning handler" << std::endl;
|
std::cout << "[hello world]: runnning handler" << std::endl;
|
||||||
reply.status = http::Reply::ok;
|
reply.status = http::Reply::ok;
|
||||||
reply.content.append("<html><head><title>Hello World Demonstration Document</title></head><body><h1>Hello, World!</h1>");
|
reply.content.append("<html><head><title>Hello World Demonstration Document</title></head><body><h1>Hello, World!</h1>");
|
||||||
|
@ -39,7 +39,7 @@ public:
|
|||||||
}
|
}
|
||||||
std::string GetDescriptor() { return std::string("locate"); }
|
std::string GetDescriptor() { return std::string("locate"); }
|
||||||
std::string GetVersionString() { return std::string("0.3 (DL)"); }
|
std::string GetVersionString() { return std::string("0.3 (DL)"); }
|
||||||
void HandleRequest(RouteParameters routeParameters, http::Reply& reply) {
|
void HandleRequest(const RouteParameters & routeParameters, http::Reply& reply) {
|
||||||
//check number of parameters
|
//check number of parameters
|
||||||
if(routeParameters.parameters.size() != 2) {
|
if(routeParameters.parameters.size() != 2) {
|
||||||
reply = http::Reply::stockReply(http::Reply::badRequest);
|
reply = http::Reply::stockReply(http::Reply::badRequest);
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
}
|
}
|
||||||
std::string GetDescriptor() { return std::string("nearest"); }
|
std::string GetDescriptor() { return std::string("nearest"); }
|
||||||
std::string GetVersionString() { return std::string("0.3 (DL)"); }
|
std::string GetVersionString() { return std::string("0.3 (DL)"); }
|
||||||
void HandleRequest(RouteParameters routeParameters, http::Reply& reply) {
|
void HandleRequest(const RouteParameters & routeParameters, http::Reply& reply) {
|
||||||
//check number of parameters
|
//check number of parameters
|
||||||
if(routeParameters.parameters.size() != 2) {
|
if(routeParameters.parameters.size() != 2) {
|
||||||
reply = http::Reply::stockReply(http::Reply::badRequest);
|
reply = http::Reply::stockReply(http::Reply::badRequest);
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
|
|
||||||
std::string GetDescriptor() { return pluginDescriptorString; }
|
std::string GetDescriptor() { return pluginDescriptorString; }
|
||||||
std::string GetVersionString() { return std::string("0.3 (DL)"); }
|
std::string GetVersionString() { return std::string("0.3 (DL)"); }
|
||||||
void HandleRequest(RouteParameters routeParameters, http::Reply& reply) {
|
void HandleRequest(const RouteParameters & routeParameters, http::Reply& reply) {
|
||||||
//check number of parameters
|
//check number of parameters
|
||||||
if(0 == routeParameters.options["start"].size() || 0 == routeParameters.options["dest"].size() ) {
|
if(0 == routeParameters.options["start"].size() || 0 == routeParameters.options["dest"].size() ) {
|
||||||
reply = http::Reply::stockReply(http::Reply::badRequest);
|
reply = http::Reply::stockReply(http::Reply::badRequest);
|
||||||
|
@ -28,7 +28,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
inline const int omp_get_num_procs() { return 1; }
|
inline const int omp_get_num_procs() { return 1; }
|
||||||
inline const int omp_get_max_threads() { return 1; }
|
inline const int omp_get_max_threads() { return 1; }
|
||||||
inline const int omp_get_thread_num() { return 0; }
|
inline const int omp_get_thread_num() { return 0; }
|
||||||
inline const int omp_set_num_threads(int i) {}
|
inline const void omp_set_num_threads(int i) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user