make plugins templates that plug into data facade

This commit is contained in:
Dennis Luxen 2013-09-18 18:32:50 +02:00
parent b51d3da7e5
commit f09e9b7790
4 changed files with 17 additions and 8 deletions

View File

@ -36,9 +36,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*
* 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; }

View File

@ -31,15 +31,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#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")
@ -121,7 +124,7 @@ public:
}
private:
QueryObjectsStorage * m_query_objects;
DataFacadeT * m_query_objects;
HashTable<std::string, unsigned> descriptorTable;
std::string descriptor_string;
};

View File

@ -29,10 +29,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#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; }
@ -73,7 +75,7 @@ public:
reply.headers[0].value = tmp;
}
private:
QueryObjectsStorage * objects;
DataFacadeT * objects;
std::string descriptor_string;
};

View File

@ -37,7 +37,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#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"
@ -48,6 +47,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <string>
#include <vector>
//TODO: Rework data access to go through facade
template<class DataFacadeT>
class ViaRoutePlugin : public BasePlugin {
private:
NodeInformationHelpDesk * nodeHelpDesk;
@ -56,7 +57,7 @@ private:
SearchEngine * searchEnginePtr;
public:
ViaRoutePlugin(QueryObjectsStorage * objects)
ViaRoutePlugin(DataFacadeT * objects)
:
// objects(objects),
descriptor_string("viaroute")