Files
oopt-tai-implementations/tai_mux/static_platform_adapter.hpp
Wataru Ishida 54155f66f7 mux: support tai_log_set()
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2019-09-19 17:46:18 -07:00

41 lines
1.2 KiB
C++

#ifndef __STATIC_PLATFORM_ADAPTER_HPP__
#define __STATIC_PLATFORM_ADAPTER_HPP__
#include <thread>
#include <map>
#include <cstdlib>
#include <fstream>
#include <string>
#include "platform_adapter.hpp"
#include "module_adapter.hpp"
#include "tai.h"
#include "json.hpp"
using json = nlohmann::json;
const std::string TAI_MUX_STATIC_CONFIG_FILE = "TAI_MUX_STATIC_CONFIG_FILE";
const std::string TAI_MUX_STATIC_DEFAULT_CONFIG = "/etc/tai/mux/static.json";
class StaticPlatformAdapter : public PlatformAdapter {
public:
StaticPlatformAdapter(uint64_t flags, const tai_service_method_table_t* services);
~StaticPlatformAdapter();
ModuleAdapter* get_module_adapter(const std::string& location) {
return m_ma_map[location];
};
const std::unordered_set<ModuleAdapter*> list_module_adapters() {
std::unordered_set<ModuleAdapter*> set;
for ( auto m : m_ma_map ) {
set.emplace(m.second);
}
return set;
};
private:
std::map<std::string, ModuleAdapter*> m_ma_map;
std::thread m_th;
tai_service_method_table_t m_services;
};
#endif