From c0694e2d6985166ac87873ab8f620d35933d5250 Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Mon, 23 Feb 2015 16:14:17 -0500 Subject: [PATCH] remove plugin from exampleDatabase --- .../ioc/src/exampleDatabaseInclude.dbd | 1 - exampleDatabase/src/Makefile | 3 - .../src/exampleDatabaseInclude.dbd | 1 - exampleDatabase/src/exampleDatabaseMain.cpp | 2 - exampleDatabase/src/exampleMonitorPlugin.cpp | 99 ------------------- exampleDatabase/src/exampleMonitorPlugin.h | 40 -------- .../src/exampleMonitorPluginRegister.cpp | 65 ------------ src/pvAccess/channelProviderLocal.h | 1 - 8 files changed, 212 deletions(-) delete mode 100644 exampleDatabase/src/exampleMonitorPlugin.cpp delete mode 100644 exampleDatabase/src/exampleMonitorPlugin.h delete mode 100644 exampleDatabase/src/exampleMonitorPluginRegister.cpp diff --git a/exampleDatabase/ioc/src/exampleDatabaseInclude.dbd b/exampleDatabase/ioc/src/exampleDatabaseInclude.dbd index c9f4eff..d91b610 100644 --- a/exampleDatabase/ioc/src/exampleDatabaseInclude.dbd +++ b/exampleDatabase/ioc/src/exampleDatabaseInclude.dbd @@ -4,4 +4,3 @@ include "registerChannelProviderLocal.dbd" include "dbPv.dbd" include "powerSupplyRegister.dbd" registrar("exampleDatabaseRegister") -registrar("exampleMonitorPluginRegister") diff --git a/exampleDatabase/src/Makefile b/exampleDatabase/src/Makefile index 0a47c1f..a54eb26 100644 --- a/exampleDatabase/src/Makefile +++ b/exampleDatabase/src/Makefile @@ -7,13 +7,10 @@ include $(TOP)/configure/CONFIG DBD += exampleDatabase.dbd INC += exampleDatabase.h -INC += exampleMonitorPlugin.h LIBRARY += exampleDatabase exampleDatabase_SRCS += exampleDatabase.cpp -exampleDatabase_SRCS += exampleMonitorPlugin.cpp exampleDatabase_SRCS += exampleDatabaseRegister.cpp -exampleDatabase_SRCS += exampleMonitorPluginRegister.cpp exampleDatabase_LIBS += powerSupply exampleDatabase_LIBS += pvDatabase exampleDatabase_LIBS += pvAccess diff --git a/exampleDatabase/src/exampleDatabaseInclude.dbd b/exampleDatabase/src/exampleDatabaseInclude.dbd index 9ff63c0..d1f734b 100644 --- a/exampleDatabase/src/exampleDatabaseInclude.dbd +++ b/exampleDatabase/src/exampleDatabaseInclude.dbd @@ -1,2 +1 @@ registrar("exampleDatabaseRegister") -registrar("exampleMonitorPluginRegister") diff --git a/exampleDatabase/src/exampleDatabaseMain.cpp b/exampleDatabase/src/exampleDatabaseMain.cpp index af4972b..82af5d6 100644 --- a/exampleDatabase/src/exampleDatabaseMain.cpp +++ b/exampleDatabase/src/exampleDatabaseMain.cpp @@ -23,7 +23,6 @@ #include #include -#include using namespace std; using std::tr1::static_pointer_cast; @@ -37,7 +36,6 @@ int main(int argc,char *argv[]) PVDatabasePtr master = PVDatabase::getMaster(); ChannelProviderLocalPtr channelProvider = getChannelProviderLocal(); ExampleDatabase::create(); - ExampleMonitorPlugin::create(); ServerContext::shared_pointer ctx = startPVAServer(PVACCESS_ALL_PROVIDERS,0,true,true); cout << "exampleDatabase\n"; diff --git a/exampleDatabase/src/exampleMonitorPlugin.cpp b/exampleDatabase/src/exampleMonitorPlugin.cpp deleted file mode 100644 index 71785be..0000000 --- a/exampleDatabase/src/exampleMonitorPlugin.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* exampleMonitorPlugin.h */ -/** - * 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 - * @date 2014.04.16 - */ - -#include - -#define epicsExportSharedSymbols -#include - -using namespace epics::pvData; -using std::cout; -using std::endl; -using std::string; - -namespace epics { namespace pvDatabase { - -static string pluginName("onChange"); - -class OnChangePlugin; -typedef std::tr1::shared_ptr OnChangePluginPtr; -class OnChangePluginCreator; -typedef std::tr1::shared_ptr OnChangePluginCreatorPtr; - -class OnChangePlugin : public MonitorPlugin -{ -public: - virtual ~OnChangePlugin(){} - OnChangePlugin() {} - bool init( - FieldConstPtr const &field, - StructureConstPtr const &top, - PVStructurePtr const &pvFieldOptions) - { - pvField = getPVDataCreate()->createPVField(field); - raiseMonitor = true; - if(pvFieldOptions) { - PVStringPtr pvString = - pvFieldOptions->getSubField("raiseMonitor"); - if(pvString) { - string value = pvString->get(); - if(value.compare("false")==0) raiseMonitor = false; - } - } - return true; - } - virtual string &getName(){return pluginName;} - virtual bool causeMonitor( - PVFieldPtr const &pvNew, - PVStructurePtr const &pvTop, - MonitorElementPtr const &monitorElement) - { - bool isSame = (*pvNew == *pvField); - if(isSame) return false; - pvField->copyUnchecked(*pvNew); - return raiseMonitor; - } -private: - PVFieldPtr pvField; - bool raiseMonitor; -}; - -class OnChangePluginCreator : public MonitorPluginCreator -{ -public: - virtual string &getName(){return pluginName;} - virtual MonitorPluginPtr create( - FieldConstPtr const &field, - StructureConstPtr const &top, - PVStructurePtr const &pvFieldOptions) - { - OnChangePluginPtr plugin(new OnChangePlugin()); - bool result = plugin->init(field,top,pvFieldOptions); - if(!result) return MonitorPluginPtr(); - return plugin; - } - -}; - -void ExampleMonitorPlugin::create() -{ - static OnChangePluginCreatorPtr plugin; - static Mutex mutex; - Lock xx(mutex); - if(!plugin) { - plugin = OnChangePluginCreatorPtr(new OnChangePluginCreator()); - MonitorPluginManager::get()->addPlugin(pluginName,plugin); - } -} - - -}} - diff --git a/exampleDatabase/src/exampleMonitorPlugin.h b/exampleDatabase/src/exampleMonitorPlugin.h deleted file mode 100644 index 8b33973..0000000 --- a/exampleDatabase/src/exampleMonitorPlugin.h +++ /dev/null @@ -1,40 +0,0 @@ -/* exampleMonitorPlugin.h */ -/** - * 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 - * @date 2014.04.16 - */ -#ifndef EXAMPLEMONITORPLUGIN_H -#define EXAMPLEMONITORPLUGIN_H - -#ifdef epicsExportSharedSymbols -# define examplemonitorPluginEpicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif - -#include -#include - -#ifdef examplemonitorPluginEpicsExportSharedSymbols -# define epicsExportSharedSymbols -# undef examplemonitorPluginEpicsExportSharedSymbols -#endif - -#include - - -namespace epics { namespace pvDatabase { - -class epicsShareClass ExampleMonitorPlugin{ -public: - static void create(); -}; - - -}} - -#endif /* EXAMPLEMONITORPLUGIN_H */ diff --git a/exampleDatabase/src/exampleMonitorPluginRegister.cpp b/exampleDatabase/src/exampleMonitorPluginRegister.cpp deleted file mode 100644 index 4277617..0000000 --- a/exampleDatabase/src/exampleMonitorPluginRegister.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/*exampleMonitorPlugin.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 - * @date 2013.07.24 - */ - - -/* Author: Marty Kraimer */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - - -using namespace epics::pvData; -using namespace epics::pvAccess; -using namespace epics::pvDatabase; - - -static const iocshFuncDef exampleMonitorPluginFuncDef = { - "exampleMonitorPlugin", 0,0 }; - - -static void exampleMonitorPluginCallFunc(const iocshArgBuf *args) -{ - ExampleMonitorPlugin::create(); -} - -static void exampleMonitorPluginRegister(void) -{ -std::cout << "exampleMonitorPluginRegister\n"; - static int firstTime = 1; - if (firstTime) { - firstTime = 0; - iocshRegister(&exampleMonitorPluginFuncDef, exampleMonitorPluginCallFunc); - } -std::cout << "exampleMonitorPluginRegister returning\n"; -} - -extern "C" { - epicsExportRegistrar(exampleMonitorPluginRegister); -} diff --git a/src/pvAccess/channelProviderLocal.h b/src/pvAccess/channelProviderLocal.h index 2a468b5..fb55ceb 100644 --- a/src/pvAccess/channelProviderLocal.h +++ b/src/pvAccess/channelProviderLocal.h @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include