completed merge
This commit is contained in:
82
src/monitor/monitorPlugin.cpp
Normal file
82
src/monitor/monitorPlugin.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
/* monitorPlugin.cpp */
|
||||
/**
|
||||
* Copyright - See the COPYRIGHT that is included with this distribution.
|
||||
* EPICS pvData is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
/**
|
||||
* @author mrk
|
||||
*/
|
||||
|
||||
#include <pv/monitorPlugin.h>
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
MonitorPluginManagerPtr MonitorPluginManager::get()
|
||||
{
|
||||
static MonitorPluginManagerPtr pluginManager;
|
||||
static Mutex mutex;
|
||||
Lock xx(mutex);
|
||||
if(pluginManager==NULL) {
|
||||
pluginManager = MonitorPluginManagerPtr(new MonitorPluginManager());
|
||||
}
|
||||
return pluginManager;
|
||||
}
|
||||
|
||||
bool MonitorPluginManager::addPlugin(
|
||||
String const &pluginName,
|
||||
MonitorPluginCreatorPtr const &creator)
|
||||
{
|
||||
mutex.lock();
|
||||
std::list<MonitorPluginCreatorPtr>::iterator iter;
|
||||
for (iter = monitorPluginList.begin();iter!=monitorPluginList.end();iter++)
|
||||
{
|
||||
if(*iter==creator)
|
||||
{
|
||||
mutex.unlock();
|
||||
return false;
|
||||
}
|
||||
if(((*iter)->getName().compare(pluginName))==0)
|
||||
{
|
||||
mutex.unlock();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
monitorPluginList.push_back(creator);
|
||||
mutex.unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
MonitorPluginCreatorPtr MonitorPluginManager::findPlugin(
|
||||
String const &pluginName)
|
||||
{
|
||||
mutex.lock();
|
||||
std::list<MonitorPluginCreatorPtr>::iterator iter;
|
||||
for (iter = monitorPluginList.begin();iter!=monitorPluginList.end();++iter)
|
||||
{
|
||||
if(((*iter)->getName().compare(pluginName))==0)
|
||||
{
|
||||
mutex.unlock();
|
||||
return *iter;
|
||||
}
|
||||
}
|
||||
mutex.unlock();
|
||||
return MonitorPluginCreatorPtr();
|
||||
}
|
||||
|
||||
void MonitorPluginManager::showNames()
|
||||
{
|
||||
mutex.lock();
|
||||
std::list<MonitorPluginCreatorPtr>::iterator iter;
|
||||
for (iter = monitorPluginList.begin();iter!=monitorPluginList.end();++iter)
|
||||
{
|
||||
std::cout << (*iter)->getName() << std::endl;
|
||||
}
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
}}
|
||||
Reference in New Issue
Block a user