| 1 |
/* |
| 2 |
* Copyright (C) 2018 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "EventLogManager.h" |
| 10 |
|
| 11 |
#include "EventLog.h" |
| 12 |
|
| 13 |
#include <memory> |
| 14 |
#include <mutex> |
| 15 |
#include <utility> |
| 16 |
|
| 17 |
CEventLog& CEventLogManager::GetEventLog(unsigned int profileId) |
| 18 |
{ |
| 19 |
std::unique_lock<CCriticalSection> lock(m_eventMutex); |
| 20 |
|
| 21 |
auto eventLog = m_eventLogs.find(profileId); |
| 22 |
if (eventLog == m_eventLogs.end()) |
| 23 |
{ |
| 24 |
m_eventLogs.insert(std::make_pair(profileId, std::make_unique<CEventLog>())); |
| 25 |
eventLog = m_eventLogs.find(profileId); |
| 26 |
} |
| 27 |
|
| 28 |
return *eventLog->second; |
| 29 |
} |