Merge pull request #37 from mrkraimer/master

pvCopy.h now pvStructureCopy.h; copy name space now epics::pvCopy
This commit is contained in:
Marty Kraimer
2018-10-02 06:15:28 -04:00
committed by GitHub
23 changed files with 101 additions and 62 deletions

View File

@ -15,10 +15,10 @@ INC += pv/pvDatabase.h
INC += pv/traceRecord.h INC += pv/traceRecord.h
INC += pv/removeRecord.h INC += pv/removeRecord.h
include $(PVDATABASE_SRC)/copy/Makefile
include $(PVDATABASE_SRC)/database/Makefile include $(PVDATABASE_SRC)/database/Makefile
include $(PVDATABASE_SRC)/pvAccess/Makefile include $(PVDATABASE_SRC)/pvAccess/Makefile
include $(PVDATABASE_SRC)/special/Makefile include $(PVDATABASE_SRC)/special/Makefile
include $(PVDATABASE_SRC)/copy/Makefile
pvDatabase_LIBS += $(EPICS_BASE_PVA_CORE_LIBS) pvDatabase_LIBS += $(EPICS_BASE_PVA_CORE_LIBS)
pvDatabase_LIBS += $(EPICS_BASE_IOC_LIBS) pvDatabase_LIBS += $(EPICS_BASE_IOC_LIBS)

View File

@ -2,7 +2,7 @@
SRC_DIRS += $(PVDATABASE_SRC)/copy SRC_DIRS += $(PVDATABASE_SRC)/copy
INC += pv/pvCopy.h INC += pv/pvStructureCopy.h
INC += pv/pvPlugin.h INC += pv/pvPlugin.h
INC += pv/pvArrayPlugin.h INC += pv/pvArrayPlugin.h
INC += pv/pvDeadbandPlugin.h INC += pv/pvDeadbandPlugin.h

View File

@ -16,7 +16,9 @@
#include <pv/pvData.h> #include <pv/pvData.h>
#include <pv/pvPlugin.h> #include <pv/pvPlugin.h>
namespace epics { namespace pvDatabase{ #include <shareLib.h>
namespace epics { namespace pvCopy{
class PVArrayPlugin; class PVArrayPlugin;
class PVArrayFilter; class PVArrayFilter;
@ -31,7 +33,7 @@ typedef std::tr1::shared_ptr<PVArrayFilter> PVArrayFilterPtr;
* @author mrk * @author mrk
* @since date 2017.02.23 * @since date 2017.02.23
*/ */
class PVArrayPlugin : public PVPlugin class epicsShareClass PVArrayPlugin : public PVPlugin
{ {
private: private:
PVArrayPlugin(); PVArrayPlugin();
@ -59,7 +61,7 @@ public:
/** /**
* @brief A filter that gets a sub array from a PVScalarArray. * @brief A filter that gets a sub array from a PVScalarArray.
*/ */
class PVArrayFilter : public PVFilter class epicsShareClass PVArrayFilter : public PVFilter
{ {
private: private:
long start; long start;

View File

@ -16,7 +16,9 @@
#include <pv/pvData.h> #include <pv/pvData.h>
#include <pv/pvPlugin.h> #include <pv/pvPlugin.h>
namespace epics { namespace pvDatabase{ #include <shareLib.h>
namespace epics { namespace pvCopy{
class PVDeadbandPlugin; class PVDeadbandPlugin;
class PVDeadbandFilter; class PVDeadbandFilter;
@ -31,7 +33,7 @@ typedef std::tr1::shared_ptr<PVDeadbandFilter> PVDeadbandFilterPtr;
* @author mrk * @author mrk
* @since date 2017.02.23 * @since date 2017.02.23
*/ */
class PVDeadbandPlugin : public PVPlugin class epicsShareClass PVDeadbandPlugin : public PVPlugin
{ {
private: private:
PVDeadbandPlugin(); PVDeadbandPlugin();
@ -59,7 +61,7 @@ public:
/** /**
* @brief A Plugin for a filter that gets a sub array from a PVScalarDeadband. * @brief A Plugin for a filter that gets a sub array from a PVScalarDeadband.
*/ */
class PVDeadbandFilter : public PVFilter class epicsShareClass PVDeadbandFilter : public PVFilter
{ {
private: private:
bool absolute; bool absolute;

View File

@ -16,9 +16,11 @@
#include <string> #include <string>
#include <map> #include <map>
#include <pv/lock.h> #include <pv/lock.h>
#include <pv/pvCopy.h> #include <pv/pvStructureCopy.h>
namespace epics { namespace pvDatabase{ #include <shareLib.h>
namespace epics { namespace pvCopy{
class PVPlugin; class PVPlugin;
class PVFilter; class PVFilter;

View File

@ -1,4 +1,4 @@
/* pvCopy.h */ /* pvStructureCopy.h */
/* /*
* Copyright information and license terms for this software can be * Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution * found in the file LICENSE that is included with the distribution
@ -7,18 +7,22 @@
* @author Marty Kraimer * @author Marty Kraimer
* @date 2013.04 * @date 2013.04
*/ */
#ifndef PVCOPY_H #ifndef PVSTRUCTURECOPY_H
#define PVCOPY_H #define PVSTRUCTURECOPY_H
#if defined(_WIN32) && !defined(NOMINMAX)
#define NOMINMAX
#endif
#include <string> #include <string>
#include <stdexcept> #include <stdexcept>
#include <memory> #include <memory>
#include <shareLib.h>
#include <pv/pvData.h> #include <pv/pvData.h>
#include <pv/bitSet.h> #include <pv/bitSet.h>
namespace epics { namespace pvDatabase{ #include <shareLib.h>
namespace epics { namespace pvCopy{
class PVCopyTraverseMasterCallback; class PVCopyTraverseMasterCallback;
typedef std::tr1::shared_ptr<PVCopyTraverseMasterCallback> PVCopyTraverseMasterCallbackPtr; typedef std::tr1::shared_ptr<PVCopyTraverseMasterCallback> PVCopyTraverseMasterCallbackPtr;
@ -27,6 +31,11 @@ typedef std::tr1::shared_ptr<PVCopyTraverseMasterCallback> PVCopyTraverseMasterC
* @brief Callback for traversing master structure * @brief Callback for traversing master structure
* *
* Must be implemented by code that creates pvCopy. * Must be implemented by code that creates pvCopy.
*
* This was originally name pvCopy.h and implemented in pvDataCPP
* When it was moved to pvDatabaseCPP it was renamed to prevent conflicts with
* the version in pvDataCPP.
* Also the namespace was changed from epics::pvData to epics::pvCopy
*/ */
class epicsShareClass PVCopyTraverseMasterCallback class epicsShareClass PVCopyTraverseMasterCallback
{ {
@ -235,4 +244,4 @@ private:
}} }}
#endif /* PVCOPY_H */ #endif /* PVSTRUCTURECOPY_H */

View File

@ -17,7 +17,9 @@
#include <pv/pvPlugin.h> #include <pv/pvPlugin.h>
#include <pv/pvTimeStamp.h> #include <pv/pvTimeStamp.h>
namespace epics { namespace pvDatabase{ #include <shareLib.h>
namespace epics { namespace pvCopy{
class PVTimestampPlugin; class PVTimestampPlugin;
class PVTimestampFilter; class PVTimestampFilter;
@ -32,7 +34,7 @@ typedef std::tr1::shared_ptr<PVTimestampFilter> PVTimestampFilterPtr;
* @author mrk * @author mrk
* @since date 2017.03.24 * @since date 2017.03.24
*/ */
class PVTimestampPlugin : public PVPlugin class epicsShareClass PVTimestampPlugin : public PVPlugin
{ {
private: private:
PVTimestampPlugin(); PVTimestampPlugin();
@ -60,7 +62,7 @@ public:
/** /**
* @brief A filter that sets a timeStamp to the current time. * @brief A filter that sets a timeStamp to the current time.
*/ */
class PVTimestampFilter : public PVFilter class epicsShareClass PVTimestampFilter : public PVFilter
{ {
private: private:
epics::pvData::PVTimeStamp pvTimeStamp; epics::pvData::PVTimeStamp pvTimeStamp;

View File

@ -19,7 +19,7 @@ using std::tr1::static_pointer_cast;
using std::vector; using std::vector;
using namespace epics::pvData; using namespace epics::pvData;
namespace epics { namespace pvDatabase{ namespace epics { namespace pvCopy{
static ConvertPtr convert = getConvert(); static ConvertPtr convert = getConvert();
static std::string name("array"); static std::string name("array");
@ -34,8 +34,12 @@ PVArrayPlugin::~PVArrayPlugin()
void PVArrayPlugin::create() void PVArrayPlugin::create()
{ {
PVArrayPluginPtr pvPlugin = PVArrayPluginPtr(new PVArrayPlugin()); static bool firstTime = true;
PVPluginRegistry::registerPlugin(name,pvPlugin); if(firstTime) {
firstTime = false;
PVArrayPluginPtr pvPlugin = PVArrayPluginPtr(new PVArrayPlugin());
PVPluginRegistry::registerPlugin(name,pvPlugin);
}
} }
PVFilterPtr PVArrayPlugin::create( PVFilterPtr PVArrayPlugin::create(

View File

@ -17,10 +17,8 @@
#include <pv/thread.h> #include <pv/thread.h>
#define epicsExportSharedSymbols #define epicsExportSharedSymbols
#include <pv/pvCopy.h> #include <pv/pvPlugin.h>
#include <pv/pvArrayPlugin.h> #include <pv/pvStructureCopy.h>
#include <pv/pvTimestampPlugin.h>
#include <pv/pvDeadbandPlugin.h>
using std::tr1::static_pointer_cast; using std::tr1::static_pointer_cast;
using std::tr1::dynamic_pointer_cast; using std::tr1::dynamic_pointer_cast;
@ -31,7 +29,7 @@ using std::endl;
using std::vector; using std::vector;
using namespace epics::pvData; using namespace epics::pvData;
namespace epics { namespace pvDatabase { namespace epics { namespace pvCopy {
/** /**
* Convenience method for implementing dump. * Convenience method for implementing dump.
@ -77,13 +75,6 @@ PVCopyPtr PVCopy::create(
PVStructurePtr const &pvRequest, PVStructurePtr const &pvRequest,
string const & structureName) string const & structureName)
{ {
static bool firstTime = true;
if(firstTime) {
firstTime = false;
PVArrayPlugin::create();
PVTimestampPlugin::create();
PVDeadbandPlugin::create();
}
PVStructurePtr pvStructure(pvRequest); PVStructurePtr pvStructure(pvRequest);
if(structureName.size()>0) { if(structureName.size()>0) {
if(pvStructure->getStructure()->getNumberFields()>0) { if(pvStructure->getStructure()->getNumberFields()>0) {

View File

@ -19,7 +19,7 @@ using std::tr1::static_pointer_cast;
using std::vector; using std::vector;
using namespace epics::pvData; using namespace epics::pvData;
namespace epics { namespace pvDatabase{ namespace epics { namespace pvCopy{
static ConvertPtr convert = getConvert(); static ConvertPtr convert = getConvert();
static std::string name("deadband"); static std::string name("deadband");
@ -34,8 +34,12 @@ PVDeadbandPlugin::~PVDeadbandPlugin()
void PVDeadbandPlugin::create() void PVDeadbandPlugin::create()
{ {
PVDeadbandPluginPtr pvPlugin = PVDeadbandPluginPtr(new PVDeadbandPlugin()); static bool firstTime = true;
PVPluginRegistry::registerPlugin(name,pvPlugin); if(firstTime) {
firstTime = false;
PVDeadbandPluginPtr pvPlugin = PVDeadbandPluginPtr(new PVDeadbandPlugin());
PVPluginRegistry::registerPlugin(name,pvPlugin);
}
} }
PVFilterPtr PVDeadbandPlugin::create( PVFilterPtr PVDeadbandPlugin::create(

View File

@ -5,11 +5,12 @@
#include <pv/pvData.h> #include <pv/pvData.h>
#define epicsExportSharedSymbols #define epicsExportSharedSymbols
#include <pv/pvStructureCopy.h>
#include <pv/pvPlugin.h> #include <pv/pvPlugin.h>
using namespace epics::pvData; using namespace epics::pvData;
namespace epics { namespace pvDatabase{ namespace epics { namespace pvCopy{
typedef std::map<std::string,PVPluginPtr> PVPluginMap; typedef std::map<std::string,PVPluginPtr> PVPluginMap;

View File

@ -9,7 +9,7 @@
#define epicsExportSharedSymbols #define epicsExportSharedSymbols
#include <pv/pvTimestampPlugin.h> #include <pv/pvTimestampPlugin.h>
#include <pv/pvCopy.h> #include <pv/pvStructureCopy.h>
using std::string; using std::string;
using std::size_t; using std::size_t;
@ -19,7 +19,7 @@ using std::tr1::static_pointer_cast;
using std::vector; using std::vector;
using namespace epics::pvData; using namespace epics::pvData;
namespace epics { namespace pvDatabase{ namespace epics { namespace pvCopy{
static ConvertPtr convert = getConvert(); static ConvertPtr convert = getConvert();
static std::string name("timestamp"); static std::string name("timestamp");
@ -34,8 +34,12 @@ PVTimestampPlugin::~PVTimestampPlugin()
void PVTimestampPlugin::create() void PVTimestampPlugin::create()
{ {
PVTimestampPluginPtr pvPlugin = PVTimestampPluginPtr(new PVTimestampPlugin()); static bool firstTime = true;
PVPluginRegistry::registerPlugin(name,pvPlugin); if(firstTime) {
firstTime = false;
PVTimestampPluginPtr pvPlugin = PVTimestampPluginPtr(new PVTimestampPlugin());
PVPluginRegistry::registerPlugin(name,pvPlugin);
}
} }
PVFilterPtr PVTimestampPlugin::create( PVFilterPtr PVTimestampPlugin::create(

View File

@ -10,13 +10,17 @@
*/ */
#include <epicsGuard.h> #include <epicsGuard.h>
#define epicsExportSharedSymbols #define epicsExportSharedSymbols
#include <pv/pvDatabase.h> #include <pv/pvDatabase.h>
#include <pv/pvStructureCopy.h>
#include <pv/pvPlugin.h>
#include <pv/pvArrayPlugin.h>
#include <pv/pvTimestampPlugin.h>
#include <pv/pvDeadbandPlugin.h>
using std::tr1::static_pointer_cast; using std::tr1::static_pointer_cast;
using namespace epics::pvData; using namespace epics::pvData;
using namespace epics::pvCopy;
using namespace std; using namespace std;
namespace epics { namespace pvDatabase { namespace epics { namespace pvDatabase {
@ -25,13 +29,15 @@ namespace epics { namespace pvDatabase {
static PVDatabasePtr pvDatabaseMaster; static PVDatabasePtr pvDatabaseMaster;
bool PVDatabase::getMasterFirstCall = true;
PVDatabasePtr PVDatabase::getMaster() PVDatabasePtr PVDatabase::getMaster()
{ {
if(getMasterFirstCall) { static bool firstTime = true;
getMasterFirstCall = false; if(firstTime) {
firstTime = false;
pvDatabaseMaster = PVDatabasePtr(new PVDatabase()); pvDatabaseMaster = PVDatabasePtr(new PVDatabase());
PVArrayPlugin::create();
PVTimestampPlugin::create();
PVDeadbandPlugin::create();
} }
return pvDatabaseMaster; return pvDatabaseMaster;
} }

View File

@ -12,12 +12,13 @@
#include <epicsThread.h> #include <epicsThread.h>
#define epicsExportSharedSymbols #define epicsExportSharedSymbols
#include <pv/pvDatabase.h> #include <pv/pvDatabase.h>
#include <pv/pvStructureCopy.h>
using std::tr1::static_pointer_cast; using std::tr1::static_pointer_cast;
using namespace epics::pvData; using namespace epics::pvData;
using namespace epics::pvDatabase;
using namespace std; using namespace std;
namespace epics { namespace pvDatabase { namespace epics { namespace pvDatabase {
@ -236,7 +237,7 @@ bool PVRecord::addPVRecordClient(PVRecordClientPtr const & pvRecordClient)
bool PVRecord::addListener( bool PVRecord::addListener(
PVListenerPtr const & pvListener, PVListenerPtr const & pvListener,
PVCopyPtr const & pvCopy) epics::pvCopy::PVCopyPtr const & pvCopy)
{ {
if(traceLevel>1) { if(traceLevel>1) {
cout << "PVRecord::addListener() " << recordName << endl; cout << "PVRecord::addListener() " << recordName << endl;
@ -267,7 +268,7 @@ void PVRecord::nextMasterPVField(PVFieldPtr const & pvField)
bool PVRecord::removeListener( bool PVRecord::removeListener(
PVListenerPtr const & pvListener, PVListenerPtr const & pvListener,
PVCopyPtr const & pvCopy) epics::pvCopy::PVCopyPtr const & pvCopy)
{ {
if(traceLevel>1) { if(traceLevel>1) {
cout << "PVRecord::removeListener() " << recordName << endl; cout << "PVRecord::removeListener() " << recordName << endl;

View File

@ -29,14 +29,15 @@
#include <pv/status.h> #include <pv/status.h>
#include <pv/serverContext.h> #include <pv/serverContext.h>
#ifdef channelProviderLocalEpicsExportSharedSymbols #ifdef channelProviderLocalEpicsExportSharedSymbols
# define epicsExportSharedSymbols # define epicsExportSharedSymbols
# undef channelProviderLocalEpicsExportSharedSymbols # undef channelProviderLocalEpicsExportSharedSymbols
#endif #endif
#include <shareLib.h> #include <shareLib.h>
#include <pv/pvCopy.h>
#include <pv/pvDatabase.h> #include <pv/pvDatabase.h>
#include <pv/pvStructureCopy.h>
namespace epics { namespace pvDatabase { namespace epics { namespace pvDatabase {

View File

@ -18,14 +18,14 @@
#include <pv/pvTimeStamp.h> #include <pv/pvTimeStamp.h>
#include <pv/rpcService.h> #include <pv/rpcService.h>
#ifdef pvdatabaseEpicsExportSharedSymbols #ifdef pvdatabaseEpicsExportSharedSymbols
# define epicsExportSharedSymbols # define epicsExportSharedSymbols
# undef pvdatabaseEpicsExportSharedSymbols # undef pvdatabaseEpicsExportSharedSymbols
#endif #endif
#include <shareLib.h> #include <shareLib.h>
#include <pv/pvCopy.h> #include <pv/pvStructureCopy.h>
namespace epics { namespace pvDatabase { namespace epics { namespace pvDatabase {
@ -65,7 +65,7 @@ typedef std::tr1::weak_ptr<PVDatabase> PVDatabaseWPtr;
* @date 2012.11.20 * @date 2012.11.20
*/ */
class epicsShareClass PVRecord : class epicsShareClass PVRecord :
public PVCopyTraverseMasterCallback, public epics::pvCopy::PVCopyTraverseMasterCallback,
public std::tr1::enable_shared_from_this<PVRecord> public std::tr1::enable_shared_from_this<PVRecord>
{ {
public: public:
@ -210,7 +210,7 @@ public:
*/ */
bool addListener( bool addListener(
PVListenerPtr const & pvListener, PVListenerPtr const & pvListener,
PVCopyPtr const & pvCopy); epics::pvCopy::PVCopyPtr const & pvCopy);
/** /**
* @brief PVCopyTraverseMasterCallback method * @brief PVCopyTraverseMasterCallback method
* *
@ -226,7 +226,7 @@ public:
*/ */
bool removeListener( bool removeListener(
PVListenerPtr const & pvListener, PVListenerPtr const & pvListener,
PVCopyPtr const & pvCopy); epics::pvCopy::PVCopyPtr const & pvCopy);
/** /**

View File

@ -22,6 +22,7 @@
using namespace epics::pvData; using namespace epics::pvData;
using namespace epics::pvAccess; using namespace epics::pvAccess;
using namespace epics::pvCopy;
using std::tr1::static_pointer_cast; using std::tr1::static_pointer_cast;
using std::tr1::dynamic_pointer_cast; using std::tr1::dynamic_pointer_cast;
using std::cout; using std::cout;

View File

@ -20,6 +20,7 @@
using namespace epics::pvData; using namespace epics::pvData;
using namespace epics::pvAccess; using namespace epics::pvAccess;
using namespace epics::pvCopy;
using std::tr1::static_pointer_cast; using std::tr1::static_pointer_cast;
using std::tr1::dynamic_pointer_cast; using std::tr1::dynamic_pointer_cast;
using std::cout; using std::cout;

View File

@ -22,6 +22,7 @@
using namespace epics::pvData; using namespace epics::pvData;
using namespace epics::pvAccess; using namespace epics::pvAccess;
using namespace epics::pvCopy;
using std::tr1::static_pointer_cast; using std::tr1::static_pointer_cast;
using std::cout; using std::cout;
using std::endl; using std::endl;

View File

@ -22,6 +22,7 @@
#include <pv/pvTimeStamp.h> #include <pv/pvTimeStamp.h>
#include <pv/pvAlarm.h> #include <pv/pvAlarm.h>
#include <pv/pvDatabase.h> #include <pv/pvDatabase.h>
#include <pv/pvStructureCopy.h>
#ifdef listenerEpicsExportSharedSymbols #ifdef listenerEpicsExportSharedSymbols
# define epicsExportSharedSymbols # define epicsExportSharedSymbols
@ -87,7 +88,7 @@ public:
private: private:
Listener(PVRecordPtr const & pvRecord) Listener(PVRecordPtr const & pvRecord)
: pvCopy( : pvCopy(
PVCopy::create( epics::pvCopy::PVCopy::create(
getPVDataCreate()->createPVStructure( getPVDataCreate()->createPVStructure(
pvRecord->getPVRecordStructure()->getPVStructure()), pvRecord->getPVRecordStructure()->getPVStructure()),
CreateRequest::create()->createRequest(""), CreateRequest::create()->createRequest(""),
@ -96,7 +97,7 @@ private:
recordName(pvRecord->getRecordName()) recordName(pvRecord->getRecordName())
{ {
} }
PVCopyPtr pvCopy; epics::pvCopy::PVCopyPtr pvCopy;
PVStructurePtr pvStructure; PVStructurePtr pvStructure;
string recordName; string recordName;
}; };

View File

@ -37,6 +37,7 @@ using namespace std;
using std::tr1::static_pointer_cast; using std::tr1::static_pointer_cast;
using namespace epics::pvData; using namespace epics::pvData;
using namespace epics::pvAccess; using namespace epics::pvAccess;
using namespace epics::pvCopy;
using namespace epics::pvDatabase; using namespace epics::pvDatabase;
static bool debug = false; static bool debug = false;

View File

@ -28,7 +28,7 @@
#include <pv/standardField.h> #include <pv/standardField.h>
#include <pv/standardPVField.h> #include <pv/standardPVField.h>
#include <pv/pvData.h> #include <pv/pvData.h>
#include <pv/pvCopy.h> #include <pv/pvStructureCopy.h>
#define epicsExportSharedSymbols #define epicsExportSharedSymbols
#include "powerSupply.h" #include "powerSupply.h"
@ -37,6 +37,7 @@ using namespace std;
using std::tr1::static_pointer_cast; using std::tr1::static_pointer_cast;
using namespace epics::pvData; using namespace epics::pvData;
using namespace epics::pvDatabase; using namespace epics::pvDatabase;
using namespace epics::pvCopy;
using std::string; using std::string;
static bool debug = false; static bool debug = false;

View File

@ -29,6 +29,8 @@
#include <pv/standardPVField.h> #include <pv/standardPVField.h>
#include <pv/channelProviderLocal.h> #include <pv/channelProviderLocal.h>
#include <pv/convert.h> #include <pv/convert.h>
#include <pv/pvStructureCopy.h>
#include <pv/pvDatabase.h>
#define epicsExportSharedSymbols #define epicsExportSharedSymbols
#include "powerSupply.h" #include "powerSupply.h"
@ -37,6 +39,7 @@ using namespace std;
using std::tr1::static_pointer_cast; using std::tr1::static_pointer_cast;
using namespace epics::pvData; using namespace epics::pvData;
using namespace epics::pvAccess; using namespace epics::pvAccess;
using namespace epics::pvCopy;
using namespace epics::pvDatabase; using namespace epics::pvDatabase;
static bool debug = true; static bool debug = true;
@ -265,6 +268,7 @@ static void ignoreTest()
MAIN(testPlugin) MAIN(testPlugin)
{ {
testPlan(22); testPlan(22);
PVDatabasePtr pvDatabase(PVDatabase::getMaster());
deadbandTest(); deadbandTest();
arrayTest(); arrayTest();
timeStampTest(); timeStampTest();