Const'ed read-only functions in BasePlugin and derived classes.

This commit is contained in:
DennisOSRM 2011-12-30 12:20:36 +01:00
parent 5c10d2fae0
commit d2b5b8d854
5 changed files with 11 additions and 10 deletions

View File

@ -33,8 +33,8 @@ public:
BasePlugin() { }
//Maybe someone can explain the pure virtual destructor thing to me (dennis)
virtual ~BasePlugin() { }
virtual std::string GetDescriptor() = 0;
virtual std::string GetVersionString() = 0;
virtual std::string GetDescriptor() const = 0;
virtual std::string GetVersionString() const = 0 ;
virtual void HandleRequest(const RouteParameters & routeParameters, http::Reply& reply) = 0;
};

View File

@ -17,7 +17,9 @@ class HelloWorldPlugin : public BasePlugin {
public:
HelloWorldPlugin() {}
virtual ~HelloWorldPlugin() { /*std::cout << GetDescriptor() << " destructor" << std::endl;*/ }
std::string GetDescriptor() { return std::string("hello"); }
std::string GetDescriptor() const { return std::string("hello"); }
std::string GetVersionString() const { return std::string("0.1a"); }
void HandleRequest(const RouteParameters & routeParameters, http::Reply& reply) {
std::cout << "[hello world]: runnning handler" << std::endl;
reply.status = http::Reply::ok;
@ -36,7 +38,6 @@ public:
reply.content.append(content.str());
reply.content.append("</body></html>");
}
std::string GetVersionString() { return std::string("0.1a"); }
};
#endif /* HELLOWORLDPLUGIN_H_ */

View File

@ -37,8 +37,8 @@ public:
LocatePlugin(ObjectsForQueryStruct * objects) {
nodeHelpDesk = objects->nodeHelpDesk;
}
std::string GetDescriptor() { return std::string("locate"); }
std::string GetVersionString() { return std::string("0.3 (DL)"); }
std::string GetDescriptor() const { return std::string("locate"); }
std::string GetVersionString() const { return std::string("0.3 (DL)"); }
void HandleRequest(const RouteParameters & routeParameters, http::Reply& reply) {
//check number of parameters
if(routeParameters.parameters.size() != 2) {

View File

@ -43,8 +43,8 @@ public:
descriptorTable.Set("kml", 0);
descriptorTable.Set("json", 1);
}
std::string GetDescriptor() { return std::string("nearest"); }
std::string GetVersionString() { return std::string("0.3 (DL)"); }
std::string GetDescriptor() const { return std::string("nearest"); }
std::string GetVersionString() const { return std::string("0.3 (DL)"); }
void HandleRequest(const RouteParameters & routeParameters, http::Reply& reply) {
//check number of parameters
if(routeParameters.parameters.size() != 2) {

View File

@ -68,8 +68,8 @@ public:
DELETE( searchEngine );
}
std::string GetDescriptor() { return pluginDescriptorString; }
std::string GetVersionString() { return std::string("0.3 (DL)"); }
std::string GetDescriptor() const { return pluginDescriptorString; }
std::string GetVersionString() const { return std::string("0.3 (DL)"); }
void HandleRequest(const RouteParameters & routeParameters, http::Reply& reply) {
//check number of parameters
if(0 == routeParameters.options["start"].size() || 0 == routeParameters.options["dest"].size() ) {