Files
softbus_daemon/src/core/plugin_system/PluginManager.h
flower_linux 11bd86063d endpointhash
2026-04-15 20:05:04 +08:00

46 lines
2.0 KiB
C++

#pragma once
#include <memory>
#include <QHash>
#include <QString>
#include <QStringList>
#include "core/plugin_system/IProtocolFramerPlugin.h"
#include "core/plugin_system/IProtocolMapperPlugin.h"
#include "core/plugin_system/IProtocolPlugin.h"
namespace softbus::core::plugin_system
{
class PluginManager
{
public:
PluginManager() = default;
void registerProtocolPlugin(std::shared_ptr<IProtocolPlugin> plugin);
std::shared_ptr<IProtocolPlugin> selectProtocolPlugin(softbus::core::models::ProtocolType protocol) const;
void unregisterProtocolPlugin(const QString& pluginId);
void registerProtocolFramerPlugin(std::shared_ptr<IProtocolFramerPlugin> plugin);
std::shared_ptr<IProtocolFramerPlugin> selectProtocolFramerPlugin(
softbus::core::models::ProtocolType protocol) const;
void unregisterProtocolFramerPlugin(const QString& pluginId);
void registerProtocolMapperPlugin(std::shared_ptr<IProtocolMapperPlugin> plugin);
std::shared_ptr<IProtocolMapperPlugin> selectProtocolMapperPlugin(
softbus::core::models::ProtocolType protocol) const;
void unregisterProtocolMapperPlugin(const QString& pluginId);
QStringList registeredProtocolPluginIds() const;
QStringList registeredProtocolFramerPluginIds() const;
QStringList registeredProtocolMapperPluginIds() const;
private:
QHash<QString, std::shared_ptr<IProtocolPlugin>> m_protocolPluginsById;
QHash<softbus::core::models::ProtocolType, std::shared_ptr<IProtocolPlugin>> m_protocolPluginsByType;
QHash<QString, std::shared_ptr<IProtocolFramerPlugin>> m_protocolFramerPluginsById;
QHash<softbus::core::models::ProtocolType, std::shared_ptr<IProtocolFramerPlugin>> m_protocolFramerPluginsByType;
QHash<QString, std::shared_ptr<IProtocolMapperPlugin>> m_protocolMapperPluginsById;
QHash<softbus::core::models::ProtocolType, std::shared_ptr<IProtocolMapperPlugin>> m_protocolMapperPluginsByType;
};
} // namespace softbus::core::plugin_system