CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PrintLoadingPlugins.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Services
4 // Class : PrintLoadingPlugins
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author:
10 // Created: Thu Dec 13 15:00:49 EST 2007
11 //
12 
13 // system include files
14 
15 // user include files
22 
24 
25 #include <algorithm>
26 #include <functional>
27 #include <iostream>
28 #include <string>
29 #include <map>
30 
31 //
32 // constants, enums and typedefs
33 //
34 
35 //
36 // static data member definitions
37 //
38 
39 //
40 // constructors and destructor
41 //
42 using namespace edmplugin;
43 
45 {
46  using std::placeholders::_1;
47  using std::placeholders::_2;
49 
50  pm->askedToLoadCategoryWithPlugin_.connect(std::bind(std::mem_fn(&PrintLoadingPlugins::askedToLoad),this, _1,_2));
51 
52  pm->goingToLoad_.connect(std::bind(std::mem_fn(&PrintLoadingPlugins::goingToLoad),this, _1));
53 
54 
55 
56 }
57 
58 // PrintLoadingPlugins::PrintLoadingPlugins(const PrintLoadingPlugins& rhs)
59 // {
60 // // do actual copying here;
61 // }
62 
64 {
65 }
66 
69  descriptions.add("PrintLoadingPlugins", desc);
70  descriptions.setComment("This service logs each request to load a plugin.");
71 }
72 
73 //
74 // assignment operators
75 //
76 // const PrintLoadingPlugins& PrintLoadingPlugins::operator=(const PrintLoadingPlugins& rhs)
77 // {
78 // //An exception safe implementation is
79 // PrintLoadingPlugins temp(rhs);
80 // swap(rhs);
81 //
82 // return *this;
83 // }
84 
85 //
86 // member functions
87 //
88 
89  namespace{
90  struct PICompare {
91  bool operator()(const PluginInfo& iLHS,
92  const PluginInfo& iRHS) const {
93  return iLHS.name_ < iRHS.name_;
94  }
95  };
96  }
97 
99  const std::string& iPlugin)
100 {
102 
104 
105  PluginManager::CategoryToInfos::const_iterator itFound = category.find(iCategory);
106 
107  std::string libname("Not found");
108 
109  if(itFound != category.end()) {
110 
111  PluginInfo i;
112 
113  i.name_ = iPlugin;
114 
115  typedef std::vector<PluginInfo>::const_iterator PIItr;
116 
117  std::pair<PIItr,PIItr> range = std::equal_range(itFound->second.begin(),itFound->second.end(),i,PICompare());
118 
119  if(range.second - range.first > 1){
120 
121  const boost::filesystem::path& loadable = range.first->loadable_;
122 
123  libname = loadable.string();
124 
125  }
126 
127  edm::LogAbsolute("GetPlugin")<<"Getting> '"<<iCategory<< "' "<<iPlugin
128  <<"\n from "<<libname <<std::endl;
129  }
130 
131 }
132 
134 
135 {
136  edm::LogAbsolute("LoadLib")<<"Loading> "<<Loadable_.string()<< std::endl;
137 }
138 
139 
140 //
141 // const member functions
142 //
143 
144 //
145 // static member functions
146 //
const CategoryToInfos & categoryToInfos() const
Definition: PluginManager.h:82
int i
Definition: DBlmapReader.cc:9
void askedToLoad(const std::string &, const std::string &)
tuple path
else: Piece not in the list, fine.
std::map< std::string, Infos > CategoryToInfos
Definition: PluginManager.h:54
void setComment(std::string const &value)
void goingToLoad(const boost::filesystem::path &)
edm::signalslot::Signal< void(const std::string &, const std::string &)> askedToLoadCategoryWithPlugin_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::signalslot::Signal< void(const boost::filesystem::path &)> goingToLoad_
std::string name_
Definition: PluginInfo.h:29
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static PluginManager * get()
void connect(U iFunc)
Definition: Signal.h:63