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 string& code, std::unique_ptr<FileResolver> file_resolver);
58 std::vector<string> GetKeys()
const;
61 bool HasKey(
const string& key)
const;
64 string GetString(
const string& key);
65 double GetDouble(
const string& key);
66 int GetInt(
const string& key);
67 bool GetBool(
const string& key);
68 std::unique_ptr<LuaParameterDictionary> GetDictionary(
const string& key);
71 int GetNonNegativeInt(
const string& key);
74 string ToString()
const;
77 std::vector<double> GetArrayValuesAsDoubles();
78 std::vector<string> GetArrayValuesAsStrings();
79 std::vector<std::unique_ptr<LuaParameterDictionary>>
80 GetArrayValuesAsDictionaries();
85 std::unique_ptr<FileResolver> file_resolver);
89 std::shared_ptr<FileResolver> file_resolver);
92 string DoToString(
const string& indent)
const;
95 double PopDouble()
const;
103 string PopString(
Quoted quoted)
const;
107 std::unique_ptr<LuaParameterDictionary> PopDictionary(
111 void CheckHasKey(
const string& key)
const;
114 void CheckHasKeyAndReference(
const string& key);
119 void CheckAllKeysWereUsedExactlyOnceAndReset();
122 static int LuaRead(lua_State* L);
125 static int LuaInclude(lua_State* L);
148 #endif // CARTOGRAPHER_COMMON_LUA_PARAMETER_DICTIONARY_H_ const std::shared_ptr< FileResolver > file_resolver_
std::map< string, int > reference_counts_
std::vector< string > included_files_
int index_into_reference_table_
virtual string GetFileContentOrDie(const string &basename)=0
const ReferenceCount reference_count_
virtual string GetFullPathOrDie(const string &basename)=0