diff --git a/DataStructures/HashTable.h b/DataStructures/HashTable.h
index dc974f7ff..20f9749fd 100644
--- a/DataStructures/HashTable.h
+++ b/DataStructures/HashTable.h
@@ -42,7 +42,7 @@ public:
void Set(const keyT& key, const valueT& value){
table[key] = value;
}
- valueT Find(const keyT& key) {
+ valueT Find(const keyT& key) const {
if(table.find(key) == table.end())
return valueT();
return table.find(key)->second;
@@ -58,9 +58,10 @@ public:
table.clear();
}
- inline
- valueT & operator[] (keyT key) {
- return table[key];
+ inline valueT operator[] (keyT key) const {
+ if(table.find(key) == table.end())
+ return valueT();
+ return table.find(key)->second;
}
unsigned Size() const {
return table.size();
diff --git a/Plugins/BasePlugin.h b/Plugins/BasePlugin.h
index 671bcb2f4..de3262ac8 100644
--- a/Plugins/BasePlugin.h
+++ b/Plugins/BasePlugin.h
@@ -35,7 +35,7 @@ public:
virtual ~BasePlugin() { }
virtual std::string GetDescriptor() = 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_ */
diff --git a/Plugins/HelloWorldPlugin.h b/Plugins/HelloWorldPlugin.h
index 9dcaa996c..4488474e9 100644
--- a/Plugins/HelloWorldPlugin.h
+++ b/Plugins/HelloWorldPlugin.h
@@ -18,7 +18,7 @@ public:
HelloWorldPlugin() {}
virtual ~HelloWorldPlugin() { /*std::cout << GetDescriptor() << " destructor" << std::endl;*/ }
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;
reply.status = http::Reply::ok;
reply.content.append("
Hello World Demonstration DocumentHello, World!
");
diff --git a/Plugins/LocatePlugin.h b/Plugins/LocatePlugin.h
index 122bde13d..962a3b3ac 100644
--- a/Plugins/LocatePlugin.h
+++ b/Plugins/LocatePlugin.h
@@ -39,7 +39,7 @@ public:
}
std::string GetDescriptor() { return std::string("locate"); }
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
if(routeParameters.parameters.size() != 2) {
reply = http::Reply::stockReply(http::Reply::badRequest);
diff --git a/Plugins/NearestPlugin.h b/Plugins/NearestPlugin.h
index 7674e0f83..e9690fb2a 100644
--- a/Plugins/NearestPlugin.h
+++ b/Plugins/NearestPlugin.h
@@ -45,7 +45,7 @@ public:
}
std::string GetDescriptor() { return std::string("nearest"); }
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
if(routeParameters.parameters.size() != 2) {
reply = http::Reply::stockReply(http::Reply::badRequest);
diff --git a/Plugins/ViaRoutePlugin.h b/Plugins/ViaRoutePlugin.h
index 2d5121b7e..20ef60d46 100644
--- a/Plugins/ViaRoutePlugin.h
+++ b/Plugins/ViaRoutePlugin.h
@@ -70,7 +70,7 @@ public:
std::string GetDescriptor() { return pluginDescriptorString; }
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
if(0 == routeParameters.options["start"].size() || 0 == routeParameters.options["dest"].size() ) {
reply = http::Reply::stockReply(http::Reply::badRequest);