make plugins templates that plug into data facade
This commit is contained in:
		
							parent
							
								
									003c1df53e
								
							
						
					
					
						commit
						d907be264b
					
				| @ -29,9 +29,12 @@ or see http://www.gnu.org/licenses/agpl.txt. | ||||
| /*
 | ||||
|  * This Plugin locates the nearest node in the road network for a given coordinate. | ||||
|  */ | ||||
| //TODO: Rework data access to go through facade
 | ||||
| 
 | ||||
| template<class DataFacadeT> | ||||
| class LocatePlugin : public BasePlugin { | ||||
| public: | ||||
|     LocatePlugin(QueryObjectsStorage * objects) : descriptor_string("locate") { | ||||
|     LocatePlugin(DataFacadeT * objects) : descriptor_string("locate") { | ||||
|         nodeHelpDesk = objects->nodeHelpDesk; | ||||
|     } | ||||
|     const std::string & GetDescriptor() const { return descriptor_string; } | ||||
|  | ||||
| @ -24,15 +24,18 @@ or see http://www.gnu.org/licenses/agpl.txt. | ||||
| #include "BasePlugin.h" | ||||
| 
 | ||||
| #include "../DataStructures/NodeInformationHelpDesk.h" | ||||
| #include "../Server/DataStructures/QueryObjectsStorage.h" | ||||
| #include "../Util/StringUtil.h" | ||||
| 
 | ||||
| /*
 | ||||
|  * This Plugin locates the nearest point on a street in the road network for a given coordinate. | ||||
|  */ | ||||
| 
 | ||||
| //TODO: Rework data access to go through facade
 | ||||
| 
 | ||||
| template<class DataFacadeT> | ||||
| class NearestPlugin : public BasePlugin { | ||||
| public: | ||||
|     NearestPlugin(QueryObjectsStorage * objects ) | ||||
|     NearestPlugin(DataFacadeT * objects ) | ||||
|      : | ||||
|         m_query_objects(objects), | ||||
|         descriptor_string("nearest") | ||||
| @ -114,7 +117,7 @@ public: | ||||
|     } | ||||
| 
 | ||||
| private: | ||||
|     QueryObjectsStorage * m_query_objects; | ||||
|     DataFacadeT * m_query_objects; | ||||
|     HashTable<std::string, unsigned> descriptorTable; | ||||
|     std::string descriptor_string; | ||||
| }; | ||||
|  | ||||
| @ -22,10 +22,12 @@ or see http://www.gnu.org/licenses/agpl.txt. | ||||
| #define TIMESTAMPPLUGIN_H_ | ||||
| 
 | ||||
| #include "BasePlugin.h" | ||||
| //TODO: Rework data access to go through facade
 | ||||
| 
 | ||||
| template<class DataFacadeT> | ||||
| class TimestampPlugin : public BasePlugin { | ||||
| public: | ||||
|     TimestampPlugin(QueryObjectsStorage * o) | ||||
|     TimestampPlugin(DataFacadeT * o) | ||||
|      : objects(o), descriptor_string("timestamp") | ||||
|     { } | ||||
|     const std::string & GetDescriptor() const { return descriptor_string; } | ||||
| @ -66,7 +68,7 @@ public: | ||||
|         reply.headers[0].value = tmp; | ||||
|     } | ||||
| private: | ||||
|     QueryObjectsStorage * objects; | ||||
|     DataFacadeT * objects; | ||||
|     std::string descriptor_string; | ||||
| }; | ||||
| 
 | ||||
|  | ||||
| @ -30,7 +30,6 @@ or see http://www.gnu.org/licenses/agpl.txt. | ||||
| #include "../Descriptors/BaseDescriptor.h" | ||||
| #include "../Descriptors/GPXDescriptor.h" | ||||
| #include "../Descriptors/JSONDescriptor.h" | ||||
| #include "../Server/DataStructures/QueryObjectsStorage.h" | ||||
| #include "../Util/SimpleLogger.h" | ||||
| #include "../Util/StringUtil.h" | ||||
| 
 | ||||
| @ -41,6 +40,8 @@ or see http://www.gnu.org/licenses/agpl.txt. | ||||
| #include <string> | ||||
| #include <vector> | ||||
| 
 | ||||
| //TODO: Rework data access to go through facade
 | ||||
| template<class DataFacadeT> | ||||
| class ViaRoutePlugin : public BasePlugin { | ||||
| private: | ||||
|     NodeInformationHelpDesk * nodeHelpDesk; | ||||
| @ -49,7 +50,7 @@ private: | ||||
|     SearchEngine * searchEnginePtr; | ||||
| public: | ||||
| 
 | ||||
|     ViaRoutePlugin(QueryObjectsStorage * objects) | ||||
|     ViaRoutePlugin(DataFacadeT * objects) | ||||
|      : | ||||
|         // objects(objects),
 | ||||
|         descriptor_string("viaroute") | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user