|
- #include "Singleton.h"
-
- Singleton* Singleton::m_pInstance = nullptr;
- QMutex Singleton::m_mutex;
- Singleton::Singleton() : m_strExePath(""), m_strModelType("")
- {}
-
- Singleton::~Singleton()
- {}
-
- Singleton* Singleton::CreateInstance()
- {
- if (m_pInstance == nullptr) {
- QMutexLocker locker(&m_mutex);
- if (m_pInstance == nullptr) {
- m_pInstance = new Singleton();
- }
- }
- return m_pInstance;
- }
-
- bool Singleton::setExePath(QString path)
- {
- if (path == "") {
- return false;
- }
- m_strExePath = path;
- return true;
- }
- QString Singleton::getExePath()
- {
- return m_strExePath;
- }
-
- void Singleton::setConfigInfo(std::map<QString, ConfigInfo*>& mapStrConfigInfo)
- {
- m_mapStrConfigInfo = mapStrConfigInfo;
- }
-
- std::map<QString, ConfigInfo*>& Singleton::getConfigInfo()
- {
- return m_mapStrConfigInfo;
- }
-
- void Singleton::setModelType(QString modeltype)
- {
- m_strModelType = modeltype;
- }
- QString Singleton::getModelType()
- {
- return m_strModelType;
- }
-
- void Singleton::setDataPath(QString path)
- {
- m_strDataPath = path;
- }
- QString Singleton::getDataPath()
- {
- return m_strDataPath;
- }
|