test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
28 // user include files
29 
30 // forward declarations
31 class testSharedResourcesRegistry;
32 
33 namespace edm {
35 
37  {
38 
39  public:
40  //needed for testing
41  friend class ::testSharedResourcesRegistry;
42 
43  // ---------- const member functions ---------------------
44  SharedResourcesAcquirer createAcquirer(std::vector<std::string> const&) const;
45 
47  // ---------- static member functions --------------------
49 
52 
53  // ---------- member functions ---------------------------
56 
57 #ifdef SHAREDRESOURCETESTACCESSORS
58  // The next function is intended to be used only in a unit test
59  std::map<std::string, std::pair<std::shared_ptr<std::recursive_mutex>,unsigned int>> const& resourceMap() const { return resourceMap_; }
60 #endif
61 
62  private:
64  ~SharedResourcesRegistry()=default;
65 
66  SharedResourcesRegistry(const SharedResourcesRegistry&) = delete; // stop default
67 
68  const SharedResourcesRegistry& operator=(const SharedResourcesRegistry&) = delete; // stop default
69 
70  // ---------- member data --------------------------------
71  std::map<std::string, std::pair<std::shared_ptr<std::recursive_mutex>,unsigned int>> resourceMap_;
72 
73  std::shared_ptr<std::recursive_mutex> resourceForDelayedReader_;
74 
75  unsigned int nLegacy_;
76  };
77 }
78 
79 #endif
SharedResourcesAcquirer createAcquirerForSourceDelayedReader()
std::map< std::string, std::pair< std::shared_ptr< std::recursive_mutex >, unsigned int > > resourceMap_
SharedResourcesAcquirer createAcquirer(std::vector< std::string > const &) const
static SharedResourcesRegistry * instance()
void registerSharedResource(const std::string &)
A resource name must be registered before it can be used in the createAcquirer call.
static const std::string kLegacyModuleResourceName
All legacy modules share this resource.
std::shared_ptr< std::recursive_mutex > resourceForDelayedReader_
const SharedResourcesRegistry & operator=(const SharedResourcesRegistry &)=delete