Mockups for data facades
This commit is contained in:
parent
f844e9e702
commit
003c1df53e
@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
or see http://www.gnu.org/licenses/agpl.txt.
|
or see http://www.gnu.org/licenses/agpl.txt.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//TODO: Umbauen in Private Data Facade
|
||||||
|
|
||||||
#ifndef NODEINFORMATIONHELPDESK_H_
|
#ifndef NODEINFORMATIONHELPDESK_H_
|
||||||
#define NODEINFORMATIONHELPDESK_H_
|
#define NODEINFORMATIONHELPDESK_H_
|
||||||
|
|
||||||
|
@ -22,13 +22,14 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
#define STATICGRAPH_H_INCLUDED
|
#define STATICGRAPH_H_INCLUDED
|
||||||
|
|
||||||
#include "../DataStructures/Percent.h"
|
#include "../DataStructures/Percent.h"
|
||||||
|
#include "../DataStructures/SharedMemoryVectorWrapper.h"
|
||||||
#include "../Util/SimpleLogger.h"
|
#include "../Util/SimpleLogger.h"
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
template< typename EdgeDataT>
|
template< typename EdgeDataT, bool UseSharedMemory = false>
|
||||||
class StaticGraph {
|
class StaticGraph {
|
||||||
public:
|
public:
|
||||||
typedef NodeID NodeIterator;
|
typedef NodeID NodeIterator;
|
||||||
@ -40,8 +41,9 @@ public:
|
|||||||
NodeIterator source;
|
NodeIterator source;
|
||||||
NodeIterator target;
|
NodeIterator target;
|
||||||
bool operator<( const InputEdge& right ) const {
|
bool operator<( const InputEdge& right ) const {
|
||||||
if ( source != right.source )
|
if ( source != right.source ) {
|
||||||
return source < right.source;
|
return source < right.source;
|
||||||
|
}
|
||||||
return target < right.target;
|
return target < right.target;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -82,16 +84,22 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticGraph( std::vector<_StrNode> & nodes, std::vector<_StrEdge> & edges) {
|
StaticGraph(
|
||||||
|
ShMemVector<_StrNode, UseSharedMemory> & nodes,
|
||||||
|
ShMemVector<_StrEdge, UseSharedMemory> & edges
|
||||||
|
) {
|
||||||
_numNodes = nodes.size();
|
_numNodes = nodes.size();
|
||||||
_numEdges = edges.size();
|
_numEdges = edges.size();
|
||||||
|
|
||||||
_nodes.swap(nodes);
|
_nodes.swap(nodes);
|
||||||
_edges.swap(edges);
|
_edges.swap(edges);
|
||||||
|
|
||||||
|
if( !UseSharedMemory ) {
|
||||||
//Add dummy node to end of _nodes array;
|
//Add dummy node to end of _nodes array;
|
||||||
_nodes.push_back(_nodes.back());
|
_nodes.push_back(_nodes.back());
|
||||||
|
} else {
|
||||||
|
//TODO: Move to graph array construction
|
||||||
|
}
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
Percent p(GetNumberOfNodes());
|
Percent p(GetNumberOfNodes());
|
||||||
for(unsigned u = 0; u < GetNumberOfNodes(); ++u) {
|
for(unsigned u = 0; u < GetNumberOfNodes(); ++u) {
|
||||||
@ -176,9 +184,10 @@ public:
|
|||||||
EdgeIterator tmp = FindEdge( from, to );
|
EdgeIterator tmp = FindEdge( from, to );
|
||||||
if(UINT_MAX == tmp) {
|
if(UINT_MAX == tmp) {
|
||||||
tmp = FindEdge( to, from );
|
tmp = FindEdge( to, from );
|
||||||
if(UINT_MAX != tmp)
|
if(UINT_MAX != tmp) {
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,8 +196,8 @@ private:
|
|||||||
NodeIterator _numNodes;
|
NodeIterator _numNodes;
|
||||||
EdgeIterator _numEdges;
|
EdgeIterator _numEdges;
|
||||||
|
|
||||||
std::vector< _StrNode > _nodes;
|
ShMemVector< _StrNode, UseSharedMemory > _nodes;
|
||||||
std::vector< _StrEdge > _edges;
|
ShMemVector< _StrEdge, UseSharedMemory > _edges;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // STATICGRAPH_H_INCLUDED
|
#endif // STATICGRAPH_H_INCLUDED
|
||||||
|
@ -102,6 +102,7 @@ OSRM::OSRM(const char * server_ini_path, const bool use_shared_memory)
|
|||||||
//TODO: fetch pointers from shared memory
|
//TODO: fetch pointers from shared memory
|
||||||
|
|
||||||
//TODO: objects = new QueryObjectsStorage()
|
//TODO: objects = new QueryObjectsStorage()
|
||||||
|
query_data_facade = new SharedDataFacade<QueryEdge::EdgeData>();
|
||||||
|
|
||||||
//TODO: generate shared memory plugins
|
//TODO: generate shared memory plugins
|
||||||
RegisterPlugin(new HelloWorldPlugin());
|
RegisterPlugin(new HelloWorldPlugin());
|
||||||
|
@ -30,6 +30,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
#include "../Plugins/TimestampPlugin.h"
|
#include "../Plugins/TimestampPlugin.h"
|
||||||
#include "../Plugins/ViaRoutePlugin.h"
|
#include "../Plugins/ViaRoutePlugin.h"
|
||||||
#include "../Server/DataStructures/BaseDataFacade.h"
|
#include "../Server/DataStructures/BaseDataFacade.h"
|
||||||
|
#include "../Server/DataStructures/InternalDataFacade.h"
|
||||||
|
#include "../Server/DataStructures/SharedDataFacade.h"
|
||||||
#include "../Server/DataStructures/RouteParameters.h"
|
#include "../Server/DataStructures/RouteParameters.h"
|
||||||
#include "../Util/IniFile.h"
|
#include "../Util/IniFile.h"
|
||||||
#include "../Util/InputFileUtil.h"
|
#include "../Util/InputFileUtil.h"
|
||||||
@ -40,6 +42,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/noncopyable.hpp>
|
#include <boost/noncopyable.hpp>
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -26,6 +26,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
#include "../../DataStructures/Coordinate.h"
|
#include "../../DataStructures/Coordinate.h"
|
||||||
#include "../../DataStructures/PhantomNodes.h"
|
#include "../../DataStructures/PhantomNodes.h"
|
||||||
#include "../../DataStructures/TurnInstructions.h"
|
#include "../../DataStructures/TurnInstructions.h"
|
||||||
|
#include "../../Util/OSRMException.h"
|
||||||
#include "../../typedefs.h"
|
#include "../../typedefs.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
94
Server/DataStructures/InternalDataFacade.h
Normal file
94
Server/DataStructures/InternalDataFacade.h
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
open source routing machine
|
||||||
|
Copyright (C) Dennis Luxen, others 2010
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU AFFERO General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
or see http://www.gnu.org/licenses/agpl.txt.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INTERNAL_DATA_FACADE
|
||||||
|
#define INTERNAL_DATA_FACADE
|
||||||
|
|
||||||
|
#include "BaseDataFacade.h"
|
||||||
|
|
||||||
|
template<class EdgeDataT>
|
||||||
|
class InternalDataFacade : public BaseDataFacade<EdgeDataT> {
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
public:
|
||||||
|
//search graph access
|
||||||
|
unsigned GetNumberOfNodes() const { return 0; }
|
||||||
|
|
||||||
|
unsigned GetNumberOfEdges() const { return 0; }
|
||||||
|
|
||||||
|
unsigned GetOutDegree( const NodeID n ) const { return 0; }
|
||||||
|
|
||||||
|
NodeID GetTarget( const EdgeID e ) const { return 0; }
|
||||||
|
|
||||||
|
EdgeDataT &GetEdgeData( const EdgeID e ) { return EdgeDataT(); }
|
||||||
|
|
||||||
|
const EdgeDataT &GetEdgeData( const EdgeID e ) const { return EdgeDataT(); }
|
||||||
|
|
||||||
|
EdgeID BeginEdges( const NodeID n ) const { return 0; }
|
||||||
|
|
||||||
|
EdgeID EndEdges( const NodeID n ) const { return 0; }
|
||||||
|
|
||||||
|
//searches for a specific edge
|
||||||
|
EdgeID FindEdge( const NodeID from, const NodeID to ) const { return 0; }
|
||||||
|
|
||||||
|
EdgeID FindEdgeInEitherDirection(
|
||||||
|
const NodeID from,
|
||||||
|
const NodeID to
|
||||||
|
) const { return 0; }
|
||||||
|
|
||||||
|
EdgeID FindEdgeIndicateIfReverse(
|
||||||
|
const NodeID from,
|
||||||
|
const NodeID to,
|
||||||
|
bool & result
|
||||||
|
) const { return 0; }
|
||||||
|
|
||||||
|
//node and edge information access
|
||||||
|
FixedPointCoordinate GetCoordinateOfNode(
|
||||||
|
const unsigned id
|
||||||
|
) const { return FixedPointCoordinate(); };
|
||||||
|
|
||||||
|
TurnInstruction GetTurnInstructionForEdgeID(
|
||||||
|
const unsigned id
|
||||||
|
) const { return 0; }
|
||||||
|
|
||||||
|
bool LocateClosestEndPointForCoordinate(
|
||||||
|
const FixedPointCoordinate& input_coordinate,
|
||||||
|
FixedPointCoordinate& result,
|
||||||
|
const unsigned zoom_level = 18
|
||||||
|
) const { return false; }
|
||||||
|
|
||||||
|
bool FindPhantomNodeForCoordinate(
|
||||||
|
const FixedPointCoordinate & input_coordinate,
|
||||||
|
PhantomNode & resulting_phantom_node,
|
||||||
|
const unsigned zoom_level
|
||||||
|
) const { return false; }
|
||||||
|
|
||||||
|
unsigned GetCheckSum() const { return 0; }
|
||||||
|
|
||||||
|
unsigned GetNameIndexFromEdgeID(const unsigned id) const { return 0; };
|
||||||
|
|
||||||
|
void GetName(
|
||||||
|
const unsigned name_id,
|
||||||
|
std::string & result
|
||||||
|
) const { return; };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INTERNAL_DATA_FACADE
|
95
Server/DataStructures/SharedDataFacade.h
Normal file
95
Server/DataStructures/SharedDataFacade.h
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
open source routing machine
|
||||||
|
Copyright (C) Dennis Luxen, others 2010
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU AFFERO General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
or see http://www.gnu.org/licenses/agpl.txt.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INTERNAL_DATA_FACADE
|
||||||
|
#define INTERNAL_DATA_FACADE
|
||||||
|
|
||||||
|
#include "BaseDataFacade.h"
|
||||||
|
|
||||||
|
template<class EdgeDataT>
|
||||||
|
class SharedDataFacade : public BaseDataFacade<EdgeDataT> {
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//search graph access
|
||||||
|
unsigned GetNumberOfNodes() const { return 0; }
|
||||||
|
|
||||||
|
unsigned GetNumberOfEdges() const { return 0; }
|
||||||
|
|
||||||
|
unsigned GetOutDegree( const NodeID n ) const { return 0; }
|
||||||
|
|
||||||
|
NodeID GetTarget( const EdgeID e ) const { return 0; }
|
||||||
|
|
||||||
|
EdgeDataT &GetEdgeData( const EdgeID e ) { return EdgeDataT(); }
|
||||||
|
|
||||||
|
const EdgeDataT &GetEdgeData( const EdgeID e ) const { return EdgeDataT(); }
|
||||||
|
|
||||||
|
EdgeID BeginEdges( const NodeID n ) const { return 0; }
|
||||||
|
|
||||||
|
EdgeID EndEdges( const NodeID n ) const { return 0; }
|
||||||
|
|
||||||
|
//searches for a specific edge
|
||||||
|
EdgeID FindEdge( const NodeID from, const NodeID to ) const { return 0; }
|
||||||
|
|
||||||
|
EdgeID FindEdgeInEitherDirection(
|
||||||
|
const NodeID from,
|
||||||
|
const NodeID to
|
||||||
|
) const { return 0; }
|
||||||
|
|
||||||
|
EdgeID FindEdgeIndicateIfReverse(
|
||||||
|
const NodeID from,
|
||||||
|
const NodeID to,
|
||||||
|
bool & result
|
||||||
|
) const { return 0; }
|
||||||
|
|
||||||
|
//node and edge information access
|
||||||
|
FixedPointCoordinate GetCoordinateOfNode(
|
||||||
|
const unsigned id
|
||||||
|
) const { return FixedPointCoordinate(); };
|
||||||
|
|
||||||
|
TurnInstruction GetTurnInstructionForEdgeID(
|
||||||
|
const unsigned id
|
||||||
|
) const { return 0; }
|
||||||
|
|
||||||
|
bool LocateClosestEndPointForCoordinate(
|
||||||
|
const FixedPointCoordinate& input_coordinate,
|
||||||
|
FixedPointCoordinate& result,
|
||||||
|
const unsigned zoom_level = 18
|
||||||
|
) const { return false; }
|
||||||
|
|
||||||
|
bool FindPhantomNodeForCoordinate(
|
||||||
|
const FixedPointCoordinate & input_coordinate,
|
||||||
|
PhantomNode & resulting_phantom_node,
|
||||||
|
const unsigned zoom_level
|
||||||
|
) const { return false; }
|
||||||
|
|
||||||
|
unsigned GetCheckSum() const { return 0; }
|
||||||
|
|
||||||
|
unsigned GetNameIndexFromEdgeID(const unsigned id) const { return 0; };
|
||||||
|
|
||||||
|
void GetName(
|
||||||
|
const unsigned name_id,
|
||||||
|
std::string & result
|
||||||
|
) const { return; };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INTERNAL_DATA_FACADE
|
Loading…
Reference in New Issue
Block a user