minor refactoring
This commit is contained in:
@@ -26,7 +26,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "ExtractorCallbacks.h"
|
||||
|
||||
#include "ExtractionContainers.h"
|
||||
#include "ExtractionWay.h"
|
||||
|
||||
|
||||
+27
-22
@@ -215,25 +215,26 @@ inline void PBFParser::parseDenseNode(_ThreadData * threadData) {
|
||||
denseTagIndex += 2;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma omp parallel
|
||||
{
|
||||
const int thread_num = omp_get_thread_num();
|
||||
#pragma omp parallel for schedule ( guided )
|
||||
for(int i = 0; i < number_of_nodes; ++i) {
|
||||
for(int i = 0; i < number_of_nodes; ++i)
|
||||
{
|
||||
ImportNode & import_node = extracted_nodes_vector[i];
|
||||
ParseNodeInLua(
|
||||
import_node,
|
||||
scripting_environment.getLuaStateForThreadID(omp_get_thread_num())
|
||||
);
|
||||
ParseNodeInLua(import_node, scripting_environment.getLuaStateForThreadID(thread_num));
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const ImportNode &import_node, extracted_nodes_vector) {
|
||||
BOOST_FOREACH(const ImportNode &import_node, extracted_nodes_vector)
|
||||
{
|
||||
extractor_callbacks->nodeFunction(import_node);
|
||||
}
|
||||
}
|
||||
|
||||
inline void PBFParser::parseNode(_ThreadData * ) {
|
||||
throw OSRMException(
|
||||
"Parsing of simple nodes not supported. PBF should use dense nodes"
|
||||
);
|
||||
inline void PBFParser::parseNode(_ThreadData * )
|
||||
{
|
||||
throw OSRMException("Parsing of simple nodes not supported. PBF should use dense nodes");
|
||||
}
|
||||
|
||||
inline void PBFParser::parseRelation(_ThreadData * threadData) {
|
||||
@@ -351,25 +352,29 @@ inline void PBFParser::parseWay(_ThreadData * threadData) {
|
||||
}
|
||||
}
|
||||
|
||||
#pragma omp parallel
|
||||
{
|
||||
const int thread_num = omp_get_thread_num();
|
||||
#pragma omp parallel for schedule ( guided )
|
||||
for(int i = 0; i < number_of_ways; ++i) {
|
||||
for(int i = 0; i < number_of_ways; ++i)
|
||||
{
|
||||
ExtractionWay & extraction_way = parsed_way_vector[i];
|
||||
if (2 > extraction_way.path.size())
|
||||
if (2 <= extraction_way.path.size())
|
||||
{
|
||||
continue;
|
||||
ParseWayInLua(
|
||||
extraction_way,
|
||||
scripting_environment.getLuaStateForThreadID(thread_num)
|
||||
);
|
||||
}
|
||||
ParseWayInLua(
|
||||
extraction_way,
|
||||
scripting_environment.getLuaStateForThreadID( omp_get_thread_num())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(ExtractionWay & extraction_way, parsed_way_vector) {
|
||||
if (2 > extraction_way.path.size())
|
||||
BOOST_FOREACH(ExtractionWay & extraction_way, parsed_way_vector)
|
||||
{
|
||||
if (2 <= extraction_way.path.size())
|
||||
{
|
||||
continue;
|
||||
extractor_callbacks->wayFunction(extraction_way);
|
||||
}
|
||||
extractor_callbacks->wayFunction(extraction_way);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@ ScriptingEnvironment::ScriptingEnvironment(const char * fileName) {
|
||||
// Add our function to the state's global scope
|
||||
luabind::module(myLuaState) [
|
||||
luabind::def("print", LUA_print<std::string>),
|
||||
// luabind::def("parseMaxspeed", parseMaxspeed),
|
||||
luabind::def("durationIsValid", durationIsValid),
|
||||
luabind::def("parseDuration", parseDuration)
|
||||
];
|
||||
@@ -106,9 +105,8 @@ ScriptingEnvironment::ScriptingEnvironment(const char * fileName) {
|
||||
|
||||
// fails on c++11/OS X 10.9
|
||||
luabind::module(myLuaState) [
|
||||
luabind::class_<std::vector<std::string> >("vector")
|
||||
.def("Add", static_cast<void (std::vector<std::string>::*)(const std::string&)>(&std::vector<std::string>::push_back)
|
||||
)
|
||||
luabind::class_<std::vector<std::string> >("vector")
|
||||
.def("Add", static_cast<void (std::vector<std::string>::*)(const std::string&)>(&std::vector<std::string>::push_back))
|
||||
];
|
||||
|
||||
if(0 != luaL_dofile(myLuaState, fileName) ) {
|
||||
|
||||
@@ -273,7 +273,7 @@ ImportNode XMLParser::_ReadXMLNode() {
|
||||
xmlChar* k = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "k" );
|
||||
xmlChar* value = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "v" );
|
||||
if ( k != NULL && value != NULL ) {
|
||||
node.keyVals.Add(std::string( reinterpret_cast<char*>(k) ), std::string( reinterpret_cast<char*>(value)));
|
||||
node.keyVals.emplace(std::string(reinterpret_cast<char*>(k)), std::string(reinterpret_cast<char*>(value)));
|
||||
}
|
||||
if ( k != NULL ) {
|
||||
xmlFree( k );
|
||||
|
||||
Reference in New Issue
Block a user