mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
* Include only what is used * Use forward declaration when possible * Sorted includes refs #598
94 lines
3.2 KiB
C++
94 lines
3.2 KiB
C++
/* Copyright (C) 2013
|
|
* swift Project Community / Contributors
|
|
*
|
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
|
* contained in the LICENSE file.
|
|
*/
|
|
|
|
//! \file
|
|
|
|
#ifndef BLACKCORE_PLUGIN_MANAGER_SIMULATOR_H
|
|
#define BLACKCORE_PLUGIN_MANAGER_SIMULATOR_H
|
|
|
|
#include "blackcore/blackcoreexport.h"
|
|
#include "blackcore/pluginmanager.h"
|
|
#include "blackmisc/pluginstorageprovider.h"
|
|
#include "blackmisc/sequence.h"
|
|
#include "blackmisc/simulation/simulatorplugininfo.h"
|
|
#include "blackmisc/simulation/simulatorplugininfolist.h"
|
|
#include "blackmisc/variant.h"
|
|
|
|
#include <QHash>
|
|
#include <QMap>
|
|
#include <QObject>
|
|
#include <QString>
|
|
|
|
namespace BlackCore
|
|
{
|
|
class ISimulatorFactory;
|
|
class ISimulatorListener;
|
|
|
|
/*!
|
|
* Manages plugins for the simulator context.
|
|
*/
|
|
class BLACKCORE_EXPORT CPluginManagerSimulator :
|
|
public BlackCore::IPluginManager,
|
|
public BlackMisc::IPluginStorageProvider
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
//! Ctor
|
|
CPluginManagerSimulator(QObject *parent = nullptr);
|
|
|
|
//! \copydoc BlackMisc::IPluginStorageProvider::getPluginData
|
|
virtual BlackMisc::CVariant getPluginData(const QObject *obj, const QString &key) const override;
|
|
|
|
//! \copydoc BlackMisc::IPluginStorageProvider::setPluginData
|
|
virtual void setPluginData(const QObject *obj, const QString &key, const BlackMisc::CVariant &value) override;
|
|
|
|
//! Get simulator factory from the plugin
|
|
ISimulatorFactory *getFactory(const QString &pluginId);
|
|
|
|
//! Create simulator listener from the plugin
|
|
//! In case one is existing already, it is returned instead.
|
|
ISimulatorListener *createListener(const QString &pluginId);
|
|
|
|
//! Get previously created simulator listener from the plugin
|
|
//! Returns nullptr if listener is not yet created
|
|
ISimulatorListener *getListener(const QString &pluginId);
|
|
|
|
//! Get all simulator driver plugins
|
|
BlackMisc::Simulation::CSimulatorPluginInfoList getAvailableSimulatorPlugins() const;
|
|
|
|
//! \copydoc BlackCore::IPluginManager::collectPlugins()
|
|
virtual void collectPlugins() override;
|
|
|
|
protected:
|
|
//! \copydoc BlackCore::IPluginManager::acceptedIids()
|
|
virtual BlackMisc::CSequence<QString> acceptedIids() const override;
|
|
|
|
//! \copydoc BlackCore::IPluginManager::pluginDirectory()
|
|
virtual QString pluginDirectory() const override;
|
|
|
|
private:
|
|
/*!
|
|
* Extended data for plugin
|
|
*/
|
|
struct PluginExtended
|
|
{
|
|
BlackMisc::Simulation::CSimulatorPluginInfo info;
|
|
ISimulatorListener *listener = nullptr;
|
|
QHash<QString, BlackMisc::CVariant> storage; //!< Permanent plugin storage - data stored here will be kept even when plugin is unloaded
|
|
};
|
|
|
|
QMap<QString, PluginExtended> m_plugins; //!< Id <-> extended data pairs
|
|
|
|
};
|
|
|
|
} // namespace
|
|
|
|
#endif // BLACKCORE_PLUGIN_MANAGER_SIMULATOR_H
|