mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T709, settings provider to get settings
* allows to use the provider without and overhead * single source, can be made threadsafe Signed-off-by: Klaus Basan <klaus.basan@klausbasan.de>
This commit is contained in:
committed by
Mat Sutcliffe
parent
7004e85117
commit
006fbc88ae
@@ -27,5 +27,17 @@ namespace XSwiftBus
|
||||
// void
|
||||
}
|
||||
|
||||
CSettings ISettingsProvider::getSettings() const
|
||||
{
|
||||
std::lock_guard<std::mutex> l(m_settingsMutex);
|
||||
return m_pluginSettings;
|
||||
}
|
||||
|
||||
void ISettingsProvider::setSettings(const CSettings &settings)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(m_settingsMutex);
|
||||
m_pluginSettings = settings;
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "blackmisc/simulation/settings/xswiftbussettingsqtfree.h"
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
|
||||
namespace XSwiftBus
|
||||
{
|
||||
@@ -30,6 +31,21 @@ namespace XSwiftBus
|
||||
virtual ~CSettings() {}
|
||||
};
|
||||
|
||||
//! Something owning the settings
|
||||
class ISettingsProvider
|
||||
{
|
||||
public:
|
||||
//! By value
|
||||
//! \threadsafe
|
||||
CSettings getSettings() const;
|
||||
|
||||
//! Set settings
|
||||
//! \threadsafe
|
||||
void setSettings(const CSettings &settings);
|
||||
|
||||
private:
|
||||
mutable std::mutex m_settingsMutex;
|
||||
CSettings m_pluginSettings; //!< owner of the settings
|
||||
};
|
||||
} // ns
|
||||
|
||||
|
||||
Reference in New Issue
Block a user