Don't mark all lanes as designated when there are blank lane specifiers in the tag.
This commit is contained in:
committed by
Patrick Niklaus
parent
f88f51fd98
commit
3dfbf42e61
+13
-16
@@ -1,11 +1,8 @@
|
||||
#ifndef SCRIPTING_ENVIRONMENT_LUA_HPP
|
||||
#define SCRIPTING_ENVIRONMENT_LUA_HPP
|
||||
|
||||
#include "extractor/scripting_environment.hpp"
|
||||
#ifndef SCRIPTING_ENVIRONMENT_SOL2_HPP
|
||||
#define SCRIPTING_ENVIRONMENT_SOL2_HPP
|
||||
|
||||
#include "extractor/raster_source.hpp"
|
||||
|
||||
#include "util/lua_util.hpp"
|
||||
#include "extractor/scripting_environment.hpp"
|
||||
|
||||
#include <tbb/enumerable_thread_specific.h>
|
||||
|
||||
@@ -13,21 +10,21 @@
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
struct lua_State;
|
||||
#include <sol2/sol.hpp>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace extractor
|
||||
{
|
||||
|
||||
struct LuaScriptingContext final
|
||||
struct Sol2ScriptingContext final
|
||||
{
|
||||
void processNode(const osmium::Node &, ExtractionNode &result);
|
||||
void processWay(const osmium::Way &, ExtractionWay &result);
|
||||
|
||||
ProfileProperties properties;
|
||||
SourceContainer sources;
|
||||
util::LuaState state;
|
||||
sol::state state;
|
||||
|
||||
bool has_turn_penalty_function;
|
||||
bool has_node_function;
|
||||
@@ -42,15 +39,15 @@ struct LuaScriptingContext final
|
||||
* Each thread has its own lua state which is implemented with thread specific
|
||||
* storage from TBB.
|
||||
*/
|
||||
class LuaScriptingEnvironment final : public ScriptingEnvironment
|
||||
class Sol2ScriptingEnvironment final : public ScriptingEnvironment
|
||||
{
|
||||
public:
|
||||
explicit LuaScriptingEnvironment(const std::string &file_name);
|
||||
~LuaScriptingEnvironment() override = default;
|
||||
explicit Sol2ScriptingEnvironment(const std::string &file_name);
|
||||
~Sol2ScriptingEnvironment() override = default;
|
||||
|
||||
const ProfileProperties &GetProfileProperties() override;
|
||||
|
||||
LuaScriptingContext &GetLuaContext();
|
||||
Sol2ScriptingContext &GetSol2Context();
|
||||
|
||||
std::vector<std::string> GetNameSuffixList() override;
|
||||
std::vector<std::string> GetRestrictions() override;
|
||||
@@ -69,12 +66,12 @@ class LuaScriptingEnvironment final : public ScriptingEnvironment
|
||||
&resulting_restrictions) override;
|
||||
|
||||
private:
|
||||
void InitContext(LuaScriptingContext &context);
|
||||
void InitContext(Sol2ScriptingContext &context);
|
||||
std::mutex init_mutex;
|
||||
std::string file_name;
|
||||
tbb::enumerable_thread_specific<std::unique_ptr<LuaScriptingContext>> script_contexts;
|
||||
tbb::enumerable_thread_specific<std::unique_ptr<Sol2ScriptingContext>> script_contexts;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SCRIPTING_ENVIRONMENT_LUA_HPP */
|
||||
#endif /* SCRIPTING_ENVIRONMENT_SOL2_HPP */
|
||||
@@ -18,25 +18,6 @@ namespace osrm
|
||||
namespace util
|
||||
{
|
||||
|
||||
struct LuaState
|
||||
{
|
||||
LuaState() : handle{::luaL_newstate(), &::lua_close} { luaL_openlibs(*this); }
|
||||
|
||||
operator lua_State *() { return handle.get(); }
|
||||
operator lua_State const *() const { return handle.get(); }
|
||||
|
||||
using handle_type = std::unique_ptr<lua_State, decltype(&::lua_close)>;
|
||||
handle_type handle;
|
||||
};
|
||||
|
||||
// Check if the lua function <name> is defined
|
||||
inline bool luaFunctionExists(lua_State *lua_state, const char *name)
|
||||
{
|
||||
luabind::object globals_table = luabind::globals(lua_state);
|
||||
luabind::object lua_function = globals_table[name];
|
||||
return lua_function && (luabind::type(lua_function) == LUA_TFUNCTION);
|
||||
}
|
||||
|
||||
// Add the folder contain the script to the lua load path, so script can easily require() other lua
|
||||
// scripts inside that folder, or subfolders.
|
||||
// See http://lua-users.org/wiki/PackagePath for details on the package.path syntax.
|
||||
|
||||
Reference in New Issue
Block a user