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