osrm-backend/unit_tests/mocks/mock_datafacade.hpp

114 lines
4.5 KiB
C++
Raw Normal View History

2016-03-03 16:25:01 -05:00
#ifndef MOCK_DATAFACADE_HPP
#define MOCK_DATAFACADE_HPP
// implements all data storage when shared memory _IS_ used
#include "engine/datafacade/datafacade_base.hpp"
#include "contractor/query_edge.hpp"
2016-03-03 08:26:13 -05:00
namespace osrm
{
namespace test
{
2016-03-03 16:25:01 -05:00
2016-03-03 08:26:13 -05:00
template <class EdgeDataT>
class MockDataFacadeT final : public osrm::engine::datafacade::BaseDataFacade<EdgeDataT>
2016-03-03 16:25:01 -05:00
{
2016-03-03 08:26:13 -05:00
private:
EdgeDataT foo;
public:
2016-03-03 16:25:01 -05:00
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 SPECIAL_NODEID; }
2016-03-03 08:26:13 -05:00
const EdgeDataT &GetEdgeData(const EdgeID /* e */) const { return foo; }
2016-03-03 16:25:01 -05:00
EdgeID BeginEdges(const NodeID /* n */) const { return SPECIAL_EDGEID; }
EdgeID EndEdges(const NodeID /* n */) const { return SPECIAL_EDGEID; }
2016-03-03 08:26:13 -05:00
osrm::engine::datafacade::EdgeRange GetAdjacentEdgeRange(const NodeID /* node */) const
{
return util::irange(static_cast<EdgeID>(0), static_cast<EdgeID>(0));
2016-03-03 16:25:01 -05:00
}
EdgeID FindEdge(const NodeID /* from */, const NodeID /* to */) const { return SPECIAL_EDGEID; }
2016-03-03 08:26:13 -05:00
EdgeID FindEdgeInEitherDirection(const NodeID /* from */, const NodeID /* to */) const
{
return SPECIAL_EDGEID;
}
EdgeID FindEdgeIndicateIfReverse(const NodeID /* from */,
const NodeID /* to */,
bool & /* result */) const
{
return SPECIAL_EDGEID;
}
util::FixedPointCoordinate GetCoordinateOfNode(const unsigned /* id */) const
{
FixedPointCoordinate foo(0, 0);
2016-03-03 16:25:01 -05:00
return foo;
}
bool EdgeIsCompressed(const unsigned /* id */) const { return false; }
unsigned GetGeometryIndexForEdgeID(const unsigned /* id */) const { return SPECIAL_NODEID; }
void GetUncompressedGeometry(const EdgeID /* id */,
2016-03-03 08:26:13 -05:00
std::vector<NodeID> & /* result_nodes */) const
{
}
2016-03-03 16:25:01 -05:00
void GetUncompressedWeights(const EdgeID /* id */,
2016-03-03 08:26:13 -05:00
std::vector<EdgeWeight> & /* result_weights */) const
{
}
extractor::TurnInstruction GetTurnInstructionForEdgeID(const unsigned /* id */) const
{
2016-03-03 16:25:01 -05:00
return osrm::extractor::TurnInstruction::NoTurn;
}
2016-03-03 08:26:13 -05:00
extractor::TravelMode GetTravelModeForEdgeID(const unsigned /* id */) const
2016-03-03 16:25:01 -05:00
{
return TRAVEL_MODE_DEFAULT;
}
2016-03-03 08:26:13 -05:00
std::vector<typename osrm::engine::datafacade::BaseDataFacade<EdgeDataT>::RTreeLeaf>
GetEdgesInBox(const util::FixedPointCoordinate & /* south_west */,
const util::FixedPointCoordinate & /*north_east */)
{
2016-03-03 16:25:01 -05:00
std::vector<typename osrm::engine::datafacade::BaseDataFacade<EdgeDataT>::RTreeLeaf> foo;
return foo;
}
std::vector<osrm::engine::PhantomNodeWithDistance>
NearestPhantomNodesInRange(const util::FixedPointCoordinate /* input_coordinate */,
const float /* max_distance */,
const int /* bearing = 0 */,
2016-03-03 08:26:13 -05:00
const int /* bearing_range = 180 */)
{
2016-03-03 16:25:01 -05:00
std::vector<osrm::engine::PhantomNodeWithDistance> foo;
return foo;
}
std::vector<osrm::engine::PhantomNodeWithDistance>
NearestPhantomNodes(const util::FixedPointCoordinate /* input_coordinate */,
const unsigned /* max_results */,
const int /* bearing = 0 */,
2016-03-03 08:26:13 -05:00
const int /* bearing_range = 180 */)
{
2016-03-03 16:25:01 -05:00
std::vector<osrm::engine::PhantomNodeWithDistance> foo;
return foo;
}
2016-03-03 08:26:13 -05:00
std::pair<osrm::engine::PhantomNode, osrm::engine::PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(
2016-03-03 16:25:01 -05:00
const util::FixedPointCoordinate /* input_coordinate */,
const int /* bearing = 0 */,
2016-03-03 08:26:13 -05:00
const int /* bearing_range = 180 */)
{
2016-03-03 16:25:01 -05:00
std::pair<osrm::engine::PhantomNode, osrm::engine::PhantomNode> foo;
return foo;
}
unsigned GetCheckSum() const { return 0; }
bool IsCoreNode(const NodeID /* id */) const { return false; }
unsigned GetNameIndexFromEdgeID(const unsigned /* id */) const { return 0; }
std::string get_name_for_id(const unsigned /* name_id */) const { return ""; }
std::size_t GetCoreSize() const { return 0; }
std::string GetTimestamp() const { return ""; }
bool GetUTurnsDefault() const override { return true; }
2016-03-03 16:25:01 -05:00
};
using MockDataFacade = MockDataFacadeT<contractor::QueryEdge::EdgeData>;
} // osrm::test::
} // osrm::
#endif // MOCK_DATAFACADE_HPP