switch back to lua based env naming
This commit is contained in:
parent
d5904d5756
commit
68e38880df
@ -1,5 +1,5 @@
|
|||||||
#ifndef SCRIPTING_ENVIRONMENT_SOL2_HPP
|
#ifndef SCRIPTING_ENVIRONMENT_LUA_HPP
|
||||||
#define SCRIPTING_ENVIRONMENT_SOL2_HPP
|
#define SCRIPTING_ENVIRONMENT_LUA_HPP
|
||||||
|
|
||||||
#include "extractor/raster_source.hpp"
|
#include "extractor/raster_source.hpp"
|
||||||
#include "extractor/scripting_environment.hpp"
|
#include "extractor/scripting_environment.hpp"
|
||||||
@ -17,7 +17,7 @@ namespace osrm
|
|||||||
namespace extractor
|
namespace extractor
|
||||||
{
|
{
|
||||||
|
|
||||||
struct Sol2ScriptingContext final
|
struct LuaScriptingContext final
|
||||||
{
|
{
|
||||||
void ProcessNode(const osmium::Node &, ExtractionNode &result);
|
void ProcessNode(const osmium::Node &, ExtractionNode &result);
|
||||||
void ProcessWay(const osmium::Way &, ExtractionWay &result);
|
void ProcessWay(const osmium::Way &, ExtractionWay &result);
|
||||||
@ -47,7 +47,7 @@ class Sol2ScriptingEnvironment final : public ScriptingEnvironment
|
|||||||
|
|
||||||
const ProfileProperties &GetProfileProperties() override;
|
const ProfileProperties &GetProfileProperties() override;
|
||||||
|
|
||||||
Sol2ScriptingContext &GetSol2Context();
|
LuaScriptingContext &GetSol2Context();
|
||||||
|
|
||||||
std::vector<std::string> GetNameSuffixList() override;
|
std::vector<std::string> GetNameSuffixList() override;
|
||||||
std::vector<std::string> GetRestrictions() override;
|
std::vector<std::string> GetRestrictions() override;
|
||||||
@ -66,12 +66,12 @@ class Sol2ScriptingEnvironment final : public ScriptingEnvironment
|
|||||||
&resulting_restrictions) override;
|
&resulting_restrictions) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitContext(Sol2ScriptingContext &context);
|
void InitContext(LuaScriptingContext &context);
|
||||||
std::mutex init_mutex;
|
std::mutex init_mutex;
|
||||||
std::string file_name;
|
std::string file_name;
|
||||||
tbb::enumerable_thread_specific<std::unique_ptr<Sol2ScriptingContext>> script_contexts;
|
tbb::enumerable_thread_specific<std::unique_ptr<LuaScriptingContext>> script_contexts;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SCRIPTING_ENVIRONMENT_SOL2_HPP */
|
#endif /* SCRIPTING_ENVIRONMENT_LUA_HPP */
|
||||||
|
@ -82,7 +82,7 @@ Sol2ScriptingEnvironment::Sol2ScriptingEnvironment(const std::string &file_name)
|
|||||||
util::Log() << "Using script " << file_name;
|
util::Log() << "Using script " << file_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sol2ScriptingEnvironment::InitContext(Sol2ScriptingContext &context)
|
void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
||||||
{
|
{
|
||||||
context.state.open_libraries();
|
context.state.open_libraries();
|
||||||
|
|
||||||
@ -309,14 +309,14 @@ const ProfileProperties &Sol2ScriptingEnvironment::GetProfileProperties()
|
|||||||
return GetSol2Context().properties;
|
return GetSol2Context().properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sol2ScriptingContext &Sol2ScriptingEnvironment::GetSol2Context()
|
LuaScriptingContext &Sol2ScriptingEnvironment::GetSol2Context()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(init_mutex);
|
std::lock_guard<std::mutex> lock(init_mutex);
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
auto &ref = script_contexts.local(initialized);
|
auto &ref = script_contexts.local(initialized);
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
{
|
{
|
||||||
ref = std::make_unique<Sol2ScriptingContext>();
|
ref = std::make_unique<LuaScriptingContext>();
|
||||||
InitContext(*ref);
|
InitContext(*ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,7 +452,7 @@ void Sol2ScriptingEnvironment::ProcessSegment(const osrm::util::Coordinate &sour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sol2ScriptingContext::ProcessNode(const osmium::Node &node, ExtractionNode &result)
|
void LuaScriptingContext::ProcessNode(const osmium::Node &node, ExtractionNode &result)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(state.lua_state() != nullptr);
|
BOOST_ASSERT(state.lua_state() != nullptr);
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ void Sol2ScriptingContext::ProcessNode(const osmium::Node &node, ExtractionNode
|
|||||||
node_function(node, result);
|
node_function(node, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sol2ScriptingContext::ProcessWay(const osmium::Way &way, ExtractionWay &result)
|
void LuaScriptingContext::ProcessWay(const osmium::Way &way, ExtractionWay &result)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(state.lua_state() != nullptr);
|
BOOST_ASSERT(state.lua_state() != nullptr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user