{Companion] Unload simulator libraries after each use -- reset all statically initialized firmware variables. (#4655)
* [simulatormainwindow] Move sub-window destructors to main destructor. * [simulation] Move SimulatorInterface creation/ownership to SimulatorMainWindow. * [simulation] Add option to unload simulator libraries after each use (eg. from Companion) so as to properly reset all statically initialized firmware variables; Introduce new SimulatorLoader class.
This commit is contained in:
committed by
Bertrand Songis
parent
dc89d2d630
commit
e48b1fd07d
@@ -23,11 +23,16 @@
|
||||
|
||||
#include "boards.h"
|
||||
#include "constants.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
#include <QDir>
|
||||
#include <QLibrary>
|
||||
#include <QMap>
|
||||
#include <algorithm>
|
||||
|
||||
struct TxInputs
|
||||
{
|
||||
@@ -122,9 +127,21 @@ class SimulatorFactory {
|
||||
virtual SimulatorInterface *create() = 0;
|
||||
};
|
||||
|
||||
void registerSimulators();
|
||||
void unregisterSimulators();
|
||||
SimulatorFactory *getSimulatorFactory(const QString &name);
|
||||
extern QMap<QString, SimulatorFactory *> registered_simulators;
|
||||
class SimulatorLoader
|
||||
{
|
||||
public:
|
||||
static void registerSimulators();
|
||||
static void unregisterSimulators();
|
||||
static QStringList getAvailableSimulators();
|
||||
static QString findSimulatorByFirmwareName(const QString & name);
|
||||
static SimulatorInterface * loadSimulator(const QString & name);
|
||||
static bool unloadSimulator(const QString & name);
|
||||
|
||||
protected:
|
||||
typedef SimulatorFactory * (*RegisterSimulator)();
|
||||
|
||||
static int registerSimulators(const QDir & dir);
|
||||
static QMap<QString, QLibrary *> registeredSimulators;
|
||||
};
|
||||
|
||||
#endif // _SIMULATORINTERFACE_H_
|
||||
|
||||
Reference in New Issue
Block a user