17 #ifndef CARTOGRAPHER_COMMON_LUA_PARAMETER_DICTIONARY_H_ 18 #define CARTOGRAPHER_COMMON_LUA_PARAMETER_DICTIONARY_H_ 27 #include "glog/logging.h" 46 std::unique_ptr<FileResolver> file_resolver);
52 static std::unique_ptr<LuaParameterDictionary> NonReferenceCounted(
53 const std::string& code, std::unique_ptr<FileResolver> file_resolver);
58 std::vector<std::string> GetKeys()
const;
61 bool HasKey(
const std::string& key)
const;
64 std::string GetString(
const std::string& key);
65 double GetDouble(
const std::string& key);
66 int GetInt(
const std::string& key);
67 bool GetBool(
const std::string& key);
68 std::unique_ptr<LuaParameterDictionary> GetDictionary(
const std::string& key);
71 int GetNonNegativeInt(
const std::string& key);
74 std::string ToString()
const;
77 std::vector<double> GetArrayValuesAsDoubles();
78 std::vector<std::string> GetArrayValuesAsStrings();
79 std::vector<std::unique_ptr<LuaParameterDictionary>>
80 GetArrayValuesAsDictionaries();
86 std::unique_ptr<FileResolver> file_resolver);
90 std::shared_ptr<FileResolver> file_resolver);
93 std::string DoToString(
const std::string& indent)
const;
96 double PopDouble()
const;
104 std::string PopString(
Quoted quoted)
const;
108 std::unique_ptr<LuaParameterDictionary> PopDictionary(
112 void CheckHasKey(
const std::string& key)
const;
115 void CheckHasKeyAndReference(
const std::string& key);
120 void CheckAllKeysWereUsedExactlyOnceAndReset();
123 static int LuaRead(lua_State* L);
126 static int LuaInclude(lua_State* L);
149 #endif // CARTOGRAPHER_COMMON_LUA_PARAMETER_DICTIONARY_H_ virtual std::string GetFileContentOrDie(const std::string &basename)=0
const std::shared_ptr< FileResolver > file_resolver_
std::map< std::string, int > reference_counts_
int index_into_reference_table_
virtual std::string GetFullPathOrDie(const std::string &basename)=0
const ReferenceCount reference_count_
std::vector< std::string > included_files_