ATLAS Offline Software
KitManager.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "KitManager.h"
5 #include <sstream>
6 #include <stdexcept>
7 
10 
11 const void *KitManagerBase::kitPtr(const std::string &name) const {
12  std::lock_guard<std::mutex> lock (m_mutex);
13  return m_registry.at(name);
14 }
15 
16 bool KitManagerBase::registerKit(const std::string& name, const void *a_kit) {
17  std::lock_guard<std::mutex> lock (m_mutex);
18  std::pair<std::string, const void *> elm = std::make_pair(name, a_kit);
19  if (!m_registry.insert(elm).second) {
20  std::stringstream message;
21  message << "Failed to register kit " << elm.first;
22  throw std::runtime_error(message.str());
23  }
24  return true;
25 }
26 
27 void KitManagerBase::dumpKits(std::ostream &out) const {
28  std::lock_guard<std::mutex> lock (m_mutex);
29  for(const std::pair<const std::string, const void *> &elm: m_registry) {
30  out << " " << elm.first;
31  }
32 }
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
KitManagerBase::~KitManagerBase
virtual ~KitManagerBase()
ReweightUtils.message
message
Definition: ReweightUtils.py:15
KitManagerBase::KitManagerBase
KitManagerBase()
KitManager.h
KitManagerBase::dumpKits
void dumpKits(std::ostream &out) const
Definition: KitManager.cxx:27
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
KitManagerBase::m_mutex
std::mutex m_mutex
Definition: KitManager.h:23
KitManagerBase::registerKit
bool registerKit(const std::string &name, const void *a_kit)
Definition: KitManager.cxx:16
KitManagerBase::m_registry
std::map< std::string, const void * > m_registry
Definition: KitManager.h:24
KitManagerBase::kitPtr
const void * kitPtr(const std::string &name) const
Definition: KitManager.cxx:11