diff --git a/src/monitor/Makefile b/src/monitor/Makefile index 27ca0ad..11c9465 100644 --- a/src/monitor/Makefile +++ b/src/monitor/Makefile @@ -3,7 +3,5 @@ SRC_DIRS += $(PVDATA_SRC)/monitor INC += pv/monitor.h -INC += pv/monitorPlugin.h LIBSRCS += monitor.cpp -LIBSRCS += monitorPlugin.cpp diff --git a/src/monitor/monitorPlugin.cpp b/src/monitor/monitorPlugin.cpp deleted file mode 100644 index a2d533f..0000000 --- a/src/monitor/monitorPlugin.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* monitorPlugin.cpp */ -/* - * Copyright information and license terms for this software can be - * found in the file LICENSE that is included with the distribution - */ -/** - * @author mrk - */ - -#define IN_MONITORPLUGIN_CPP -#define epicsExportSharedSymbols - -#include - -using std::string; -using std::cout; -using std::endl; - -namespace epics { namespace pvData { - -MonitorPluginManagerPtr MonitorPluginManager::get() -{ - static MonitorPluginManagerPtr pluginManager; - static Mutex mutex; - Lock xx(mutex); - if(!pluginManager) { - pluginManager = MonitorPluginManagerPtr(new MonitorPluginManager()); - } - return pluginManager; -} - -bool MonitorPluginManager::addPlugin( - string const &pluginName, - MonitorPluginCreatorPtr const &creator) -{ - mutex.lock(); - std::list::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::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::iterator iter; - for (iter = monitorPluginList.begin();iter!=monitorPluginList.end();++iter) - { - std::cout << (*iter)->getName() << std::endl; - } - mutex.unlock(); -} - - -}} diff --git a/src/monitor/pv/monitorPlugin.h b/src/monitor/pv/monitorPlugin.h deleted file mode 100644 index 45fef83..0000000 --- a/src/monitor/pv/monitorPlugin.h +++ /dev/null @@ -1,180 +0,0 @@ -/* monitorPlugin.h */ -/* - * Copyright information and license terms for this software can be - * found in the file LICENSE that is included with the distribution - */ -/** - * @author mrk - */ -#ifndef MONITORPLUGIN_H -#define MONITORPLUGIN_H - -#include -#include -#include -#include -#include - -#include - -#if !defined(IN_MONITORPLUGIN_CPP) -#warning monitorPlugin.h is deprecated -#endif - -#if !defined(IN_MONITORPLUGIN_CPP) && defined(__GNUC__) && !(defined(__vxworks) && !defined(_WRS_VXWORKS_MAJOR)) -#define USAGE_DEPRECATED __attribute__((deprecated)) -#else -#define USAGE_DEPRECATED -#endif - -namespace epics { namespace pvData { - -class MonitorPlugin; -typedef std::tr1::shared_ptr MonitorPluginPtr; - - -class MonitorPluginCreator; -typedef std::tr1::shared_ptr MonitorPluginCreatorPtr; - - -class MonitorPluginManager; -typedef std::tr1::shared_ptr MonitorPluginManagerPtr; - - -/** - * @brief A plugin for raising monitors; - * - * This is for use by pvAccess servers that support monitors. - * Since the interface has only a dependence on pvData it - * can be used for other purposes. - * A monitor is assumed to be associated with a field of a top-level - * structure. - */ -class epicsShareClass USAGE_DEPRECATED MonitorPlugin -{ -public: - virtual ~MonitorPlugin(){} - /** - * getName - * @returns The name of the plugin - */ - virtual std::string const & getName() = 0; - /** - * Should a monitor be raised? - * @param pvField The field being monitored. - * @param pvTop The top-level structure in which the field resides. - * @param monitorElement The client data and bitsets. - * @returns true or false. - * True is returned if the change to this field should cause a monitor. - * False is returned in a change only to this field should not cause a - * monitor. - */ - virtual bool causeMonitor( - PVFieldPtr const &pvField, - PVStructurePtr const &pvTop, - MonitorElementPtr const &monitorElement) = 0; - /** - * A monitor will be sent to the client. - * @param monitorElement The data for the client. - * The plugin is allowed to change the data values. - */ - virtual void monitorDone( - MonitorElementPtr const &monitorElement) - {} - /** - * Begin monitoring - */ - virtual void startMonitoring(){} - /** - * Stop monitoring - */ - virtual void stopMonitoring(){} - /** - * Begin a set of puts. - */ - virtual void beginGroupPut() {}; - /** - * End a set of puts. - */ - virtual void endGroupPut() {}; -}; - -/** - * @brief A class that creates a plugin. - * - * Normlly a plugin is created for a single client. - */ -class epicsShareClass USAGE_DEPRECATED MonitorPluginCreator -{ -public: - virtual ~MonitorPluginCreator() {} - /** - * Create a monitor plugin. - * @param field The introspection interface for the field monitored. - * @param top The introspection interface for the client structure. - * @param pvFieldOptions The options the client requested. - * The structure has a set of PVString subfields. - * The options are a set of name,value pairs. - * The subfield name is the name and the subfield value is the value. - * @returns shared pointer to a MonitorPluginCreator. - */ - virtual MonitorPluginPtr create( - FieldConstPtr const &field, - StructureConstPtr const &top, - PVStructurePtr const &pvFieldOptions) = 0; - /** - * getName - * @returns The name of the plugin - */ - virtual std::string const & getName() = 0; -}; - - -/** - * @brief Manager for plugins. - * - * This manages a set of monitor plugins. - * @author mrk - */ -class epicsShareClass USAGE_DEPRECATED MonitorPluginManager -{ -public: - POINTER_DEFINITIONS(MonitorPluginManager); - /** - * Factory to get the manager. - * @return shared pointer to manager. - */ - static MonitorPluginManagerPtr get(); - /** destructor - */ - ~MonitorPluginManager(){} - /* add plugin - * @param pluginName The name of the plugin. - * @param creator The creator. - * @returns true or false - * false is returned if a plugin with that name is already present - */ - bool addPlugin( - std::string const &pluginName, - MonitorPluginCreatorPtr const &creator); - /* find plugin - * - * @param plugin name - * @returns share pointer to plugin creator. - * If a plugin with that name is not found NULL is returned. - */ - MonitorPluginCreatorPtr findPlugin(std::string const &pluginName); - /* showNames - * - */ - void showNames(); -private: - MonitorPluginManager(){} - std::list monitorPluginList; - epics::pvData::Mutex mutex; -}; - -#undef USAGE_DEPRECATED - -}} -#endif /* MONITORPLUGIN_H */