CMS 3D CMS Logo

SharedResourcesRegistry.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_SharedResourcesRegistry_h
2 #define FWCore_Framework_SharedResourcesRegistry_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : SharedResourcesRegistry
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Sun, 06 Oct 2013 15:48:44 GMT
19 //
20 
21 // system include files
22 #include <vector>
23 #include <string>
24 #include <map>
25 #include <mutex>
26 #include <memory>
27 
30 
31 // user include files
32 
33 // forward declarations
34 class testSharedResourcesRegistry;
35 
36 namespace edm {
38 
40  public:
41  //needed for testing
42  friend class ::testSharedResourcesRegistry;
43 
44  SharedResourcesRegistry(const SharedResourcesRegistry&) = delete; // stop default
45  const SharedResourcesRegistry& operator=(const SharedResourcesRegistry&) = delete; // stop default
46 
47  // ---------- const member functions ---------------------
48  SharedResourcesAcquirer createAcquirer(std::vector<std::string> const&) const;
49 
50  std::pair<SharedResourcesAcquirer, std::shared_ptr<std::recursive_mutex>> createAcquirerForSourceDelayedReader();
51 
52  // ---------- static member functions --------------------
54 
57 
58  // ---------- member functions ---------------------------
61 
62 #ifdef SHAREDRESOURCETESTACCESSORS
63  // The next function is intended to be used only in a unit test
64  std::map<std::string, std::pair<std::shared_ptr<SerialTaskQueue>, unsigned int>> const& resourceMap() const {
65  return resourceMap_;
66  }
67 #endif
68 
69  private:
71  ~SharedResourcesRegistry() = default;
72 
73  // ---------- member data --------------------------------
74  std::map<std::string, std::pair<std::shared_ptr<SerialTaskQueue>, unsigned int>> resourceMap_;
75 
77 
79 
80  unsigned int nLegacy_;
81  };
82 } // namespace edm
83 
84 #endif
edm::SharedResourcesAcquirer
Definition: SharedResourcesAcquirer.h:34
edm::SharedResourcesRegistry::resourceForDelayedReader_
edm::propagate_const< std::shared_ptr< std::recursive_mutex > > resourceForDelayedReader_
Definition: SharedResourcesRegistry.h:76
edm::SharedResourcesRegistry::registerSharedResource
void registerSharedResource(const std::string &)
A resource name must be registered before it can be used in the createAcquirer call.
Definition: SharedResourcesRegistry.cc:32
propagate_const.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::SharedResourcesRegistry::kLegacyModuleResourceName
static const std::string kLegacyModuleResourceName
All legacy modules share this resource.
Definition: SharedResourcesRegistry.h:56
edm::SharedResourcesRegistry::createAcquirerForSourceDelayedReader
std::pair< SharedResourcesAcquirer, std::shared_ptr< std::recursive_mutex > > createAcquirerForSourceDelayedReader()
Definition: SharedResourcesRegistry.cc:64
edm::SharedResourcesRegistry::queueForDelayedReader_
edm::propagate_const< std::shared_ptr< SerialTaskQueue > > queueForDelayedReader_
Definition: SharedResourcesRegistry.h:78
edm::propagate_const
Definition: propagate_const.h:32
SerialTaskQueue.h
edm::SharedResourcesRegistry::~SharedResourcesRegistry
~SharedResourcesRegistry()=default
edm::SharedResourcesRegistry::SharedResourcesRegistry
SharedResourcesRegistry()
Definition: SharedResourcesRegistry.cc:30
edm::SharedResourcesRegistry::instance
static SharedResourcesRegistry * instance()
Definition: SharedResourcesRegistry.cc:25
SharedResourcesAcquirer
edm::SharedResourcesRegistry::createAcquirer
SharedResourcesAcquirer createAcquirer(std::vector< std::string > const &) const
Definition: SharedResourcesRegistry.cc:75
edm::SharedResourcesRegistry
Definition: SharedResourcesRegistry.h:39
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::SharedResourcesRegistry::nLegacy_
unsigned int nLegacy_
Definition: SharedResourcesRegistry.h:80
edm::SharedResourcesRegistry::operator=
const SharedResourcesRegistry & operator=(const SharedResourcesRegistry &)=delete
edm::SharedResourcesRegistry::resourceMap_
std::map< std::string, std::pair< std::shared_ptr< SerialTaskQueue >, unsigned int > > resourceMap_
Definition: SharedResourcesRegistry.h:74