ChimeraTK-DeviceAccess 03.20.00
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DataConsistencyRealmStore.cc
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2// SPDX-License-Identifier: LGPL-3.0-or-later
4
5namespace ChimeraTK::async {
6
7 /********************************************************************************************************************/
8
9 std::shared_ptr<DataConsistencyRealm> DataConsistencyRealmStore::getRealm(const std::string& realmName) {
10 std::lock_guard<std::mutex> lock(_mapMutex);
11
12 auto it = _realmMap.find(realmName);
13 if(it != _realmMap.end()) {
14 if(auto realm = it->second.lock()) {
15 return realm;
16 }
17 }
18
19 auto realm = std::make_shared<DataConsistencyRealm>();
20 _realmMap[realmName] = realm;
21 return realm;
22 }
23
24 /********************************************************************************************************************/
25
26} // namespace ChimeraTK::async
std::shared_ptr< DataConsistencyRealm > getRealm(const std::string &realmName)