prepare for moving everything in src/V3IOC to pvAccessCPP
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
include "base.dbd"
|
||||
include "PVAServerRegister.dbd"
|
||||
include "registerChannelProviderLocal.dbd"
|
||||
registrar("exampleCounterRegister")
|
||||
|
@ -1,4 +1,5 @@
|
||||
include "base.dbd"
|
||||
include "PVAServerRegister.dbd"
|
||||
include "PVAClientRegister.dbd"
|
||||
include "registerChannelProviderLocal.dbd"
|
||||
registrar("examplePVADoubleArrayGetRegister")
|
||||
|
@ -46,7 +46,6 @@ static const iocshFuncDef exampleServerFuncDef = {
|
||||
"exampleServerCreateRecords", 1, testArgs};
|
||||
static void exampleServerCallFunc(const iocshArgBuf *args)
|
||||
{
|
||||
char *prefix = args[0].sval;
|
||||
ExampleServerCreateRecords::create();
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
include "base.dbd"
|
||||
include "PVAServerRegister.dbd"
|
||||
include "registerChannelProviderLocal.dbd"
|
||||
registrar("exampleServerRegister")
|
||||
|
@ -16,12 +16,15 @@ SRC_DIRS += $(DATABASE)/pvAccess
|
||||
INC += channelProviderLocal.h
|
||||
INC += pvCopy.h
|
||||
INC += monitorAlgorithm.h
|
||||
DBD += registerChannelProviderLocal.dbd
|
||||
LIBSRCS += channelProviderLocal.cpp
|
||||
LIBSRCS += pvCopy.cpp
|
||||
LIBSRCS += monitorFactory.cpp
|
||||
LIBSRCS += channelLocal.cpp
|
||||
LIBSRCS += registerChannelProviderLocal.cpp
|
||||
|
||||
SRC_DIRS += $(DATABASE)/V3IOC
|
||||
INC += syncChannelFind.h
|
||||
DBD += PVAServerRegister.dbd
|
||||
DBD += PVAClientRegister.dbd
|
||||
LIBSRCS += PVAServerRegister.cpp
|
||||
|
@ -30,13 +30,11 @@
|
||||
|
||||
#include <pv/pvAccess.h>
|
||||
#include <pv/serverContext.h>
|
||||
#include <pv/channelProviderLocal.h>
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::pvDatabase;
|
||||
|
||||
class PVAServerCTX;
|
||||
typedef std::tr1::shared_ptr<PVAServerCTX> PVAServerCTXPtr;
|
||||
@ -74,11 +72,9 @@ void PVAServerCTX::stop()
|
||||
cout<< "PVAServer already stopped" << endl;
|
||||
return;
|
||||
}
|
||||
ChannelProviderLocalPtr channelProvider = getChannelProviderLocal();
|
||||
ctx->destroy();
|
||||
ctx.reset();
|
||||
epicsThreadSleep(1.0);
|
||||
channelProvider->destroy();
|
||||
}
|
||||
|
||||
PVAServerCTXPtr PVAServerCTX::getPVAServerCTX()
|
||||
@ -111,17 +107,6 @@ extern "C" void stopPVAServer(const iocshArgBuf *args)
|
||||
}
|
||||
|
||||
|
||||
static const iocshFuncDef pvdblFuncDef = {
|
||||
"pvdbl", 0, 0
|
||||
};
|
||||
extern "C" void pvdbl(const iocshArgBuf *args)
|
||||
{
|
||||
PVDatabasePtr master = PVDatabase::getMaster();
|
||||
PVStringArrayPtr pvNames = master->getRecordNames();
|
||||
PVStringArray::const_svector xxx = pvNames->view();
|
||||
for(size_t i=0; i<xxx.size(); ++i) cout<< xxx[i] << endl;
|
||||
}
|
||||
|
||||
static void startPVAServerRegister(void)
|
||||
{
|
||||
static int firstTime = 1;
|
||||
@ -140,16 +125,5 @@ static void stopPVAServerRegister(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void pvdblRegister(void)
|
||||
{
|
||||
static int firstTime = 1;
|
||||
if (firstTime) {
|
||||
firstTime = 0;
|
||||
iocshRegister(&pvdblFuncDef, pvdbl);
|
||||
getChannelProviderLocal();
|
||||
}
|
||||
}
|
||||
|
||||
epicsExportRegistrar(startPVAServerRegister);
|
||||
epicsExportRegistrar(stopPVAServerRegister);
|
||||
epicsExportRegistrar(pvdblRegister);
|
||||
|
@ -1,3 +1,2 @@
|
||||
registrar("startPVAServerRegister")
|
||||
registrar("stopPVAServerRegister")
|
||||
registrar("pvdblRegister")
|
||||
|
56
src/V3IOC/syncChannelFind.h
Normal file
56
src/V3IOC/syncChannelFind.h
Normal file
@ -0,0 +1,56 @@
|
||||
/* syncChannelFind.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 Marty Kraimer
|
||||
* @date 2014.02
|
||||
*/
|
||||
/**
|
||||
* This is an implementation of ChannelFind that is appropriate for all channel
|
||||
* providers that can synchronously determine if the provider has the channel.
|
||||
*/
|
||||
#ifndef SYNCCHANNElFIND_H
|
||||
#define SYNCCHANNElFIND_H
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
#include <memory>
|
||||
|
||||
#include <pv/pvData.h>
|
||||
#include <pv/pvAccess.h>
|
||||
|
||||
|
||||
namespace epics { namespace pvAccess {
|
||||
|
||||
class SyncChannelFind : public ChannelFind
|
||||
{
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<SyncChannelFind> shared_pointer;
|
||||
|
||||
SyncChannelFind(ChannelProvider::shared_pointer &provider) : m_provider(provider)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~SyncChannelFind() {}
|
||||
|
||||
virtual void destroy(){}
|
||||
|
||||
virtual ChannelProvider::shared_pointer getChannelProvider()
|
||||
{
|
||||
return m_provider.lock();
|
||||
};
|
||||
|
||||
virtual void cancelChannelFind() {}
|
||||
|
||||
private:
|
||||
ChannelProvider::weak_pointer m_provider;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}}
|
||||
#endif /* SYNCCHANNElFIND_H */
|
@ -104,7 +104,7 @@ private:
|
||||
bool isDestroyed;
|
||||
bool callProcess;
|
||||
ChannelLocalPtr channelLocal;
|
||||
ChannelProcessRequester::shared_pointer channelProcessRequester,;
|
||||
ChannelProcessRequester::shared_pointer channelProcessRequester;
|
||||
PVRecordPtr pvRecord;
|
||||
Mutex mutex;
|
||||
int nProcess;
|
||||
@ -245,7 +245,7 @@ private:
|
||||
bool isDestroyed;
|
||||
bool callProcess;
|
||||
ChannelLocalPtr channelLocal;
|
||||
ChannelGetRequester::shared_pointer channelGetRequester,;
|
||||
ChannelGetRequester::shared_pointer channelGetRequester;
|
||||
PVCopyPtr pvCopy;
|
||||
PVStructurePtr pvStructure;
|
||||
BitSetPtr bitSet;
|
||||
@ -399,7 +399,7 @@ private:
|
||||
bool isDestroyed;
|
||||
bool callProcess;
|
||||
ChannelLocalPtr channelLocal;
|
||||
ChannelPutRequester::shared_pointer channelPutRequester,;
|
||||
ChannelPutRequester::shared_pointer channelPutRequester;
|
||||
PVCopyPtr pvCopy;
|
||||
PVStructurePtr pvStructure;
|
||||
BitSetPtr bitSet;
|
||||
@ -580,7 +580,7 @@ private:
|
||||
bool isDestroyed;
|
||||
bool callProcess;
|
||||
ChannelLocalPtr channelLocal;
|
||||
ChannelPutGetRequester::shared_pointer channelPutGetRequester,;
|
||||
ChannelPutGetRequester::shared_pointer channelPutGetRequester;
|
||||
PVCopyPtr pvPutCopy;
|
||||
PVCopyPtr pvGetCopy;
|
||||
PVStructurePtr pvPutStructure;
|
||||
@ -805,7 +805,7 @@ private:
|
||||
bool isDestroyed;
|
||||
bool callProcess;
|
||||
ChannelLocalPtr channelLocal;
|
||||
ChannelArrayRequester::shared_pointer channelArrayRequester,;
|
||||
ChannelArrayRequester::shared_pointer channelArrayRequester;
|
||||
PVArrayPtr pvArray;
|
||||
PVArrayPtr pvCopy;
|
||||
PVRecordPtr pvRecord;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <pv/serverContext.h>
|
||||
#include <pv/channelProviderLocal.h>
|
||||
#include <pv/traceRecord.h>
|
||||
#include <pv/syncChannelFind.h>
|
||||
|
||||
namespace epics { namespace pvDatabase {
|
||||
|
||||
@ -24,35 +25,6 @@ using std::endl;
|
||||
|
||||
static String providerName("local");
|
||||
|
||||
class MockChannelFind : public ChannelFind
|
||||
{
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<MockChannelFind> shared_pointer;
|
||||
|
||||
MockChannelFind(ChannelProvider::shared_pointer &provider) : m_provider(provider)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~MockChannelFind() {}
|
||||
|
||||
virtual void destroy()
|
||||
{
|
||||
// one instance for all, do not delete at all
|
||||
}
|
||||
virtual ChannelProvider::shared_pointer getChannelProvider()
|
||||
{
|
||||
return m_provider.lock();
|
||||
};
|
||||
|
||||
virtual void cancelChannelFind()
|
||||
{
|
||||
throw std::runtime_error("not supported");
|
||||
}
|
||||
|
||||
private:
|
||||
ChannelProvider::weak_pointer m_provider;
|
||||
};
|
||||
|
||||
|
||||
class LocalChannelProviderFactory;
|
||||
typedef std::tr1::shared_ptr<LocalChannelProviderFactory> LocalChannelProviderFactoryPtr;
|
||||
@ -96,7 +68,7 @@ ChannelProviderLocalPtr getChannelProviderLocal()
|
||||
channelProviderLocal = ChannelProviderLocalPtr(
|
||||
new ChannelProviderLocal());
|
||||
ChannelProvider::shared_pointer xxx = dynamic_pointer_cast<ChannelProvider>(channelProviderLocal);
|
||||
channelProviderLocal->channelFinder = MockChannelFind::shared_pointer(new MockChannelFind(xxx));
|
||||
channelProviderLocal->channelFinder = SyncChannelFind::shared_pointer(new SyncChannelFind(xxx));
|
||||
LocalChannelProviderFactory::create(channelProviderLocal);
|
||||
}
|
||||
return channelProviderLocal;
|
||||
@ -146,7 +118,7 @@ ChannelFind::shared_pointer ChannelProviderLocal::channelFind(
|
||||
channelFinder,
|
||||
false);
|
||||
}
|
||||
return ChannelFind::shared_pointer();
|
||||
return channelFinder;
|
||||
}
|
||||
|
||||
Channel::shared_pointer ChannelProviderLocal::createChannel(
|
||||
|
63
src/pvAccess/registerChannelProviderLocal.cpp
Normal file
63
src/pvAccess/registerChannelProviderLocal.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/*registerChannelProviderLocal.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 2014.07.03
|
||||
*/
|
||||
|
||||
/* Author: Marty Kraimer */
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
|
||||
#include <cantProceed.h>
|
||||
#include <epicsStdio.h>
|
||||
#include <epicsMutex.h>
|
||||
#include <epicsEvent.h>
|
||||
#include <epicsThread.h>
|
||||
#include <iocsh.h>
|
||||
|
||||
#include <epicsExport.h>
|
||||
|
||||
#include <pv/pvAccess.h>
|
||||
#include <pv/serverContext.h>
|
||||
#include <pv/channelProviderLocal.h>
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::pvDatabase;
|
||||
|
||||
static const iocshFuncDef pvdblFuncDef = {
|
||||
"pvdbl", 0, 0
|
||||
};
|
||||
extern "C" void pvdbl(const iocshArgBuf *args)
|
||||
{
|
||||
PVDatabasePtr master = PVDatabase::getMaster();
|
||||
PVStringArrayPtr pvNames = master->getRecordNames();
|
||||
PVStringArray::const_svector xxx = pvNames->view();
|
||||
for(size_t i=0; i<xxx.size(); ++i) cout<< xxx[i] << endl;
|
||||
}
|
||||
|
||||
|
||||
static void registerChannelProviderLocal(void)
|
||||
{
|
||||
static int firstTime = 1;
|
||||
if (firstTime) {
|
||||
firstTime = 0;
|
||||
iocshRegister(&pvdblFuncDef, pvdbl);
|
||||
getChannelProviderLocal();
|
||||
}
|
||||
}
|
||||
|
||||
epicsExportRegistrar(registerChannelProviderLocal);
|
1
src/pvAccess/registerChannelProviderLocal.dbd
Normal file
1
src/pvAccess/registerChannelProviderLocal.dbd
Normal file
@ -0,0 +1 @@
|
||||
registrar("registerChannelProviderLocal")
|
Reference in New Issue
Block a user