Hashtable does not allocate during operator[], RouteParameters to
plugins are passed as ref and not as value.
This commit is contained in:
@@ -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_ */
|
||||
|
||||
@@ -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("<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 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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user