Added db logger functions. Chnaged to newest mqtt++ version.
This commit is contained in:
@@ -5,12 +5,15 @@
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include "DBLogger.h"
|
||||
|
||||
class LuaEngine {
|
||||
private:
|
||||
LuaEngine();
|
||||
public:
|
||||
std::function<void(const TopicState& state)> publish;
|
||||
DBLogger db_logger;
|
||||
|
||||
static LuaEngine& get_instance() {
|
||||
static LuaEngine instance;
|
||||
|
||||
@@ -24,9 +27,34 @@ class LuaEngine {
|
||||
void start_services();
|
||||
LuaService* create_service(std::string filename);
|
||||
LuaService* service_by_lua_state(lua_State* lua);
|
||||
|
||||
LuaEngine(LuaEngine const&) = delete;
|
||||
void operator=(LuaEngine const&) = delete;
|
||||
};
|
||||
|
||||
template<typename Arg, typename... Args>
|
||||
inline bool check_arguments(lua_State* lua, int stack_pos) {
|
||||
return check_arguments<Args...>(lua, stack_pos+1) && check_arguments<Arg>(lua, stack_pos);
|
||||
}
|
||||
|
||||
template<typename Arg, typename... Args>
|
||||
inline bool check_arguments(lua_State* lua) {
|
||||
int num_arg = sizeof...(Args) + 1;
|
||||
return check_arguments<Arg, Args...>(lua, num_arg * -1);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline bool check_arguments<std::string>(lua_State* lua, int stack_pos) {
|
||||
return lua_isstring(lua, stack_pos);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline bool check_arguments<int>(lua_State* lua, int stack_pos) {
|
||||
return lua_isnumber(lua, stack_pos);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline bool check_arguments<bool>(lua_State* lua, int stack_pos) {
|
||||
return lua_isnumber(lua, stack_pos);
|
||||
}
|
||||
|
||||
#endif // LUA_ENGINE_H
|
||||
|
||||
Reference in New Issue
Block a user