This is Unofficial EPICS BASE Doxygen Site
pvPlugin.cpp
Go to the documentation of this file.
1 /* pvPlugin.cpp */
2 /*
3  * The License for this software can be found in the file LICENSE that is included with the distribution.
4  */
5 
6 #include <pv/pvData.h>
7 #include <string>
8 #include <map>
9 #include <pv/lock.h>
10 #include <pv/bitSet.h>
11 
12 #define epicsExportSharedSymbols
13 #include "pv/pvPlugin.h"
14 
15 using namespace epics::pvData;
16 
17 namespace epics { namespace pvCopy{
18 
19 typedef std::map<std::string,PVPluginPtr> PVPluginMap;
20 
21 static PVPluginMap pluginMap;
22 static Mutex mutex;
23 
24 void PVPluginRegistry::registerPlugin(const std::string & name,const PVPluginPtr & pvPlugin)
25 {
26  Lock xx(mutex);
27  PVPluginMap::iterator iter = pluginMap.find(name);
28  if(iter!=pluginMap.end()) throw std::logic_error("plugin already registered");
29  pluginMap.insert(PVPluginMap::value_type(name,pvPlugin));
30 }
31 
32 PVPluginPtr PVPluginRegistry::find(const std::string & name)
33 {
34  Lock xx(mutex);
35  PVPluginMap::iterator iter = pluginMap.find(name);
36  if(iter!=pluginMap.end()) return (*iter).second;
37  return PVPluginPtr();
38 }
39 
40 }}
std::map< std::string, PVPluginPtr > PVPluginMap
Definition: pvPlugin.cpp:19
std::tr1::shared_ptr< PVPlugin > PVPluginPtr
Definition: pvPlugin.h:28
TODO only here because of the Lockable.
Definition: ntaggregate.cpp:16
A lock for multithreading.
Definition: lock.h:36
pvData
Definition: monitor.h:428
epicsMutex mutex
Definition: pvAccess.cpp:71
epicsMutex Mutex
Definition: lock.h:28