Use uturn default from .properties file

This commit is contained in:
Patrick Niklaus
2016-03-21 23:34:59 +01:00
parent 3467696f8a
commit 49c852917f
9 changed files with 72 additions and 8 deletions
+2 -2
View File
@@ -157,8 +157,8 @@ void ScriptingEnvironment::InitContext(ScriptingEnvironment::Context &context)
.def_readonly("datum", &RasterDatum::datum)
.def("invalid_data", &RasterDatum::get_invalid)];
luabind::globals(context.state)["properties"] = context.properties;
luabind::globals(context.state)["sources"] = context.sources;
luabind::globals(context.state)["properties"] = &context.properties;
luabind::globals(context.state)["sources"] = &context.sources;
if (0 != luaL_dofile(context.state, file_name.c_str()))
{
+17
View File
@@ -2,6 +2,7 @@
#include "util/range_table.hpp"
#include "contractor/query_edge.hpp"
#include "extractor/query_node.hpp"
#include "extractor/profile_properties.hpp"
#include "extractor/compressed_edge_container.hpp"
#include "util/shared_memory_vector_wrapper.hpp"
#include "util/static_graph.hpp"
@@ -148,6 +149,10 @@ int Storage::Run()
BOOST_ASSERT(paths.end() != paths_iterator);
BOOST_ASSERT(!paths_iterator->second.empty());
const boost::filesystem::path &timestamp_path = paths_iterator->second;
paths_iterator = paths.find("properties");
BOOST_ASSERT(paths.end() != paths_iterator);
BOOST_ASSERT(!paths_iterator->second.empty());
const boost::filesystem::path &properties_path = paths_iterator->second;
paths_iterator = paths.find("ramindex");
BOOST_ASSERT(paths.end() != paths_iterator);
BOOST_ASSERT(!paths_iterator->second.empty());
@@ -285,6 +290,9 @@ int Storage::Run()
tree_node_file.read((char *)&tree_size, sizeof(uint32_t));
shared_layout_ptr->SetBlockSize<RTreeNode>(SharedDataLayout::R_SEARCH_TREE, tree_size);
// load profile properties
shared_layout_ptr->SetBlockSize<extractor::ProfileProperties>(SharedDataLayout::PROPERTIES, 1);
// load timestamp size
std::string m_timestamp;
if (boost::filesystem::exists(timestamp_path))
@@ -605,6 +613,15 @@ int Storage::Run()
}
hsgr_input_stream.close();
// load profile properties
auto profile_properties_ptr = shared_layout_ptr->GetBlockPtr<extractor::ProfileProperties, true>(shared_memory_ptr, SharedDataLayout::PROPERTIES);
boost::filesystem::ifstream profile_properties_stream(properties_path);
if (!profile_properties_stream)
{
util::exception("Could not open " + properties_path.string() + " for reading!");
}
profile_properties_stream.read(reinterpret_cast<char*>(profile_properties_ptr), sizeof(extractor::ProfileProperties));
// acquire lock
SharedMemory *data_type_memory =
makeSharedMemory(CURRENT_REGIONS, sizeof(SharedDataTimestamp), true, false);
+16 -1
View File
@@ -44,7 +44,9 @@ bool generateDataStoreOptions(const int argc, const char *argv[], storage::DataP
".datasource_names file")(
"datasource_indexes",
boost::program_options::value<boost::filesystem::path>(&paths["datasource_indexes"]),
".datasource_indexes file");
".datasource_indexes file")(
"properties", boost::program_options::value<boost::filesystem::path>(&paths["properties"]),
".properties file");
// hidden options, will be allowed on command line but will not be shown to the user
boost::program_options::options_description hidden_options("Hidden options");
@@ -151,6 +153,12 @@ bool generateDataStoreOptions(const int argc, const char *argv[], storage::DataP
path_iterator->second = base_string + ".timestamp";
}
path_iterator = paths.find("properties");
if (path_iterator != paths.end())
{
path_iterator->second = base_string + ".properties";
}
path_iterator = paths.find("datasource_indexes");
if (path_iterator != paths.end())
{
@@ -219,6 +227,13 @@ bool generateDataStoreOptions(const int argc, const char *argv[], storage::DataP
throw util::exception("valid .timestamp file must be specified");
}
path_iterator = paths.find("properties");
if (path_iterator == paths.end() || path_iterator->second.string().empty() ||
!boost::filesystem::is_regular_file(path_iterator->second))
{
throw util::exception("valid .properties file must be specified");
}
return true;
}