38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
|
|
#ifndef CONNECTIONMANAGER_H
|
|
#define CONNECTIONMANAGER_H
|
|
|
|
#include <QObject>
|
|
#include <QVector>
|
|
#include "baseConnection.h"
|
|
#include <memory>
|
|
|
|
class ConnectionManager:public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
static ConnectionManager& getInstance()
|
|
{
|
|
static ConnectionManager instance;
|
|
return instance;
|
|
}
|
|
void insert(std::shared_ptr<BaseConnection> conn);
|
|
void remove(int idx);
|
|
void remove(std::shared_ptr<BaseConnection> conn);
|
|
int getConnectionCounts();
|
|
std::shared_ptr<BaseConnection> getConnection(int idx);
|
|
std::shared_ptr<BaseConnection> getConnection(const QString &connectionName);
|
|
|
|
signals:
|
|
void connectionAddedSignal(std::shared_ptr<BaseConnection> connPtr);
|
|
void connectionRemovedSignal(std::shared_ptr<BaseConnection> connPtr);
|
|
void connectionChangeSignal(std::shared_ptr<BaseConnection> connPtr);
|
|
|
|
private:
|
|
ConnectionManager(QObject *parent = nullptr);
|
|
~ConnectionManager();
|
|
QVector<std::shared_ptr<BaseConnection>> connectionVec;
|
|
};
|
|
|
|
#endif // CONNECTIONMANAGER_H
|