00001 /* 00002 * Copyright 2016 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 #ifndef CARTOGRAPHER_COMMON_CONFIGURATION_FILE_RESOLVER_H_ 00018 #define CARTOGRAPHER_COMMON_CONFIGURATION_FILE_RESOLVER_H_ 00019 00020 #include <vector> 00021 00022 #include "cartographer/common/lua_parameter_dictionary.h" 00023 #include "cartographer/common/port.h" 00024 00025 namespace cartographer { 00026 namespace common { 00027 00028 // A 'FileResolver' for the 'LuaParameterDictionary' that reads files from disk. 00029 // It searches the 'configuration_files_directories' in order to find the 00030 // requested filename. The last place searched is always the 00031 // 'configuration_files/' directory installed with Cartographer. It contains 00032 // reasonable configuration for the various Cartographer components which 00033 // provide a good starting ground for new platforms. 00034 class ConfigurationFileResolver : public FileResolver { 00035 public: 00036 explicit ConfigurationFileResolver( 00037 const std::vector<std::string>& configuration_files_directories); 00038 00039 std::string GetFullPathOrDie(const std::string& basename) override; 00040 std::string GetFileContentOrDie(const std::string& basename) override; 00041 00042 private: 00043 std::vector<std::string> configuration_files_directories_; 00044 }; 00045 00046 } // namespace common 00047 } // namespace cartographer 00048 00049 #endif // CARTOGRAPHER_COMMON_CONFIGURATION_FILE_RESOLVER_H_