map_builder_server_options.cc
Go to the documentation of this file.
00001 /*
00002  * Copyright 2017 The Cartographer Authors
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #include "cartographer/cloud/map_builder_server_options.h"
00018 
00019 #include "absl/memory/memory.h"
00020 #include "cartographer/common/configuration_file_resolver.h"
00021 #include "cartographer/mapping/map_builder.h"
00022 
00023 namespace cartographer {
00024 namespace cloud {
00025 
00026 proto::MapBuilderServerOptions CreateMapBuilderServerOptions(
00027     common::LuaParameterDictionary* lua_parameter_dictionary) {
00028   proto::MapBuilderServerOptions map_builder_server_options;
00029   map_builder_server_options.set_server_address(
00030       lua_parameter_dictionary->GetString("server_address"));
00031   map_builder_server_options.set_num_grpc_threads(
00032       lua_parameter_dictionary->GetInt("num_grpc_threads"));
00033   map_builder_server_options.set_num_event_threads(
00034       lua_parameter_dictionary->GetInt("num_event_threads"));
00035   *map_builder_server_options.mutable_map_builder_options() =
00036       mapping::CreateMapBuilderOptions(
00037           lua_parameter_dictionary->GetDictionary("map_builder").get());
00038   map_builder_server_options.set_uplink_server_address(
00039       lua_parameter_dictionary->GetString("uplink_server_address"));
00040   map_builder_server_options.set_upload_batch_size(
00041       lua_parameter_dictionary->GetInt("upload_batch_size"));
00042   map_builder_server_options.set_enable_ssl_encryption(
00043       lua_parameter_dictionary->GetBool("enable_ssl_encryption"));
00044   map_builder_server_options.set_enable_google_auth(
00045       lua_parameter_dictionary->GetBool("enable_google_auth"));
00046   return map_builder_server_options;
00047 }
00048 
00049 proto::MapBuilderServerOptions LoadMapBuilderServerOptions(
00050     const std::string& configuration_directory,
00051     const std::string& configuration_basename) {
00052   auto file_resolver = absl::make_unique<common::ConfigurationFileResolver>(
00053       std::vector<std::string>{configuration_directory});
00054   const std::string code =
00055       file_resolver->GetFileContentOrDie(configuration_basename);
00056   common::LuaParameterDictionary lua_parameter_dictionary(
00057       code, std::move(file_resolver));
00058   return CreateMapBuilderServerOptions(&lua_parameter_dictionary);
00059 }
00060 
00061 }  // namespace cloud
00062 }  // namespace cartographer


cartographer
Author(s): The Cartographer Authors
autogenerated on Thu May 9 2019 02:27:35