All good, but needs unpacking of start and end
This commit is contained in:
@@ -45,6 +45,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <osrm/Coordinate.h>
|
||||
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
template<class EdgeDataT>
|
||||
class InternalDataFacade : public BaseDataFacade<EdgeDataT> {
|
||||
|
||||
@@ -61,7 +64,7 @@ private:
|
||||
QueryGraph * m_query_graph;
|
||||
std::string m_timestamp;
|
||||
|
||||
ShM<FixedPointCoordinate, false>::vector m_coordinate_list;
|
||||
boost::shared_ptr<ShM<FixedPointCoordinate, false>::vector> m_coordinate_list;
|
||||
ShM<NodeID, false>::vector m_via_node_list;
|
||||
ShM<unsigned, false>::vector m_name_ID_list;
|
||||
ShM<TurnInstruction, false>::vector m_turn_instruction_list;
|
||||
@@ -71,7 +74,13 @@ private:
|
||||
ShM<unsigned, false>::vector m_compressed_geometry_indices;
|
||||
ShM<unsigned, false>::vector m_compressed_geometries;
|
||||
|
||||
StaticRTree<RTreeLeaf, false> * m_static_rtree;
|
||||
boost::shared_ptr<
|
||||
StaticRTree<
|
||||
RTreeLeaf,
|
||||
ShM<FixedPointCoordinate, false>::vector,
|
||||
false
|
||||
>
|
||||
> m_static_rtree;
|
||||
|
||||
|
||||
void LoadTimestamp(const boost::filesystem::path & timestamp_path) {
|
||||
@@ -131,15 +140,16 @@ private:
|
||||
(char *)&number_of_coordinates,
|
||||
sizeof(unsigned)
|
||||
);
|
||||
m_coordinate_list.resize(number_of_coordinates);
|
||||
m_coordinate_list = boost::make_shared<std::vector<FixedPointCoordinate> >(number_of_coordinates);
|
||||
for(unsigned i = 0; i < number_of_coordinates; ++i) {
|
||||
nodes_input_stream.read((char *)¤t_node, sizeof(NodeInfo));
|
||||
m_coordinate_list[i] = FixedPointCoordinate(
|
||||
m_coordinate_list->at(i) = FixedPointCoordinate(
|
||||
current_node.lat,
|
||||
current_node.lon
|
||||
);
|
||||
BOOST_ASSERT( ( m_coordinate_list->at(i).lat >> 30) == 0 );
|
||||
BOOST_ASSERT( ( m_coordinate_list->at(i).lon >> 30) == 0 );
|
||||
}
|
||||
std::vector<FixedPointCoordinate>(m_coordinate_list).swap(m_coordinate_list);
|
||||
nodes_input_stream.close();
|
||||
|
||||
SimpleLogger().Write(logDEBUG) << "Loading edge data";
|
||||
@@ -221,9 +231,15 @@ private:
|
||||
const boost::filesystem::path & ram_index_path,
|
||||
const boost::filesystem::path & file_index_path
|
||||
) {
|
||||
m_static_rtree = new StaticRTree<RTreeLeaf>(
|
||||
BOOST_ASSERT_MSG(
|
||||
!m_coordinate_list->empty(),
|
||||
"coordinates must be loaded before r-tree"
|
||||
);
|
||||
|
||||
m_static_rtree = boost::make_shared<StaticRTree<RTreeLeaf> >(
|
||||
ram_index_path,
|
||||
file_index_path
|
||||
file_index_path,
|
||||
m_coordinate_list
|
||||
);
|
||||
}
|
||||
|
||||
@@ -238,6 +254,8 @@ private:
|
||||
BOOST_ASSERT_MSG(0 != number_of_names, "name file broken");
|
||||
BOOST_ASSERT_MSG(0 != number_of_chars, "name file broken");
|
||||
|
||||
SimpleLogger().Write(logDEBUG) << "no. of names: " << number_of_names;
|
||||
|
||||
m_name_begin_indices.resize(number_of_names);
|
||||
name_stream.read(
|
||||
(char*)&m_name_begin_indices[0],
|
||||
@@ -258,7 +276,7 @@ private:
|
||||
public:
|
||||
~InternalDataFacade() {
|
||||
delete m_query_graph;
|
||||
delete m_static_rtree;
|
||||
m_static_rtree.reset();
|
||||
}
|
||||
|
||||
explicit InternalDataFacade( const ServerPaths & server_paths ) {
|
||||
@@ -379,7 +397,7 @@ public:
|
||||
const unsigned id
|
||||
) const {
|
||||
// const unsigned coordinate_index = m_via_node_list.at(id);
|
||||
return m_coordinate_list.at(id);
|
||||
return m_coordinate_list->at(id);
|
||||
};
|
||||
|
||||
bool EdgeIsCompressed( const unsigned id ) const {
|
||||
@@ -471,7 +489,7 @@ public:
|
||||
unsigned coordinate_id = m_compressed_geometries[geometry_index];
|
||||
// uncomment to use compressed geometry
|
||||
result_nodes.push_back( coordinate_id );
|
||||
SimpleLogger().Write() << "coordinate " << coordinate_id << " at " << m_coordinate_list.at(coordinate_id);
|
||||
SimpleLogger().Write() << "coordinate " << coordinate_id << " at " << m_coordinate_list->at(coordinate_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,9 +30,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
//implements all data storage when shared memory _IS_ used
|
||||
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "BaseDataFacade.h"
|
||||
#include "SharedDataType.h"
|
||||
|
||||
@@ -42,6 +39,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../../Util/ProgramOptions.h"
|
||||
#include "../../Util/SimpleLogger.h"
|
||||
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
template<class EdgeDataT>
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
typedef typename StaticGraph<EdgeData, true>::_StrEdge GraphEdge;
|
||||
typedef typename QueryGraph::InputEdge InputEdge;
|
||||
typedef typename super::RTreeLeaf RTreeLeaf;
|
||||
typedef typename StaticRTree<RTreeLeaf, true>::TreeNode RTreeNode;
|
||||
typedef typename StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, true>::vector, true>::TreeNode RTreeNode;
|
||||
|
||||
SharedDataLayout * data_layout;
|
||||
char * shared_memory;
|
||||
@@ -72,13 +72,21 @@ private:
|
||||
boost::shared_ptr<SharedMemory> m_large_memory;
|
||||
std::string m_timestamp;
|
||||
|
||||
ShM<FixedPointCoordinate, true>::vector m_coordinate_list;
|
||||
boost::shared_ptr<
|
||||
ShM<FixedPointCoordinate, true>::vector
|
||||
> m_coordinate_list;
|
||||
ShM<NodeID, true>::vector m_via_node_list;
|
||||
ShM<unsigned, true>::vector m_name_ID_list;
|
||||
ShM<TurnInstruction, true>::vector m_turn_instruction_list;
|
||||
ShM<char, true>::vector m_names_char_list;
|
||||
ShM<unsigned, true>::vector m_name_begin_indices;
|
||||
boost::shared_ptr<StaticRTree<RTreeLeaf, true> > m_static_rtree;
|
||||
boost::shared_ptr<
|
||||
StaticRTree<
|
||||
RTreeLeaf,
|
||||
ShM<FixedPointCoordinate, true>::vector,
|
||||
true
|
||||
>
|
||||
> m_static_rtree;
|
||||
|
||||
// SharedDataFacade() { }
|
||||
|
||||
@@ -95,13 +103,19 @@ private:
|
||||
void LoadRTree(
|
||||
const boost::filesystem::path & file_index_path
|
||||
) {
|
||||
BOOST_ASSERT_MSG(
|
||||
!m_coordinate_list->empty(),
|
||||
"coordinates must be loaded before r-tree"
|
||||
);
|
||||
|
||||
RTreeNode * tree_ptr = (RTreeNode *)(
|
||||
shared_memory + data_layout->GetRSearchTreeOffset()
|
||||
);
|
||||
m_static_rtree = boost::make_shared<StaticRTree<RTreeLeaf, true> >(
|
||||
m_static_rtree = boost::make_shared<StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, true>::vector, true> >(
|
||||
tree_ptr,
|
||||
data_layout->r_search_tree_size,
|
||||
file_index_path
|
||||
file_index_path,
|
||||
m_coordinate_list
|
||||
);
|
||||
}
|
||||
|
||||
@@ -134,11 +148,10 @@ private:
|
||||
FixedPointCoordinate * coordinate_list_ptr = (FixedPointCoordinate *)(
|
||||
shared_memory + data_layout->GetCoordinateListOffset()
|
||||
);
|
||||
typename ShM<FixedPointCoordinate, true>::vector coordinate_list(
|
||||
m_coordinate_list = boost::make_shared<ShM<FixedPointCoordinate, true>::vector> (
|
||||
coordinate_list_ptr,
|
||||
data_layout->coordinate_list_size
|
||||
);
|
||||
m_coordinate_list.swap( coordinate_list );
|
||||
|
||||
TurnInstruction * turn_instruction_list_ptr = (TurnInstruction *)(
|
||||
shared_memory + data_layout->GetTurnInstructionListOffset()
|
||||
@@ -309,7 +322,7 @@ public:
|
||||
const unsigned id
|
||||
) const {
|
||||
// const NodeID node = m_via_node_list.at(id);
|
||||
return m_coordinate_list.at(id);
|
||||
return m_coordinate_list->at(id);
|
||||
};
|
||||
|
||||
virtual bool EdgeIsCompressed( const unsigned id ) const {
|
||||
|
||||
@@ -43,7 +43,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <boost/integer.hpp>
|
||||
|
||||
typedef BaseDataFacade<QueryEdge::EdgeData>::RTreeLeaf RTreeLeaf;
|
||||
typedef StaticRTree<RTreeLeaf, true>::TreeNode RTreeNode;
|
||||
typedef StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, true>::vector, true>::TreeNode RTreeNode;
|
||||
typedef StaticGraph<QueryEdge::EdgeData> QueryGraph;
|
||||
|
||||
struct SharedDataLayout {
|
||||
|
||||
Reference in New Issue
Block a user