mirror of
https://github.com/Telecominfraproject/oopt-tai-implementations.git
synced 2025-10-30 09:42:22 +00:00
mux: support tai_log_set()
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
This commit is contained in:
committed by
Wataru Ishida
parent
1373f9867f
commit
54155f66f7
@@ -220,6 +220,20 @@ tai_object_type_t Multiplexier::object_type_query(_In_ tai_object_id_t id) {
|
||||
return m_adapter->tai_object_type_query(realid);
|
||||
}
|
||||
|
||||
tai_status_t Multiplexier::tai_log_set(_In_ tai_api_t api, _In_ tai_log_level_t level) {
|
||||
if ( g_mux == nullptr ) {
|
||||
return TAI_STATUS_UNINITIALIZED;
|
||||
}
|
||||
auto set = m_pa->list_module_adapters();
|
||||
for ( const auto& a : set ) {
|
||||
auto ret = a->tai_log_set(api, level);
|
||||
if ( ret != TAI_STATUS_SUCCESS ) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return TAI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
tai_status_t Multiplexier::set_attributes( std::function<tai_status_t(ModuleAdapter*, tai_object_id_t, uint32_t, const tai_attribute_t*)> f, tai_object_id_t oid, uint32_t attr_count, const tai_attribute_t *attr_list) {
|
||||
tai_object_id_t id;
|
||||
ModuleAdapter *m_adapter;
|
||||
|
||||
@@ -113,6 +113,10 @@ class Multiplexier {
|
||||
tai_object_type_t object_type_query(
|
||||
_In_ tai_object_id_t id);
|
||||
|
||||
tai_status_t tai_log_set(
|
||||
_In_ tai_api_t tai_api_id,
|
||||
_In_ tai_log_level_t log_level);
|
||||
|
||||
private:
|
||||
Multiplexier(const Multiplexier&){}
|
||||
void operator = (const Multiplexier&){}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define __PLATFORM_ADAPTER_HPP__
|
||||
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
|
||||
class ModuleAdapter;
|
||||
|
||||
@@ -13,6 +14,9 @@ enum platform_adapter_t {
|
||||
class PlatformAdapter {
|
||||
public:
|
||||
virtual ModuleAdapter* get_module_adapter(const std::string& location) = 0;
|
||||
|
||||
/** @brief return the set of loaded module adapters. */
|
||||
virtual const std::unordered_set<ModuleAdapter * > list_module_adapters() = 0;
|
||||
PlatformAdapter(){}
|
||||
private:
|
||||
PlatformAdapter(const PlatformAdapter&){}
|
||||
|
||||
@@ -24,6 +24,13 @@ class StaticPlatformAdapter : public PlatformAdapter {
|
||||
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;
|
||||
|
||||
@@ -221,7 +221,7 @@ tai_status_t tai_api_query(_In_ tai_api_t tai_api_id,
|
||||
}
|
||||
|
||||
tai_status_t tai_log_set(tai_api_t tai_api_id, tai_log_level_t log_level) {
|
||||
return TAI_STATUS_SUCCESS;
|
||||
return g_mux->tai_log_set(tai_api_id, log_level);
|
||||
}
|
||||
|
||||
tai_object_type_t tai_object_type_query(tai_object_id_t id) {
|
||||
|
||||
Reference in New Issue
Block a user