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.
|
||||
*/
|
||||
|
||||
//TODO: Umbauen in Private Data Facade
|
||||
|
||||
#ifndef NODEINFORMATIONHELPDESK_H_
|
||||
#define NODEINFORMATIONHELPDESK_H_
|
||||
|
||||
|
@ -22,13 +22,14 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
#define STATICGRAPH_H_INCLUDED
|
||||
|
||||
#include "../DataStructures/Percent.h"
|
||||
#include "../DataStructures/SharedMemoryVectorWrapper.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../typedefs.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
template< typename EdgeDataT>
|
||||
template< typename EdgeDataT, bool UseSharedMemory = false>
|
||||
class StaticGraph {
|
||||
public:
|
||||
typedef NodeID NodeIterator;
|
||||
@ -40,8 +41,9 @@ public:
|
||||
NodeIterator source;
|
||||
NodeIterator target;
|
||||
bool operator<( const InputEdge& right ) const {
|
||||
if ( source != right.source )
|
||||
if ( source != right.source ) {
|
||||
return source < right.source;
|
||||
}
|
||||
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();
|
||||
_numEdges = edges.size();
|
||||
|
||||
_nodes.swap(nodes);
|
||||
_edges.swap(edges);
|
||||
|
||||
//Add dummy node to end of _nodes array;
|
||||
_nodes.push_back(_nodes.back());
|
||||
|
||||
if( !UseSharedMemory ) {
|
||||
//Add dummy node to end of _nodes array;
|
||||
_nodes.push_back(_nodes.back());
|
||||
} else {
|
||||
//TODO: Move to graph array construction
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
Percent p(GetNumberOfNodes());
|
||||
for(unsigned u = 0; u < GetNumberOfNodes(); ++u) {
|
||||
@ -176,8 +184,9 @@ public:
|
||||
EdgeIterator tmp = FindEdge( from, to );
|
||||
if(UINT_MAX == tmp) {
|
||||
tmp = FindEdge( to, from );
|
||||
if(UINT_MAX != tmp)
|
||||
if(UINT_MAX != tmp) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
@ -187,8 +196,8 @@ private:
|
||||
NodeIterator _numNodes;
|
||||
EdgeIterator _numEdges;
|
||||
|
||||
std::vector< _StrNode > _nodes;
|
||||
std::vector< _StrEdge > _edges;
|
||||
ShMemVector< _StrNode, UseSharedMemory > _nodes;
|
||||
ShMemVector< _StrEdge, UseSharedMemory > _edges;
|
||||
};
|
||||
|
||||
#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: objects = new QueryObjectsStorage()
|
||||
query_data_facade = new SharedDataFacade<QueryEdge::EdgeData>();
|
||||
|
||||
//TODO: generate shared memory plugins
|
||||
RegisterPlugin(new HelloWorldPlugin());
|
||||
|
@ -30,6 +30,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
#include "../Plugins/TimestampPlugin.h"
|
||||
#include "../Plugins/ViaRoutePlugin.h"
|
||||
#include "../Server/DataStructures/BaseDataFacade.h"
|
||||
#include "../Server/DataStructures/InternalDataFacade.h"
|
||||
#include "../Server/DataStructures/SharedDataFacade.h"
|
||||
#include "../Server/DataStructures/RouteParameters.h"
|
||||
#include "../Util/IniFile.h"
|
||||
#include "../Util/InputFileUtil.h"
|
||||
@ -40,6 +42,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
@ -26,6 +26,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
#include "../../DataStructures/Coordinate.h"
|
||||
#include "../../DataStructures/PhantomNodes.h"
|
||||
#include "../../DataStructures/TurnInstructions.h"
|
||||
#include "../../Util/OSRMException.h"
|
||||
#include "../../typedefs.h"
|
||||
|
||||
#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