Compare commits
91 Commits
before_mer
...
4.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b20fd4c5c5 | ||
|
|
409b045779 | ||
|
|
fda81767a5 | ||
|
|
fe1b167e23 | ||
|
|
dc0f20cc5f | ||
|
|
6e7d887e6e | ||
|
|
699a6cd8b4 | ||
|
|
70454a6006 | ||
|
|
deebe46378 | ||
|
|
18dc4279ad | ||
|
|
61e9dc0368 | ||
|
|
6b0d1ce49b | ||
|
|
81b160d7b6 | ||
|
|
4e22a056d2 | ||
|
|
4af5ba92d9 | ||
|
|
e79c70c74c | ||
|
|
c0694e2d69 | ||
|
|
36dac883f4 | ||
|
|
35dcbf35b3 | ||
|
|
30dd2ed046 | ||
|
|
e30e4f3638 | ||
|
|
15578d1647 | ||
|
|
e3e270e242 | ||
|
|
ec44251df0 | ||
|
|
3344165f19 | ||
|
|
c2ea402be0 | ||
|
|
0535ff990d | ||
|
|
18ff90e641 | ||
|
|
a781195458 | ||
|
|
1a641f0d1b | ||
|
|
0e6639c149 | ||
|
|
93ba23aeb8 | ||
|
|
7743f3e3fd | ||
|
|
e9ce6a2f0b | ||
|
|
1ed48c15f1 | ||
|
|
d27f929595 | ||
|
|
b4e17f271b | ||
|
|
79f407486a | ||
|
|
3c359728f7 | ||
|
|
7b9693562a | ||
|
|
f1c39ca5d2 | ||
|
|
16b1775b98 | ||
|
|
f6ee7333bb | ||
|
|
9f45bdfa75 | ||
|
|
03aa15b5f7 | ||
|
|
8093952ca2 | ||
|
|
2bea54e218 | ||
|
|
e81230dba5 | ||
|
|
50b8f306c3 | ||
|
|
65be8e5678 | ||
|
|
dbb9310adc | ||
|
|
50fbb396e8 | ||
|
|
ff19fe1cd8 | ||
|
|
230938220e | ||
|
|
334ed3b70a | ||
|
|
4c7e51d8ad | ||
|
|
4973a6297e | ||
|
|
f0d1481a28 | ||
|
|
d5235db54c | ||
|
|
b125035a11 | ||
|
|
9551b0e4c6 | ||
|
|
d6aa03815e | ||
|
|
ce0d62fbbc | ||
|
|
2fe3e66047 | ||
|
|
fa53d72258 | ||
|
|
b010cf0849 | ||
|
|
7fd707cb4b | ||
|
|
5d823307f0 | ||
|
|
d41d5726d2 | ||
|
|
723f98bc44 | ||
|
|
1544147bdd | ||
|
|
0447441cfa | ||
|
|
8ce42ebb9a | ||
|
|
c39b966121 | ||
|
|
61edf17cdf | ||
|
|
39f537d7da | ||
|
|
ba496de2d3 | ||
|
|
38574ed76f | ||
|
|
92be294bbf | ||
|
|
35429bf4df | ||
|
|
552925dfe6 | ||
|
|
d1791393ad | ||
|
|
3dbad700f7 | ||
|
|
c06e33e197 | ||
|
|
1d8f01517a | ||
|
|
8c1b142e48 | ||
|
|
ca27cb5e3c | ||
|
|
a5fa17aca7 | ||
|
|
fe62a7181f | ||
|
|
342ab45dc8 | ||
|
|
127830e3c7 |
13
.gitignore
vendored
Normal file
13
.gitignore
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
bin/
|
||||
lib/
|
||||
doc/
|
||||
include/
|
||||
db/
|
||||
dbd/
|
||||
documentation/html
|
||||
documentation/*.tag
|
||||
envPaths
|
||||
configure/*.local
|
||||
!configure/ExampleRELEASE.local
|
||||
**/O.*
|
||||
QtC-*
|
||||
8
.hgflow
8
.hgflow
@@ -1,8 +0,0 @@
|
||||
[branchname]
|
||||
master = master
|
||||
develop = default
|
||||
feature = feature/
|
||||
release = release/
|
||||
hotfix = hotfix/
|
||||
support = support/
|
||||
|
||||
11
.hgignore
11
.hgignore
@@ -1,11 +0,0 @@
|
||||
^QtC-
|
||||
bin/
|
||||
lib/
|
||||
doc/
|
||||
include/
|
||||
db/
|
||||
dbd/
|
||||
documentation/html
|
||||
envPaths
|
||||
RELEASE.local
|
||||
/O\..*
|
||||
2
LICENSE
2
LICENSE
@@ -2,7 +2,7 @@
|
||||
Copyright (c) 2008 Martin R. Kraimer
|
||||
Copyright (c) 2006 The University of Chicago, as Operator of Argonne
|
||||
National Laboratory.
|
||||
Copyright (c) 2006 Deutsches Elektronen-Synchroton,
|
||||
Copyright (c) 2006 Deutsches Elektronen-Synchrotron,
|
||||
Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY.
|
||||
Copyright (c) 2007 Control System Laboratory,
|
||||
(COSYLAB) Ljubljana Slovenia
|
||||
|
||||
32
Makefile
32
Makefile
@@ -1,25 +1,27 @@
|
||||
# Makefile for the EPICS V4 pvDatabase module
|
||||
|
||||
#Makefile at top of application tree
|
||||
TOP = .
|
||||
include $(TOP)/configure/CONFIG
|
||||
DIRS := $(DIRS) $(filter-out $(DIRS), configure)
|
||||
DIRS := $(DIRS) $(filter-out $(DIRS), src)
|
||||
DIRS := $(DIRS) $(filter-out $(DIRS), test)
|
||||
DIRS := $(DIRS) $(filter-out $(DIRS), arrayPerformance)
|
||||
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard example*))
|
||||
|
||||
DIRS := configure
|
||||
EMBEDDED_TOPS := $(EMBEDDED_TOPS) $(filter-out $(EMBEDDED_TOPS), test)
|
||||
EMBEDDED_TOPS := $(EMBEDDED_TOPS) $(filter-out $(EMBEDDED_TOPS), arrayPerformance)
|
||||
EMBEDDED_TOPS := $(EMBEDDED_TOPS) $(filter-out $(EMBEDDED_TOPS), $(wildcard example*))
|
||||
|
||||
DIRS += src
|
||||
src_DEPEND_DIRS = configure
|
||||
define DIR_template
|
||||
$(1)_DEPEND_DIRS = configure
|
||||
endef
|
||||
$(foreach dir, $(filter-out configure,$(DIRS)),$(eval $(call DIR_template,$(dir))))
|
||||
|
||||
EMBEDDED_TOPS := $(wildcard *Top)
|
||||
EMBEDDED_TOPS += $(wildcard example*)
|
||||
|
||||
DIRS += $(EMBEDDED_TOPS)
|
||||
|
||||
define dir_DEP
|
||||
define EMB_template
|
||||
$(1)_DEPEND_DIRS = src
|
||||
endef
|
||||
$(foreach dir, $(EMBEDDED_TOPS),$(eval $(call EMB_template,$(dir))))
|
||||
|
||||
$(foreach dir, $(EMBEDDED_TOPS), $(eval $(call dir_DEP,$(dir))))
|
||||
|
||||
exampleDatabase_DEPEND_DIRS += testTop
|
||||
examplePowerSupply_DEPEND_DIRS += testTop
|
||||
#exampleDatabase_DEPEND_DIRS += test
|
||||
#examplePowerSupply_DEPEND_DIRS += test
|
||||
|
||||
include $(TOP)/configure/RULES_TOP
|
||||
|
||||
38
README.md
Normal file
38
README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
pvaDatabaseCPP
|
||||
============
|
||||
|
||||
|
||||
A brief description of a pvDatabase is that it is a set of network accessible, smart, memory resident records. Each record has data composed of a top level PVStructure. Each record has a name which is the channelName for pvAccess. A local Channel Provider implements the complete ChannelProvider and Channel interfaces as defined by pvAccess. The local provider provides access to the records in the pvDatabase. This local provider is accessed by the remote pvAccess server. A record is smart because code can be attached to a record, which is accessed via a method named process.
|
||||
pvaDatabase is a synchronous Database interface to pvAccess,
|
||||
which is callback based.
|
||||
pvaDatabase is thus easier to use than pvAccess itself.
|
||||
|
||||
See documentation/pvaDatabaseCPP.html for details.
|
||||
|
||||
Building
|
||||
--------
|
||||
|
||||
If a proper RELEASE.local file exists one directory level above pvaDatabaseCPP
|
||||
then just type:
|
||||
|
||||
make
|
||||
|
||||
If RELEASE.local does not exist then look at <b>configure/RELEASE</b>
|
||||
for directions for how to build.
|
||||
|
||||
Examples
|
||||
------------
|
||||
|
||||
The examples require the database in pvaDatabaseTestCPP.
|
||||
For example:
|
||||
|
||||
mrk> pwd
|
||||
/home/epicsv4/pvaDatabaseTestCPP/database/iocBoot/exampleDatabase
|
||||
mrk> ../../bin/linux-x86_64/exampleDatabase st.cmd
|
||||
|
||||
Status
|
||||
------
|
||||
|
||||
* The API is for release 4.5.0-pre1
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# Makefile at top of application tree
|
||||
|
||||
#Makefile at top of application tree
|
||||
TOP = .
|
||||
include $(TOP)/configure/CONFIG
|
||||
|
||||
DIRS += configure
|
||||
|
||||
DIRS += src
|
||||
@@ -14,11 +14,26 @@
|
||||
# Set CHECK_RELEASE to NO to disable checking completely.
|
||||
# Set CHECK_RELEASE to WARN to perform consistency checking but
|
||||
# continue building anyway if conflicts are found.
|
||||
CHECK_RELEASE = WARN
|
||||
#CHECK_RELEASE = YES
|
||||
|
||||
# Set this when you only want to compile this application
|
||||
# for a subset of the cross-compiled target architectures
|
||||
# that Base is built for.
|
||||
#CROSS_COMPILER_TARGET_ARCHS = vxWorks-68040
|
||||
|
||||
# To install files into a location other than $(TOP) define
|
||||
# INSTALL_LOCATION here.
|
||||
#INSTALL_LOCATION=</path/name/to/install/top>
|
||||
|
||||
-include $(TOP)/../configure/CONFIG_SITE.local
|
||||
# Set this when your IOC and the host use different paths
|
||||
# to access the application. This will be needed to boot
|
||||
# from a Microsoft FTP server or with some NFS mounts.
|
||||
# You must rebuild in the iocBoot directory for this to
|
||||
# take effect.
|
||||
#IOCS_APPL_TOP = </IOC/path/to/application/top>
|
||||
|
||||
INSTALL_INCLUDE = $(INSTALL_LOCATION)/include/pv
|
||||
USR_INCLUDES += -I $(INSTALL_LOCATION)/include
|
||||
|
||||
-include $(TOP)/../../CONFIG_SITE.local
|
||||
-include $(TOP)/../configure/CONFIG_SITE.local
|
||||
@@ -1,4 +1,4 @@
|
||||
# pvDatabaseCPP/arrayPerfTop RELEASE - Location of external support modules
|
||||
# pvDatabaseCPP/arrayPerformance RELEASE - Location of external support modules
|
||||
#
|
||||
# IF YOU CHANGE this file or any file it includes you must
|
||||
# subsequently do a "gnumake rebuild" in the application's
|
||||
@@ -16,9 +16,8 @@
|
||||
|
||||
# EPICS V4 Developers: Do not edit the locations in this file!
|
||||
#
|
||||
# Create a file RELEASE.local pointing to your PVASRV, PVACCESS,
|
||||
# PVDATA, PVCOMMON and EPICS_BASE build directories, e.g.
|
||||
# PVASRV = /path/to/epics/pvaSrvCPP
|
||||
# Create a file RELEASE.local pointing to your places
|
||||
# for the dependencies, e.g.
|
||||
# PVACCESS = /path/to/epics/pvAccessCPP
|
||||
# PVDATA = /path/to/epics/pvDataCPP
|
||||
# PVCOMMON = /path/to/epics/pvCommonCPP
|
||||
@@ -28,14 +27,14 @@
|
||||
# use the following definitions:
|
||||
|
||||
PVDATABASE = $(TOP)/..
|
||||
|
||||
-include $(TOP)/../configure/RELEASE.local
|
||||
-include $(TOP)/../../RELEASE.local
|
||||
-include $(TOP)/../configure/RELEASE.local
|
||||
|
||||
# If you copied this example from pvDatabaseCPP to be built as a
|
||||
# standalone TOP, adjust and use the following definitions:
|
||||
# standalone TOP, define
|
||||
# PVDATABASE = /path/to/epics/pvDatabaseCPP
|
||||
# in the appropriate RELEASE[.local],
|
||||
# and use the following definitions instead:
|
||||
|
||||
#PVDATABASE = /path/to/epics/pvDatabaseCPP
|
||||
|
||||
#-include $(TOP)/configure/RELEASE.local
|
||||
#-include $(TOP)/../RELEASE.local
|
||||
#-include $(TOP)/configure/RELEASE.local
|
||||
@@ -26,7 +26,7 @@ using std::endl;
|
||||
using std::ostringstream;
|
||||
|
||||
ArrayPerformancePtr ArrayPerformance::create(
|
||||
epics::pvData::String const & recordName,
|
||||
std::string const & recordName,
|
||||
size_t size,
|
||||
double delay)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ ArrayPerformancePtr ArrayPerformance::create(
|
||||
}
|
||||
|
||||
ArrayPerformance::ArrayPerformance(
|
||||
epics::pvData::String const & recordName,
|
||||
std::string const & recordName,
|
||||
epics::pvData::PVStructurePtr const & pvStructure,
|
||||
size_t size,
|
||||
double delay)
|
||||
@@ -59,9 +59,9 @@ bool ArrayPerformance::init()
|
||||
{
|
||||
|
||||
initPVRecord();
|
||||
PVScalarArrayPtr pvScalarArray = getPVStructure()->getScalarArrayField("value",pvLong);
|
||||
if(pvScalarArray==NULL) return false;
|
||||
pvValue = static_pointer_cast<PVLongArray>(pvScalarArray);
|
||||
PVLongArrayPtr pvLongArray = getPVStructure()->getSubField<PVLongArray>("value");
|
||||
if(!pvLongArray) return false;
|
||||
pvValue = pvLongArray;
|
||||
ArrayPerformancePtr xxx = dynamic_pointer_cast<ArrayPerformance>(getPtrSelf());
|
||||
arrayPerformanceThread = ArrayPerformanceThreadPtr(new ArrayPerformanceThread(xxx));
|
||||
arrayPerformanceThread->init();
|
||||
@@ -182,14 +182,18 @@ void ArrayPerformanceThread::run()
|
||||
nSinceLastReport = 0;
|
||||
}
|
||||
++nSinceLastReport;
|
||||
shared_vector<int64> xxx(arrayPerformance->size,value++);
|
||||
shared_vector<const int64> data(freeze(xxx));
|
||||
arrayPerformance->lock();
|
||||
try {
|
||||
arrayPerformance->beginGroupPut();
|
||||
arrayPerformance->pvValue->replace(data);
|
||||
arrayPerformance->process();
|
||||
arrayPerformance->endGroupPut();
|
||||
if(arrayPerformance->getTraceLevel()>1) {
|
||||
cout << "arrayPerformance size " << arrayPerformance->size;
|
||||
cout << " value " << value +1 << endl;
|
||||
}
|
||||
shared_vector<int64> xxx(arrayPerformance->size,value++);
|
||||
shared_vector<const int64> data(freeze(xxx));
|
||||
arrayPerformance->beginGroupPut();
|
||||
arrayPerformance->pvValue->replace(data);
|
||||
arrayPerformance->process();
|
||||
arrayPerformance->endGroupPut();
|
||||
} catch(...) {
|
||||
arrayPerformance->unlock();
|
||||
throw;
|
||||
@@ -17,7 +17,6 @@
|
||||
# undef epicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <shareLib.h>
|
||||
#include <epicsThread.h>
|
||||
#include <pv/standardPVField.h>
|
||||
#include <pv/timeStamp.h>
|
||||
@@ -44,7 +43,7 @@ class epicsShareClass ArrayPerformance :
|
||||
public:
|
||||
POINTER_DEFINITIONS(ArrayPerformance);
|
||||
static ArrayPerformancePtr create(
|
||||
epics::pvData::String const & recordName,
|
||||
std::string const & recordName,
|
||||
size_t size,
|
||||
double delay);
|
||||
virtual ~ArrayPerformance();
|
||||
@@ -53,7 +52,7 @@ public:
|
||||
virtual void process();
|
||||
virtual void destroy();
|
||||
private:
|
||||
ArrayPerformance(epics::pvData::String const & recordName,
|
||||
ArrayPerformance(std::string const & recordName,
|
||||
epics::pvData::PVStructurePtr const & pvStructure,
|
||||
size_t size,
|
||||
double delay);
|
||||
@@ -81,7 +80,7 @@ private:
|
||||
ArrayPerformancePtr arrayPerformance;
|
||||
bool isDestroyed;
|
||||
bool runReturned;
|
||||
epics::pvData::String threadName;
|
||||
std::string threadName;
|
||||
epics::pvData::Mutex mutex;
|
||||
epics::pvData::int64 value;
|
||||
std::auto_ptr<epicsThread> thread;
|
||||
@@ -39,15 +39,15 @@ using namespace epics::pvDatabase;
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
bool result(false);
|
||||
String recordName;
|
||||
string recordName;
|
||||
recordName = "arrayPerformance";
|
||||
size_t size = 10000000;
|
||||
double delay = .0001;
|
||||
String providerName("local");
|
||||
string providerName("local");
|
||||
size_t nMonitor = 1;
|
||||
int queueSize = 2;
|
||||
double waitTime = 0.0;
|
||||
if(argc==2 && String(argv[1])==String("-help")) {
|
||||
if(argc==2 && string(argv[1])==string("-help")) {
|
||||
cout << "arrayPerformanceMain recordName size";
|
||||
cout << " delay providerName nMonitor queueSize waitTime" << endl;
|
||||
cout << "default" << endl;
|
||||
@@ -83,7 +83,7 @@ int main(int argc,char *argv[])
|
||||
pvRecord = ArrayPerformance::create(recordName,size,delay);
|
||||
result = master->addRecord(pvRecord);
|
||||
PVRecordPtr arrayPreformance = pvRecord;
|
||||
arrayPreformance->setTraceLevel(1);
|
||||
arrayPreformance->setTraceLevel(0);
|
||||
pvRecord = TraceRecord::create("traceRecordPGRPC");
|
||||
result = master->addRecord(pvRecord);
|
||||
if(!result) cout<< "record " << recordName << " not added" << endl;
|
||||
@@ -24,9 +24,10 @@ using std::tr1::dynamic_pointer_cast;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::ostringstream;
|
||||
using std::string;
|
||||
|
||||
static String requesterName("longArrayGet");
|
||||
static String request("value,timeStamp,alarm");
|
||||
static string requesterName("longArrayGet");
|
||||
static string request("value,timeStamp,alarm");
|
||||
static epics::pvData::Mutex printMutex;
|
||||
|
||||
class LongArrayChannelRequester;
|
||||
@@ -52,8 +53,8 @@ public:
|
||||
isDestroyed = true;
|
||||
longArrayChannelGet.reset();
|
||||
}
|
||||
virtual String getRequesterName() { return requesterName;}
|
||||
virtual void message(String const & message, MessageType messageType)
|
||||
virtual string getRequesterName() { return requesterName;}
|
||||
virtual void message(string const & message, MessageType messageType)
|
||||
{
|
||||
Lock guard(printMutex);
|
||||
cout << requesterName << " message " << message << endl;
|
||||
@@ -93,18 +94,21 @@ public:
|
||||
isDestroyed = true;
|
||||
longArrayChannelGet.reset();
|
||||
}
|
||||
virtual String getRequesterName() { return requesterName;}
|
||||
virtual void message(String const & message, MessageType messageType)
|
||||
virtual string getRequesterName() { return requesterName;}
|
||||
virtual void message(string const & message, MessageType messageType)
|
||||
{
|
||||
Lock guard(printMutex);
|
||||
cout << requesterName << " message " << message << endl;
|
||||
}
|
||||
virtual void channelGetConnect(
|
||||
Status const & status,
|
||||
ChannelGet::shared_pointer const & channelGet,
|
||||
StructureConstPtr const &structure);
|
||||
virtual void getDone(
|
||||
Status const & status,
|
||||
ChannelGet::shared_pointer const & channelGet,
|
||||
PVStructurePtr const &pvStructure,
|
||||
BitSetPtr const &bitSet);
|
||||
virtual void getDone(Status const & status);
|
||||
BitSetPtr const & bitSet);
|
||||
private:
|
||||
LongArrayChannelGetRequesterPtr getPtrSelf()
|
||||
{
|
||||
@@ -123,8 +127,8 @@ class LongArrayChannelGet :
|
||||
{
|
||||
public:
|
||||
LongArrayChannelGet(
|
||||
String providerName,
|
||||
String channelName,
|
||||
string providerName,
|
||||
string channelName,
|
||||
int iterBetweenCreateChannel,
|
||||
int iterBetweenCreateChannelGet,
|
||||
double delayTime)
|
||||
@@ -141,7 +145,7 @@ public:
|
||||
bool init();
|
||||
virtual void destroy();
|
||||
virtual void run();
|
||||
void message(String const & message, MessageType messageType)
|
||||
void message(string const & message, MessageType messageType)
|
||||
{
|
||||
Lock guard(printMutex);
|
||||
cout << requesterName << " message " << message << endl;
|
||||
@@ -155,23 +159,26 @@ public:
|
||||
virtual void channelGetConnect(
|
||||
Status const & status,
|
||||
ChannelGet::shared_pointer const & channelGet,
|
||||
StructureConstPtr const &structure);
|
||||
virtual void getDone(
|
||||
Status const & status,
|
||||
ChannelGet::shared_pointer channelGet,
|
||||
PVStructurePtr const &pvStructure,
|
||||
BitSetPtr const &bitSet);
|
||||
virtual void getDone(Status const & status);
|
||||
BitSetPtr const & bitSet);
|
||||
private:
|
||||
LongArrayChannelGetPtr getPtrSelf()
|
||||
{
|
||||
return shared_from_this();
|
||||
}
|
||||
size_t checkResult();
|
||||
String providerName;
|
||||
String channelName;
|
||||
string providerName;
|
||||
string channelName;
|
||||
int iterBetweenCreateChannel;
|
||||
int iterBetweenCreateChannelGet;
|
||||
double delayTime;
|
||||
bool isDestroyed;
|
||||
bool runReturned;
|
||||
epics::pvData::String threadName;
|
||||
std::string threadName;
|
||||
Status status;
|
||||
Event event;
|
||||
Mutex mutex;
|
||||
@@ -197,7 +204,7 @@ void LongArrayChannelRequester::channelStateChange(
|
||||
Channel::shared_pointer const & channel,
|
||||
Channel::ConnectionState connectionState)
|
||||
{
|
||||
String mess(Channel::ConnectionStateNames[connectionState]);
|
||||
string mess(Channel::ConnectionStateNames[connectionState]);
|
||||
message(mess,infoMessage);
|
||||
Lock guard(mutex);
|
||||
if(isDestroyed) return;
|
||||
@@ -206,21 +213,24 @@ void LongArrayChannelRequester::channelStateChange(
|
||||
|
||||
void LongArrayChannelGetRequester::channelGetConnect(
|
||||
Status const & status,
|
||||
ChannelGet::shared_pointer const & channelGet,
|
||||
PVStructurePtr const &pvStructure,
|
||||
BitSetPtr const &bitSet)
|
||||
ChannelGet::shared_pointer const & channelGet,
|
||||
StructureConstPtr const &structure)
|
||||
{
|
||||
Lock guard(mutex);
|
||||
if(isDestroyed) return;
|
||||
longArrayChannelGet->channelGetConnect(
|
||||
status,channelGet,pvStructure,bitSet);
|
||||
status,channelGet,structure);
|
||||
}
|
||||
|
||||
void LongArrayChannelGetRequester::getDone(Status const & status)
|
||||
void LongArrayChannelGetRequester::getDone(
|
||||
Status const & status,
|
||||
ChannelGet::shared_pointer const & channelGet,
|
||||
PVStructurePtr const &pvStructure,
|
||||
BitSetPtr const & bitSet)
|
||||
{
|
||||
Lock guard(mutex);
|
||||
if(isDestroyed) return;
|
||||
longArrayChannelGet->getDone(status);
|
||||
longArrayChannelGet->getDone(status,channelGet,pvStructure,bitSet);
|
||||
}
|
||||
|
||||
void LongArrayChannelGet::channelCreated(
|
||||
@@ -241,12 +251,10 @@ void LongArrayChannelGet::channelStateChange(
|
||||
(connectionState==Channel::CONNECTED ? infoMessage : errorMessage);
|
||||
message("channelStateChange",messageType);
|
||||
}
|
||||
|
||||
void LongArrayChannelGet::channelGetConnect(
|
||||
Status const & status,
|
||||
ChannelGet::shared_pointer const & channelGet,
|
||||
PVStructurePtr const &pvStructure,
|
||||
BitSetPtr const &bitSet)
|
||||
StructureConstPtr const &structure)
|
||||
{
|
||||
this->status = status;
|
||||
if(!status.isOK()) {
|
||||
@@ -255,13 +263,12 @@ void LongArrayChannelGet::channelGetConnect(
|
||||
return;
|
||||
}
|
||||
this->channelGet = channelGet;
|
||||
this->pvStructure = pvStructure;
|
||||
this->bitSet = bitSet;
|
||||
bool structureOK(true);
|
||||
PVStructurePtr pvStructure = getPVDataCreate()->createPVStructure(structure);
|
||||
PVFieldPtr pvField = pvStructure->getSubField("timeStamp");
|
||||
if(pvField==NULL) structureOK = false;
|
||||
if(!pvField) structureOK = false;
|
||||
pvField = pvStructure->getSubField("value");
|
||||
if(pvField==NULL) {
|
||||
if(!pvField) {
|
||||
structureOK = false;
|
||||
} else {
|
||||
FieldConstPtr field = pvField->getField();
|
||||
@@ -273,7 +280,7 @@ void LongArrayChannelGet::channelGetConnect(
|
||||
}
|
||||
}
|
||||
if(!structureOK) {
|
||||
String mess("channelGetConnect: illegal structure");
|
||||
string mess("channelGetConnect: illegal structure");
|
||||
message(mess,errorMessage);
|
||||
this->status = Status(Status::STATUSTYPE_ERROR,mess);
|
||||
}
|
||||
@@ -284,8 +291,8 @@ void LongArrayChannelGet::channelGetConnect(
|
||||
bool LongArrayChannelGet::init()
|
||||
{
|
||||
ChannelProvider::shared_pointer channelProvider =
|
||||
getChannelAccess()->getProvider(providerName);
|
||||
if(channelProvider==NULL) {
|
||||
getChannelProviderRegistry()->getProvider(providerName);
|
||||
if(!channelProvider) {
|
||||
cout << "provider " << providerName << " not found" << endl;
|
||||
return false;
|
||||
}
|
||||
@@ -298,7 +305,7 @@ bool LongArrayChannelGet::init()
|
||||
if(!status.isOK()) return false;
|
||||
CreateRequest::shared_pointer createRequest = CreateRequest::create();
|
||||
PVStructurePtr pvRequest = createRequest->createRequest(request);
|
||||
if(pvRequest==NULL) {
|
||||
if(!pvRequest) {
|
||||
cout << "request logic error " << createRequest->getMessage() << endl;
|
||||
return false;
|
||||
}
|
||||
@@ -327,10 +334,10 @@ void LongArrayChannelGet::destroy()
|
||||
if(runReturned) break;
|
||||
epicsThreadSleep(.01);
|
||||
}
|
||||
if(longArrayChannelRequester!=NULL) {
|
||||
if(longArrayChannelRequester) {
|
||||
longArrayChannelRequester->destroy();
|
||||
}
|
||||
if(longArrayChannelGetRequester!=NULL) {
|
||||
if(longArrayChannelGetRequester) {
|
||||
longArrayChannelGetRequester->destroy();
|
||||
}
|
||||
thread->exitWait();
|
||||
@@ -355,7 +362,7 @@ void LongArrayChannelGet::run()
|
||||
int numChannelCreate = 0;
|
||||
size_t nElements = 0;
|
||||
while(true) {
|
||||
channelGet->get(false);
|
||||
channelGet->get();
|
||||
event.wait();
|
||||
if(isDestroyed) {
|
||||
runReturned = true;
|
||||
@@ -398,7 +405,7 @@ void LongArrayChannelGet::run()
|
||||
longArrayChannelRequester->destroy();
|
||||
channel->destroy();
|
||||
ChannelProvider::shared_pointer channelProvider =
|
||||
getChannelAccess()->getProvider(providerName);
|
||||
getChannelProviderRegistry()->getProvider(providerName);
|
||||
longArrayChannelRequester.reset(new LongArrayChannelRequester(getPtrSelf()));
|
||||
channel = channelProvider->createChannel(
|
||||
channelName,
|
||||
@@ -426,7 +433,7 @@ void LongArrayChannelGet::run()
|
||||
CreateRequest::create();
|
||||
PVStructurePtr pvRequest =
|
||||
createRequest->createRequest(request);
|
||||
if(pvRequest==NULL) {
|
||||
if(!pvRequest) {
|
||||
cout << "request logic error " << createRequest->getMessage() << endl;
|
||||
return ;
|
||||
}
|
||||
@@ -445,10 +452,14 @@ void LongArrayChannelGet::run()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void LongArrayChannelGet::getDone(Status const & status)
|
||||
void LongArrayChannelGet::getDone(
|
||||
Status const & status,
|
||||
ChannelGet::shared_pointer channelGet,
|
||||
PVStructurePtr const &pvStructure,
|
||||
BitSetPtr const & bitSet)
|
||||
{
|
||||
this->pvStructure = pvStructure;
|
||||
this->bitSet = bitSet;
|
||||
event.signal();
|
||||
}
|
||||
|
||||
@@ -477,8 +488,8 @@ size_t LongArrayChannelGet::checkResult()
|
||||
|
||||
|
||||
LongArrayGetPtr LongArrayGet::create(
|
||||
String const &providerName,
|
||||
String const & channelName,
|
||||
string const &providerName,
|
||||
string const & channelName,
|
||||
int iterBetweenCreateChannel,
|
||||
int iterBetweenCreateChannelGet,
|
||||
double delayTime)
|
||||
@@ -495,8 +506,8 @@ LongArrayGetPtr LongArrayGet::create(
|
||||
}
|
||||
|
||||
LongArrayGet::LongArrayGet(
|
||||
String const &providerName,
|
||||
String const & channelName,
|
||||
string const &providerName,
|
||||
string const & channelName,
|
||||
int iterBetweenCreateChannel,
|
||||
int iterBetweenCreateChannelGet,
|
||||
double delayTime)
|
||||
@@ -17,8 +17,6 @@
|
||||
# undef epicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
#include <pv/event.h>
|
||||
#include <pv/lock.h>
|
||||
#include <pv/standardPVField.h>
|
||||
@@ -49,8 +47,8 @@ class epicsShareClass LongArrayGet :
|
||||
public:
|
||||
POINTER_DEFINITIONS(LongArrayGet);
|
||||
static LongArrayGetPtr create(
|
||||
epics::pvData::String const & providerName,
|
||||
epics::pvData::String const & channelName,
|
||||
std::string const & providerName,
|
||||
std::string const & channelName,
|
||||
int iterBetweenCreateChannel = 0,
|
||||
int iterBetweenCreateChannelGet = 0,
|
||||
double delayTime = 0.0);
|
||||
@@ -62,15 +60,15 @@ private:
|
||||
return shared_from_this();
|
||||
}
|
||||
LongArrayGet(
|
||||
epics::pvData::String const & providerName,
|
||||
epics::pvData::String const & channelName,
|
||||
std::string const & providerName,
|
||||
std::string const & channelName,
|
||||
int iterBetweenCreateChannel = 0,
|
||||
int iterBetweenCreateChannelGet = 0,
|
||||
double delayTime = 0.0);
|
||||
bool init();
|
||||
|
||||
epics::pvData::String providerName;
|
||||
epics::pvData::String channelName;
|
||||
std::string providerName;
|
||||
std::string channelName;
|
||||
int iterBetweenCreateChannel;
|
||||
int iterBetweenCreateChannelGet;
|
||||
double delayTime;
|
||||
@@ -38,11 +38,11 @@ using namespace epics::pvDatabase;
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
String channelName("arrayPerformance");
|
||||
string channelName("arrayPerformance");
|
||||
int iterBetweenCreateChannel = 0;
|
||||
int iterBetweenCreateChannelGet = 0;
|
||||
double delayTime = 1.0;
|
||||
if(argc==2 && String(argv[1])==String("-help")) {
|
||||
if(argc==2 && string(argv[1])==string("-help")) {
|
||||
cout << "longArrayGetMain channelName ";
|
||||
cout << "iterBetweenCreateChannel iterBetweenCreateChannelGet delayTime" << endl;
|
||||
cout << "default" << endl;
|
||||
@@ -25,11 +25,12 @@ using std::tr1::static_pointer_cast;
|
||||
using std::tr1::dynamic_pointer_cast;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::string;
|
||||
using std::ostringstream;
|
||||
|
||||
static String requesterName("longArrayMonitor");
|
||||
static string requesterName("longArrayMonitor");
|
||||
|
||||
static void messagePvt(String const & message, MessageType messageType)
|
||||
static void messagePvt(string const & message, MessageType messageType)
|
||||
{
|
||||
cout << requesterName << " message " << message << endl;
|
||||
}
|
||||
@@ -43,8 +44,8 @@ public:
|
||||
{}
|
||||
virtual ~LAMChannelRequester(){}
|
||||
virtual void destroy(){longArrayMonitor.reset();}
|
||||
virtual String getRequesterName() { return requesterName;}
|
||||
virtual void message(String const & message, MessageType messageType)
|
||||
virtual string getRequesterName() { return requesterName;}
|
||||
virtual void message(string const & message, MessageType messageType)
|
||||
{ messagePvt(message,messageType);}
|
||||
virtual void channelCreated(const Status& status, Channel::shared_pointer const & channel);
|
||||
virtual void channelStateChange(Channel::shared_pointer const & channel, Channel::ConnectionState connectionState);
|
||||
@@ -83,8 +84,8 @@ public:
|
||||
void init();
|
||||
virtual void destroy();
|
||||
virtual void run();
|
||||
virtual String getRequesterName() { return requesterName;}
|
||||
virtual void message(String const & message, MessageType messageType)
|
||||
virtual string getRequesterName() { return requesterName;}
|
||||
virtual void message(string const & message, MessageType messageType)
|
||||
{ messagePvt(message,messageType);}
|
||||
virtual void monitorConnect(Status const & status,
|
||||
MonitorPtr const & monitor, StructureConstPtr const & structure);
|
||||
@@ -95,7 +96,7 @@ private:
|
||||
double waitTime;
|
||||
bool isDestroyed;
|
||||
bool runReturned;
|
||||
epics::pvData::String threadName;
|
||||
std::string threadName;
|
||||
Event event;
|
||||
Mutex mutex;
|
||||
std::auto_ptr<epicsThread> thread;
|
||||
@@ -137,9 +138,9 @@ void LAMMonitorRequester::monitorConnect(Status const & status,
|
||||
}
|
||||
bool structureOK(true);
|
||||
FieldConstPtr field = structure->getField("timeStamp");
|
||||
if(field==NULL) structureOK = false;
|
||||
if(!field) structureOK = false;
|
||||
field = structure->getField("value");
|
||||
if(field==NULL) {
|
||||
if(!field) {
|
||||
structureOK = false;
|
||||
} else {
|
||||
if(field->getType()!=scalarArray) {
|
||||
@@ -150,7 +151,7 @@ void LAMMonitorRequester::monitorConnect(Status const & status,
|
||||
}
|
||||
}
|
||||
if(!structureOK) {
|
||||
String message("monitorConnect: illegal structure");
|
||||
string message("monitorConnect: illegal structure");
|
||||
messagePvt(message,errorMessage);
|
||||
longArrayMonitor->status = Status(Status::STATUSTYPE_ERROR,message);
|
||||
}
|
||||
@@ -178,9 +179,9 @@ void LAMMonitorRequester::run()
|
||||
{
|
||||
Lock xx(mutex);
|
||||
monitorElement = longArrayMonitor->monitor->poll();
|
||||
if(monitorElement!=NULL) pvStructure = monitorElement->pvStructurePtr;
|
||||
if(monitorElement) pvStructure = monitorElement->pvStructurePtr;
|
||||
}
|
||||
if(monitorElement==NULL) break;
|
||||
if(!monitorElement) break;
|
||||
if(waitTime>0.0) epicsThreadSleep(waitTime);
|
||||
pvTimeStamp.attach(pvStructure->getSubField("timeStamp"));
|
||||
pvTimeStamp.get(timeStamp);
|
||||
@@ -200,12 +201,8 @@ void LAMMonitorRequester::run()
|
||||
out << "first " << first << " last " << last ;
|
||||
BitSetPtr changed = monitorElement->changedBitSet;
|
||||
BitSetPtr overrun = monitorElement->overrunBitSet;
|
||||
String buffer;
|
||||
changed->toString(&buffer);
|
||||
out << " changed " << buffer;
|
||||
buffer.clear();
|
||||
overrun->toString(&buffer);
|
||||
out << " overrun " << buffer;
|
||||
out << " changed " << *changed;
|
||||
out << " overrun " << *overrun;
|
||||
double elementsPerSec = nElements;
|
||||
elementsPerSec /= diff;
|
||||
if(elementsPerSec>10.0e9) {
|
||||
@@ -246,8 +243,8 @@ void LAMMonitorRequester::unlisten(MonitorPtr const & monitor)
|
||||
|
||||
|
||||
LongArrayMonitorPtr LongArrayMonitor::create(
|
||||
String const &providerName,
|
||||
String const & channelName,
|
||||
string const &providerName,
|
||||
string const & channelName,
|
||||
int queueSize,
|
||||
double waitTime)
|
||||
{
|
||||
@@ -261,30 +258,31 @@ LongArrayMonitor::LongArrayMonitor() {}
|
||||
LongArrayMonitor::~LongArrayMonitor() {}
|
||||
|
||||
bool LongArrayMonitor::init(
|
||||
String const &providerName,
|
||||
String const &channelName,
|
||||
string const &providerName,
|
||||
string const &channelName,
|
||||
int queueSize,
|
||||
double waitTime)
|
||||
{
|
||||
channelRequester = LAMChannelRequesterPtr(new LAMChannelRequester(getPtrSelf()));
|
||||
monitorRequester = LAMMonitorRequesterPtr(new LAMMonitorRequester(getPtrSelf(),waitTime));
|
||||
monitorRequester->init();
|
||||
ChannelProvider::shared_pointer channelProvider = getChannelAccess()->getProvider(providerName);
|
||||
if(channelProvider==NULL) {
|
||||
ChannelProvider::shared_pointer channelProvider =
|
||||
getChannelProviderRegistry()->getProvider(providerName);
|
||||
if(!channelProvider) {
|
||||
cout << "provider " << providerName << " not found" << endl;
|
||||
return false;
|
||||
}
|
||||
channel = channelProvider->createChannel(channelName,channelRequester,0);
|
||||
event.wait();
|
||||
if(!status.isOK()) return false;
|
||||
String request("record[queueSize=");
|
||||
string request("record[queueSize=");
|
||||
char buff[20];
|
||||
sprintf(buff,"%d",queueSize);
|
||||
request += buff;
|
||||
request += "]field(value,timeStamp,alarm)";
|
||||
CreateRequest::shared_pointer createRequest = CreateRequest::create();
|
||||
PVStructurePtr pvRequest = createRequest->createRequest(request);
|
||||
if(pvRequest==NULL) {
|
||||
if(!pvRequest) {
|
||||
cout << "request logic error " << createRequest->getMessage() << endl;
|
||||
return false;
|
||||
}
|
||||
@@ -16,7 +16,6 @@
|
||||
# undef epicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <shareLib.h>
|
||||
#include <pv/event.h>
|
||||
#include <pv/lock.h>
|
||||
#include <pv/standardPVField.h>
|
||||
@@ -49,8 +48,8 @@ class epicsShareClass LongArrayMonitor :
|
||||
public:
|
||||
POINTER_DEFINITIONS(LongArrayMonitor);
|
||||
static LongArrayMonitorPtr create(
|
||||
epics::pvData::String const & providerName,
|
||||
epics::pvData::String const & channelName,
|
||||
std::string const & providerName,
|
||||
std::string const & channelName,
|
||||
int queueSize = 1,
|
||||
double waitTime = 0.0);
|
||||
~LongArrayMonitor();
|
||||
@@ -60,8 +59,8 @@ public:
|
||||
private:
|
||||
static epics::pvData::Mutex printMutex;
|
||||
bool init(
|
||||
epics::pvData::String const & providerName,
|
||||
epics::pvData::String const & channelName,
|
||||
std::string const & providerName,
|
||||
std::string const & channelName,
|
||||
int queueSize,
|
||||
double waitTime);
|
||||
LongArrayMonitorPtr getPtrSelf()
|
||||
@@ -38,10 +38,10 @@ using namespace epics::pvDatabase;
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
String channelName("arrayPerformance");
|
||||
string channelName("arrayPerformance");
|
||||
int queueSize = 2;
|
||||
double waitTime = 0.0;
|
||||
if(argc==2 && String(argv[1])==String("-help")) {
|
||||
if(argc==2 && string(argv[1])==string("-help")) {
|
||||
cout << "longArrayMonitorMain channelName queueSize waitTime" << endl;
|
||||
cout << "default" << endl;
|
||||
cout << "longArrayMonitorMain " << channelName << " ";
|
||||
@@ -24,9 +24,10 @@ using std::tr1::dynamic_pointer_cast;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::ostringstream;
|
||||
using std::string;
|
||||
|
||||
static String requesterName("longArrayPut");
|
||||
static String request("value");
|
||||
static string requesterName("longArrayPut");
|
||||
static string request("value");
|
||||
static epics::pvData::Mutex printMutex;
|
||||
|
||||
class LongArrayChannelPut :
|
||||
@@ -37,8 +38,8 @@ class LongArrayChannelPut :
|
||||
{
|
||||
public:
|
||||
LongArrayChannelPut(
|
||||
String providerName,
|
||||
String channelName,
|
||||
string providerName,
|
||||
string channelName,
|
||||
size_t arraySize,
|
||||
int iterBetweenCreateChannel,
|
||||
int iterBetweenCreateChannelPut,
|
||||
@@ -57,8 +58,8 @@ public:
|
||||
bool init();
|
||||
virtual void destroy();
|
||||
virtual void run();
|
||||
virtual String getRequesterName() { return requesterName;}
|
||||
virtual void message(String const & message, MessageType messageType)
|
||||
virtual string getRequesterName() { return requesterName;}
|
||||
virtual void message(string const & message, MessageType messageType)
|
||||
{
|
||||
Lock guard(printMutex);
|
||||
cout << requesterName << " message " << message << endl;
|
||||
@@ -70,26 +71,31 @@ public:
|
||||
Channel::shared_pointer const & channel,
|
||||
Channel::ConnectionState connectionState);
|
||||
virtual void channelPutConnect(
|
||||
Status const & status,
|
||||
ChannelPut::shared_pointer const & channelPut,
|
||||
StructureConstPtr const &structure);
|
||||
virtual void putDone(
|
||||
Status const & status,
|
||||
ChannelPut::shared_pointer const & channelPut);
|
||||
virtual void getDone(
|
||||
Status const & status,
|
||||
ChannelPut::shared_pointer const & channelPut,
|
||||
PVStructurePtr const &pvStructure,
|
||||
BitSetPtr const &bitSet);
|
||||
virtual void putDone(Status const & status);
|
||||
virtual void getDone(Status const & status){}
|
||||
BitSetPtr const & bitSet){}
|
||||
private:
|
||||
LongArrayChannelPutPtr getPtrSelf()
|
||||
{
|
||||
return shared_from_this();
|
||||
}
|
||||
String providerName;
|
||||
String channelName;
|
||||
string providerName;
|
||||
string channelName;
|
||||
size_t arraySize;
|
||||
int iterBetweenCreateChannel;
|
||||
int iterBetweenCreateChannelPut;
|
||||
double delayTime;
|
||||
bool isDestroyed;
|
||||
bool runReturned;
|
||||
epics::pvData::String threadName;
|
||||
std::string threadName;
|
||||
Status status;
|
||||
Event event;
|
||||
Mutex mutex;
|
||||
@@ -103,8 +109,8 @@ private:
|
||||
|
||||
bool LongArrayChannelPut::init()
|
||||
{
|
||||
ChannelProvider::shared_pointer channelProvider = getChannelAccess()->getProvider(providerName);
|
||||
if(channelProvider==NULL) {
|
||||
ChannelProvider::shared_pointer channelProvider = getChannelProviderRegistry()->getProvider(providerName);
|
||||
if(!channelProvider) {
|
||||
cout << "provider " << providerName << " not found" << endl;
|
||||
return false;
|
||||
}
|
||||
@@ -113,7 +119,7 @@ bool LongArrayChannelPut::init()
|
||||
if(!status.isOK()) return false;
|
||||
CreateRequest::shared_pointer createRequest = CreateRequest::create();
|
||||
PVStructurePtr pvRequest = createRequest->createRequest(request);
|
||||
if(pvRequest==NULL) {
|
||||
if(!pvRequest) {
|
||||
cout << "request logic error " << createRequest->getMessage() << endl;
|
||||
return false;
|
||||
}
|
||||
@@ -168,8 +174,7 @@ void LongArrayChannelPut::channelStateChange(
|
||||
void LongArrayChannelPut::channelPutConnect(
|
||||
Status const & status,
|
||||
ChannelPut::shared_pointer const & channelPut,
|
||||
PVStructurePtr const &pvStructure,
|
||||
BitSetPtr const &bitSet)
|
||||
StructureConstPtr const &structure)
|
||||
{
|
||||
this->status = status;
|
||||
if(!status.isOK()) {
|
||||
@@ -178,11 +183,11 @@ void LongArrayChannelPut::channelPutConnect(
|
||||
return;
|
||||
}
|
||||
this->channelPut = channelPut;
|
||||
this->pvStructure = pvStructure;
|
||||
this->bitSet = bitSet;
|
||||
pvStructure = getPVDataCreate()->createPVStructure(structure);
|
||||
bitSet = BitSetPtr(new BitSet(pvStructure->getNumberFields()));
|
||||
bool structureOK(true);
|
||||
PVFieldPtr pvField = pvStructure->getSubField("value");
|
||||
if(pvField==NULL) {
|
||||
if(!pvField) {
|
||||
structureOK = false;
|
||||
} else {
|
||||
FieldConstPtr field = pvField->getField();
|
||||
@@ -194,7 +199,7 @@ void LongArrayChannelPut::channelPutConnect(
|
||||
}
|
||||
}
|
||||
if(!structureOK) {
|
||||
String mess("channelPutConnect: illegal structure");
|
||||
string mess("channelPutConnect: illegal structure");
|
||||
message(mess,errorMessage);
|
||||
this->status = Status(Status::STATUSTYPE_ERROR,mess);
|
||||
}
|
||||
@@ -222,7 +227,7 @@ void LongArrayChannelPut::run()
|
||||
shared_vector<const int64> data(freeze(xxx));
|
||||
pvLongArray->replace(data);
|
||||
bitSet->set(pvLongArray->getFieldOffset());
|
||||
channelPut->put(false);
|
||||
channelPut->put(pvStructure,bitSet);
|
||||
event.wait();
|
||||
if(isDestroyed) {
|
||||
runReturned = true;
|
||||
@@ -262,9 +267,8 @@ void LongArrayChannelPut::run()
|
||||
if(iterBetweenCreateChannel!=0) {
|
||||
if(numChannelCreate>=iterBetweenCreateChannel) {
|
||||
channel->destroy();
|
||||
epicsThreadSleep(1.0);
|
||||
ChannelProvider::shared_pointer channelProvider =
|
||||
getChannelAccess()->getProvider(providerName);
|
||||
getChannelProviderRegistry()->getProvider(providerName);
|
||||
channel = channelProvider->createChannel(
|
||||
channelName,getPtrSelf(),0);
|
||||
event.wait();
|
||||
@@ -290,7 +294,7 @@ void LongArrayChannelPut::run()
|
||||
channelPut->destroy();
|
||||
CreateRequest::shared_pointer createRequest = CreateRequest::create();
|
||||
PVStructurePtr pvRequest = createRequest->createRequest(request);
|
||||
if(pvRequest==NULL) {
|
||||
if(!pvRequest) {
|
||||
cout << "request logic error " << createRequest->getMessage() << endl;
|
||||
return ;
|
||||
}
|
||||
@@ -310,15 +314,17 @@ void LongArrayChannelPut::run()
|
||||
}
|
||||
}
|
||||
|
||||
void LongArrayChannelPut::putDone(Status const & status)
|
||||
void LongArrayChannelPut::putDone(
|
||||
Status const & status,
|
||||
ChannelPut::shared_pointer const & channelPut)
|
||||
{
|
||||
event.signal();
|
||||
}
|
||||
|
||||
|
||||
LongArrayPutPtr LongArrayPut::create(
|
||||
String const &providerName,
|
||||
String const & channelName,
|
||||
string const &providerName,
|
||||
string const & channelName,
|
||||
size_t arraySize,
|
||||
int iterBetweenCreateChannel,
|
||||
int iterBetweenCreateChannelPut,
|
||||
@@ -337,8 +343,8 @@ LongArrayPutPtr LongArrayPut::create(
|
||||
}
|
||||
|
||||
LongArrayPut::LongArrayPut(
|
||||
String const &providerName,
|
||||
String const & channelName,
|
||||
string const &providerName,
|
||||
string const & channelName,
|
||||
size_t arraySize,
|
||||
int iterBetweenCreateChannel,
|
||||
int iterBetweenCreateChannelPut,
|
||||
@@ -17,7 +17,6 @@
|
||||
# undef epicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <shareLib.h>
|
||||
#include <pv/event.h>
|
||||
#include <pv/lock.h>
|
||||
#include <pv/standardPVField.h>
|
||||
@@ -48,8 +47,8 @@ class epicsShareClass LongArrayPut :
|
||||
public:
|
||||
POINTER_DEFINITIONS(LongArrayPut);
|
||||
static LongArrayPutPtr create(
|
||||
epics::pvData::String const & providerName,
|
||||
epics::pvData::String const & channelName,
|
||||
std::string const & providerName,
|
||||
std::string const & channelName,
|
||||
size_t arraySize = 100,
|
||||
int iterBetweenCreateChannel = 0,
|
||||
int iterBetweenCreateChannelPut = 0,
|
||||
@@ -62,16 +61,16 @@ private:
|
||||
return shared_from_this();
|
||||
}
|
||||
LongArrayPut(
|
||||
epics::pvData::String const & providerName,
|
||||
epics::pvData::String const & channelName,
|
||||
std::string const & providerName,
|
||||
std::string const & channelName,
|
||||
size_t arraySize,
|
||||
int iterBetweenCreateChannel,
|
||||
int iterBetweenCreateChannelPut,
|
||||
double delayTime);
|
||||
bool init();
|
||||
|
||||
epics::pvData::String providerName;
|
||||
epics::pvData::String channelName;
|
||||
std::string providerName;
|
||||
std::string channelName;
|
||||
size_t arraySize;
|
||||
int iterBetweenCreateChannel;
|
||||
int iterBetweenCreateChannelPut;
|
||||
@@ -38,12 +38,12 @@ using namespace epics::pvDatabase;
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
String channelName("arrayPerformance");
|
||||
string channelName("arrayPerformance");
|
||||
size_t arraySize = 10;
|
||||
int iterBetweenCreateChannel = 0;
|
||||
int iterBetweenCreateChannelPut = 0;
|
||||
double delayTime = 1.0;
|
||||
if(argc==2 && String(argv[1])==String("-help")) {
|
||||
if(argc==2 && string(argv[1])==string("-help")) {
|
||||
cout << "longArrayPutMain channelName arraySize ";
|
||||
cout << "iterBetweenCreateChannel iterBetweenCreateChannelPut delayTime" << endl;
|
||||
cout << "default" << endl;
|
||||
@@ -140,7 +140,7 @@ int main(int argc,char *argv[])
|
||||
size_t size = 50000000;
|
||||
double delay = .01;
|
||||
size_t nThread = 1;
|
||||
if(argc==2 && String(argv[1])==String("-help")) {
|
||||
if(argc==2 && string(argv[1])==string("-help")) {
|
||||
cout << "vectorPerformanceMain size delay nThread" << endl;
|
||||
cout << "default" << endl;
|
||||
cout << "vectorPerformance ";
|
||||
@@ -14,11 +14,14 @@
|
||||
# Set CHECK_RELEASE to NO to disable checking completely.
|
||||
# Set CHECK_RELEASE to WARN to perform consistency checking but
|
||||
# continue building anyway if conflicts are found.
|
||||
CHECK_RELEASE = YES
|
||||
#CHECK_RELEASE = YES
|
||||
|
||||
# To install files into a location other than $(TOP) define
|
||||
# INSTALL_LOCATION here.
|
||||
#INSTALL_LOCATION=</path/name/to/install/top>
|
||||
|
||||
INSTALL_INCLUDE = $(INSTALL_LOCATION)/include/pv
|
||||
USR_INCLUDES += -I $(INSTALL_LOCATION)/include
|
||||
|
||||
-include $(TOP)/../CONFIG_SITE.local
|
||||
-include $(TOP)/configure/CONFIG_SITE.local
|
||||
-include $(TOP)/../CONFIG.local
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
# Sample RELEASE.local file
|
||||
|
||||
V4 = /home/install/epics/v4
|
||||
|
||||
PVASRV = $(V4)/pvaSrv
|
||||
PVACCESS = $(V4)/pvAccessCPP
|
||||
PVDATA = $(V4)/pvDataCPP
|
||||
PVCOMMON = $(V4)/pvCommonCPP
|
||||
|
||||
EPICS_BASE = /home/install/epics/base-3.14.12.3
|
||||
TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top
|
||||
|
||||
EPICS_BASE=/home/install/epics/base
|
||||
PVCOMMON=/home/hg/pvCommonCPP
|
||||
PVDATA=/home/hg/pvDataCPP
|
||||
PVACCESS=/home/hg/pvAccessCPP
|
||||
PVASRV=/home/hg/pvaSrv
|
||||
|
||||
@@ -24,5 +24,5 @@
|
||||
# PVCOMMON = /path/to/epics/pvCommonCPP
|
||||
# EPICS_BASE = /path/to/epics/base
|
||||
|
||||
-include $(TOP)/configure/RELEASE.local
|
||||
-include $(TOP)/../RELEASE.local
|
||||
-include $(TOP)/configure/RELEASE.local
|
||||
|
||||
25
documentation/RELEASE_NOTES.html
Normal file
25
documentation/RELEASE_NOTES.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<h1>Release 4.0 IN DEVELOPMENT</h1>
|
||||
<p>The main changes since release 3.0.2 are:</p>
|
||||
<ul>
|
||||
<li>array semantics now enforce Copy On Write.</li>
|
||||
<li>String no longer defined.</li>
|
||||
<li>toString replaced by stream I/O </li>
|
||||
<li>union is new type.</li>
|
||||
<li>copy and monitor use new code in pvDataCPP</li>
|
||||
</ul>
|
||||
<h2>New Semantics for Arrays</h2>
|
||||
<p>pvDatabaseCPP has been changed to use the new array implementation from pvDataCPP.</p>
|
||||
<h2>String no longer defined</h2>
|
||||
<p>String is replaced by std::string.</p>
|
||||
<h2>toString replaced by stream I/O</h2>
|
||||
<p>All uses of toString have been changed to use the steam I/O that pvDataCPP implements.</p>
|
||||
<h2>union is a new basic type.</h2>
|
||||
<p>exampleDatabase now has example records for union and union array.
|
||||
There are records for regular union and for variant union.</p>
|
||||
<h2>copy</h2>
|
||||
<p>The implementation of copy and monitor for pvAccess has been changed
|
||||
to use the new monitor and copy support from pvDataCPP.</p>
|
||||
<h2>monitorPlugin</h2>
|
||||
<p>exampleDatabase now has a example plugin that implements onChange.</p>
|
||||
<h1>Release 0.9.2</h1>
|
||||
<p>This was the starting point for RELEASE_NOTES</p>
|
||||
50
documentation/RELEASE_NOTES.md
Normal file
50
documentation/RELEASE_NOTES.md
Normal file
@@ -0,0 +1,50 @@
|
||||
Release 4.0 IN DEVELOPMENT
|
||||
===========
|
||||
|
||||
The main changes since release 3.0.2 are:
|
||||
|
||||
* array semantics now enforce Copy On Write.
|
||||
* String no longer defined.
|
||||
* toString replaced by stream I/O
|
||||
* union is new type.
|
||||
* copy and monitor use new code in pvDataCPP
|
||||
|
||||
New Semantics for Arrays
|
||||
--------
|
||||
|
||||
pvDatabaseCPP has been changed to use the new array implementation from pvDataCPP.
|
||||
|
||||
String no longer defined
|
||||
---------
|
||||
|
||||
String is replaced by std::string.
|
||||
|
||||
|
||||
toString replaced by stream I/O
|
||||
---------
|
||||
|
||||
All uses of toString have been changed to use the steam I/O that pvDataCPP implements.
|
||||
|
||||
|
||||
union is a new basic type.
|
||||
------------
|
||||
|
||||
exampleDatabase now has example records for union and union array.
|
||||
There are records for regular union and for variant union.
|
||||
|
||||
|
||||
copy
|
||||
----
|
||||
|
||||
|
||||
The implementation of copy and monitor for pvAccess has been changed
|
||||
to use the new monitor and copy support from pvDataCPP.
|
||||
|
||||
monitorPlugin
|
||||
-------------
|
||||
|
||||
exampleDatabase now has a example plugin that implements onChange.
|
||||
|
||||
Release 0.9.2
|
||||
==========
|
||||
This was the starting point for RELEASE_NOTES
|
||||
13
documentation/TODO.html
Normal file
13
documentation/TODO.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<h1>TODO</h1>
|
||||
<h2>recordList</h2>
|
||||
<p>This is putGet support that provides a list of all the records in an IOC.
|
||||
Since pvAccess implements pvlist this is no longer needed.
|
||||
Remove it from pvDatabaseCPP and pvIOCCPP.
|
||||
Also remove channelList from swtshell.</p>
|
||||
<h2>monitorPlugin</h2>
|
||||
<p>A debate is on-going about what semantics should be.</p>
|
||||
<h2>Must test record delete.</h2>
|
||||
<p>Must test removing a record from the PVDatabase while a pvAccess client
|
||||
is attached. Also why do both unlisten and detach exists?</p>
|
||||
<h2>create more regression tests</h2>
|
||||
<p>Currently only some simple tests exist. Most of the testing has been via the examples</p>
|
||||
28
documentation/TODO.md
Normal file
28
documentation/TODO.md
Normal file
@@ -0,0 +1,28 @@
|
||||
TODO
|
||||
===========
|
||||
|
||||
|
||||
recordList
|
||||
----------
|
||||
|
||||
This is putGet support that provides a list of all the records in an IOC.
|
||||
Since pvAccess implements pvlist this is no longer needed.
|
||||
Remove it from pvDatabaseCPP and pvIOCCPP.
|
||||
Also remove channelList from swtshell.
|
||||
|
||||
monitorPlugin
|
||||
-------------
|
||||
|
||||
A debate is on-going about what semantics should be.
|
||||
|
||||
Must test record delete.
|
||||
-------------------
|
||||
|
||||
Must test removing a record from the PVDatabase while a pvAccess client
|
||||
is attached. Also why do both unlisten and detach exists?
|
||||
|
||||
|
||||
create more regression tests
|
||||
----------------
|
||||
|
||||
Currently only some simple tests exist. Most of the testing has been via the examples
|
||||
File diff suppressed because it is too large
Load Diff
1940
documentation/pvDatabaseCPP_20140710.html
Normal file
1940
documentation/pvDatabaseCPP_20140710.html
Normal file
File diff suppressed because it is too large
Load Diff
2111
documentation/pvDatabaseCPP_20140811.html
Normal file
2111
documentation/pvDatabaseCPP_20140811.html
Normal file
File diff suppressed because it is too large
Load Diff
@@ -20,5 +20,8 @@ CHECK_RELEASE = WARN
|
||||
# INSTALL_LOCATION here.
|
||||
#INSTALL_LOCATION=</path/name/to/install/top>
|
||||
|
||||
-include $(TOP)/../configure/CONFIG_SITE.local
|
||||
INSTALL_INCLUDE = $(INSTALL_LOCATION)/include/pv
|
||||
USR_INCLUDES += -I $(INSTALL_LOCATION)/include
|
||||
|
||||
-include $(TOP)/../../CONFIG_SITE.local
|
||||
-include $(TOP)/../configure/CONFIG_SITE.local
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
# If this example is built in a directory under pvDatabaseCPP,
|
||||
# use the following definitions:
|
||||
|
||||
PVDATABASETEST = $(TOP)/../testTop
|
||||
PVDATABASETEST = $(TOP)/../test
|
||||
PVDATABASE = $(TOP)/..
|
||||
|
||||
-include $(TOP)/../configure/RELEASE.local
|
||||
|
||||
@@ -17,6 +17,7 @@ DB += dbString.db
|
||||
DB += dbStringArray.db
|
||||
DB += dbEnum.db
|
||||
DB += dbCounter.db
|
||||
DB += dbDouble.db
|
||||
|
||||
#----------------------------------------------------
|
||||
# If <anyname>.db template is not named <anyname>*.template add
|
||||
|
||||
3
exampleDatabase/ioc/Db/dbDouble.db
Normal file
3
exampleDatabase/ioc/Db/dbDouble.db
Normal file
@@ -0,0 +1,3 @@
|
||||
record(ao, "$(name)")
|
||||
{
|
||||
}
|
||||
@@ -3,23 +3,26 @@ TOP=../..
|
||||
include $(TOP)/configure/CONFIG
|
||||
#----------------------------------------
|
||||
# ADD MACRO DEFINITIONS AFTER THIS LINE
|
||||
#=============================
|
||||
|
||||
#==================================================
|
||||
# Build an IOC support library
|
||||
#
|
||||
|
||||
DBD += exampleDatabase.dbd
|
||||
|
||||
exampleDatabase_DBD += base.dbd
|
||||
exampleDatabase_DBD += PVAServerRegister.dbd
|
||||
exampleDatabase_DBD += registerChannelProviderLocal.dbd
|
||||
exampleDatabase_DBD += dbPv.dbd
|
||||
exampleDatabase_DBD += powerSupplyRegister.dbd
|
||||
exampleDatabase_DBD += exampleDatabaseRegister.dbd
|
||||
#=============================
|
||||
# build an ioc application
|
||||
|
||||
PROD_IOC += exampleDatabase
|
||||
|
||||
|
||||
# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
|
||||
exampleDatabase_SRCS += exampleDatabase_registerRecordDeviceDriver.cpp
|
||||
exampleDatabase_SRCS_DEFAULT += exampleDatabaseMain.cpp
|
||||
exampleDatabase_SRCS_vxWorks += -nil-
|
||||
|
||||
|
||||
# The following adds support from base/src/vxWorks
|
||||
exampleDatabase_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary
|
||||
|
||||
|
||||
6
exampleDatabase/ioc/src/exampleDatabaseInclude.dbd
Normal file
6
exampleDatabase/ioc/src/exampleDatabaseInclude.dbd
Normal file
@@ -0,0 +1,6 @@
|
||||
include "base.dbd"
|
||||
include "PVAServerRegister.dbd"
|
||||
include "registerChannelProviderLocal.dbd"
|
||||
include "dbPv.dbd"
|
||||
include "powerSupplyRegister.dbd"
|
||||
registrar("exampleDatabaseRegister")
|
||||
@@ -3,5 +3,5 @@ include $(TOP)/configure/CONFIG
|
||||
DIRS += $(wildcard *ioc*)
|
||||
DIRS += $(wildcard as*)
|
||||
DIRS += $(wildcard example*)
|
||||
include $(EPICS_BASE)/configure/RULES_DIRS
|
||||
include $(CONFIG)/RULES_DIRS
|
||||
|
||||
|
||||
@@ -7,15 +7,23 @@ dbLoadDatabase("dbd/exampleDatabase.dbd")
|
||||
exampleDatabase_registerRecordDeviceDriver(pdbbase)
|
||||
|
||||
## Load record instances
|
||||
dbLoadRecords("db/dbScalar.db","name=double01,type=ao")
|
||||
dbLoadRecords("db/dbDouble.db","name=double00")
|
||||
dbLoadRecords("db/dbDouble.db","name=double01")
|
||||
dbLoadRecords("db/dbDouble.db","name=double02")
|
||||
dbLoadRecords("db/dbDouble.db","name=double03")
|
||||
dbLoadRecords("db/dbDouble.db","name=double04")
|
||||
dbLoadRecords("db/dbDouble.db","name=double05")
|
||||
dbLoadRecords("db/dbStringArray.db","name=stringArray01")
|
||||
dbLoadRecords("db/dbEnum.db","name=enum01")
|
||||
dbLoadRecords("db/dbCounter.db","name=counter01");
|
||||
dbLoadRecords("db/dbArray.db","name=doubleArray,type=DOUBLE");
|
||||
|
||||
|
||||
cd ${TOP}/iocBoot/${IOC}
|
||||
iocInit()
|
||||
dbl
|
||||
epicsThreadSleep(2.0)
|
||||
exampleDatabase
|
||||
exampleMonitorPlugin
|
||||
startPVAServer
|
||||
pvdbl
|
||||
|
||||
@@ -4,7 +4,7 @@ include $(TOP)/configure/CONFIG
|
||||
#----------------------------------------
|
||||
# ADD MACRO DEFINITIONS AFTER THIS LINE
|
||||
|
||||
DBD += exampleDatabaseRegister.dbd
|
||||
DBD += exampleDatabase.dbd
|
||||
|
||||
INC += exampleDatabase.h
|
||||
|
||||
@@ -15,6 +15,7 @@ exampleDatabase_LIBS += powerSupply
|
||||
exampleDatabase_LIBS += pvDatabase
|
||||
exampleDatabase_LIBS += pvAccess
|
||||
exampleDatabase_LIBS += pvData
|
||||
exampleDatabase_LIBS += Com
|
||||
exampleDatabase_LIBS += $(EPICS_BASE_IOC_LIBS)
|
||||
|
||||
PROD_HOST += exampleDatabaseMain
|
||||
|
||||
@@ -26,8 +26,10 @@
|
||||
#include <pv/recordList.h>
|
||||
#include <pv/traceRecord.h>
|
||||
|
||||
#include <powerSupply.h>
|
||||
#include <exampleDatabase.h>
|
||||
#include <pv/powerSupply.h>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <pv/exampleDatabase.h>
|
||||
|
||||
using namespace std;
|
||||
using std::tr1::static_pointer_cast;
|
||||
@@ -42,18 +44,57 @@ static StandardPVFieldPtr standardPVField = getStandardPVField();
|
||||
|
||||
static void createStructureArrayRecord(
|
||||
PVDatabasePtr const &master,
|
||||
ScalarType scalarType,
|
||||
String const &recordName)
|
||||
string const &recordName)
|
||||
{
|
||||
StructureConstPtr structure = standardField->scalar(
|
||||
pvDouble,
|
||||
String("value,alarm,timeStamp"));
|
||||
StringArray names(2);
|
||||
FieldConstPtrArray fields(2);
|
||||
names[0] = "timeStamp";
|
||||
names[0] = "name";
|
||||
names[1] = "value";
|
||||
fields[0] = standardField->timeStamp();
|
||||
fields[1] = fieldCreate->createStructureArray(structure);
|
||||
fields[0] = fieldCreate->createScalar(pvString);
|
||||
fields[1] = fieldCreate->createScalar(pvString);
|
||||
|
||||
StringArray topNames(1);
|
||||
FieldConstPtrArray topFields(1);
|
||||
topNames[0] = "value";
|
||||
topFields[0] = fieldCreate->createStructureArray(
|
||||
fieldCreate->createStructure(names, fields));
|
||||
StructureConstPtr top = fieldCreate->createStructure(topNames,topFields);
|
||||
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(top);
|
||||
PVRecordPtr pvRecord = PVRecord::create(recordName,pvStructure);
|
||||
bool result = master->addRecord(pvRecord);
|
||||
if(!result) cout<< "record " << recordName << " not added" << endl;
|
||||
}
|
||||
|
||||
static void createRegularUnionArrayRecord(
|
||||
PVDatabasePtr const &master,
|
||||
string const &recordName)
|
||||
{
|
||||
StringArray unionNames(2);
|
||||
FieldConstPtrArray unionFields(2);
|
||||
unionNames[0] = "string";
|
||||
unionNames[1] = "stringArray";
|
||||
unionFields[0] = fieldCreate->createScalar(pvString);
|
||||
unionFields[1] = fieldCreate->createScalarArray(pvString);
|
||||
|
||||
StringArray names(1);
|
||||
FieldConstPtrArray fields(1);
|
||||
fields[0] = fieldCreate->createUnionArray(fieldCreate->createUnion(unionNames,unionFields));
|
||||
names[0] = "value";
|
||||
StructureConstPtr top = fieldCreate->createStructure(names,fields);
|
||||
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(top);
|
||||
PVRecordPtr pvRecord = PVRecord::create(recordName,pvStructure);
|
||||
bool result = master->addRecord(pvRecord);
|
||||
if(!result) cout<< "record " << recordName << " not added" << endl;
|
||||
}
|
||||
|
||||
static void createVariantUnionArrayRecord(
|
||||
PVDatabasePtr const &master,
|
||||
string const &recordName)
|
||||
{
|
||||
StringArray names(1);
|
||||
FieldConstPtrArray fields(1);
|
||||
fields[0] = fieldCreate->createVariantUnionArray();
|
||||
names[0] = "value";
|
||||
StructureConstPtr top = fieldCreate->createStructure(names,fields);
|
||||
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(top);
|
||||
PVRecordPtr pvRecord = PVRecord::create(recordName,pvStructure);
|
||||
@@ -64,10 +105,10 @@ static void createStructureArrayRecord(
|
||||
static void createRecords(
|
||||
PVDatabasePtr const &master,
|
||||
ScalarType scalarType,
|
||||
String const &recordNamePrefix,
|
||||
String const &properties)
|
||||
string const &recordNamePrefix,
|
||||
string const &properties)
|
||||
{
|
||||
String recordName = recordNamePrefix;
|
||||
string recordName = recordNamePrefix;
|
||||
PVStructurePtr pvStructure = standardPVField->scalar(scalarType,properties);
|
||||
PVRecordPtr pvRecord = PVRecord::create(recordName,pvStructure);
|
||||
bool result = master->addRecord(pvRecord);
|
||||
@@ -82,13 +123,13 @@ void ExampleDatabase::create()
|
||||
{
|
||||
PVDatabasePtr master = PVDatabase::getMaster();
|
||||
PVRecordPtr pvRecord;
|
||||
String recordName;
|
||||
string recordName;
|
||||
bool result(false);
|
||||
recordName = "traceRecordPGRPC";
|
||||
pvRecord = TraceRecord::create(recordName);
|
||||
result = master->addRecord(pvRecord);
|
||||
if(!result) cout<< "record " << recordName << " not added" << endl;
|
||||
String properties;
|
||||
string properties;
|
||||
properties = "alarm,timeStamp";
|
||||
createRecords(master,pvBoolean,"exampleBoolean",properties);
|
||||
createRecords(master,pvByte,"exampleByte",properties);
|
||||
@@ -97,21 +138,31 @@ void ExampleDatabase::create()
|
||||
createRecords(master,pvLong,"exampleLong",properties);
|
||||
createRecords(master,pvFloat,"exampleFloat",properties);
|
||||
createRecords(master,pvDouble,"exampleDouble",properties);
|
||||
createRecords(master,pvDouble,"exampleDouble01",properties);
|
||||
createRecords(master,pvDouble,"exampleDouble02",properties);
|
||||
createRecords(master,pvDouble,"exampleDouble03",properties);
|
||||
createRecords(master,pvDouble,"exampleDouble04",properties);
|
||||
createRecords(master,pvDouble,"exampleDouble05",properties);
|
||||
createRecords(master,pvString,"exampleString",properties);
|
||||
createStructureArrayRecord(master,pvDouble,"exampleStructureArray");
|
||||
createStructureArrayRecord(master,"exampleStructureArray");
|
||||
createRegularUnionArrayRecord(master,"exampleRegularUnionArray");
|
||||
createVariantUnionArrayRecord(master,"exampleVariantUnionArray");
|
||||
recordName = "examplePowerSupply";
|
||||
PVStructurePtr pvStructure = createPowerSupply();
|
||||
PowerSupplyPtr psr =
|
||||
PowerSupply::create(recordName,pvStructure);
|
||||
if(psr.get()==NULL) {
|
||||
cout << "PowerSupply::create failed" << endl;
|
||||
return;
|
||||
PowerSupplyPtr psr = PowerSupply::create(recordName,pvStructure);
|
||||
if(!psr) {
|
||||
cout << "PowerSupply::create failed" << endl;
|
||||
} else {
|
||||
result = master->addRecord(psr);
|
||||
if(!result) cout<< "record " << recordName << " not added" << endl;
|
||||
}
|
||||
result = master->addRecord(psr);
|
||||
if(!result) cout<< "record " << recordName << " not added" << endl;
|
||||
recordName = "laptoprecordListPGRPC";
|
||||
pvRecord = RecordListRecord::create(recordName);
|
||||
result = master->addRecord(pvRecord);
|
||||
if(!result) cout<< "record " << recordName << " not added" << endl;
|
||||
if(!pvRecord) {
|
||||
cout << "RecordListRecord::create failed" << endl;
|
||||
} else {
|
||||
result = master->addRecord(pvRecord);
|
||||
if(!result) cout<< "record " << recordName << " not added" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,15 +16,15 @@
|
||||
# undef epicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <shareLib.h>
|
||||
#include <pv/pvDatabase.h>
|
||||
|
||||
#ifdef exampledatabaseEpicsExportSharedSymbols
|
||||
# define epicsExportSharedSymbols
|
||||
# undef exampledatabaseEpicsExportSharedSymbols
|
||||
# include <shareLib.h>
|
||||
#endif
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
namespace epics { namespace pvDatabase {
|
||||
|
||||
class epicsShareClass ExampleDatabase{
|
||||
|
||||
@@ -10,49 +10,27 @@
|
||||
|
||||
/* Author: Marty Kraimer */
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
#include <pv/channelProviderLocal.h>
|
||||
#include <pv/serverContext.h>
|
||||
|
||||
#include <exampleDatabase.h>
|
||||
#include <pv/exampleDatabase.h>
|
||||
|
||||
using namespace std;
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::pvDatabase;
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
PVDatabasePtr master = PVDatabase::getMaster();
|
||||
ChannelProviderLocalPtr channelProvider = getChannelProviderLocal();
|
||||
ExampleDatabase::create();
|
||||
ServerContext::shared_pointer ctx =
|
||||
startPVAServer(PVACCESS_ALL_PROVIDERS,0,true,true);
|
||||
cout << "exampleDatabase\n";
|
||||
PVStringArrayPtr pvNames = master->getRecordNames();
|
||||
String buffer;
|
||||
pvNames->toString(&buffer);
|
||||
cout << "recordNames" << endl << buffer << endl;
|
||||
string str;
|
||||
while(true) {
|
||||
cout << "Type exit to stop: \n";
|
||||
getline(cin,str);
|
||||
if(str.compare("exit")==0) break;
|
||||
|
||||
}
|
||||
ctx->destroy();
|
||||
epicsThreadSleep(1.0);
|
||||
channelProvider->destroy();
|
||||
ContextLocal::shared_pointer contextLocal = ContextLocal::create();
|
||||
contextLocal->start();
|
||||
|
||||
cout << "pvAccess server exampleDatabase running..." << endl;
|
||||
epics::pvData::PVStringArrayPtr pvNames = PVDatabase::getMaster()->getRecordNames();
|
||||
cout << "Hosted records: " << endl << *pvNames << endl;
|
||||
|
||||
contextLocal->waitForExit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,7 @@
|
||||
#include <pv/pvDatabase.h>
|
||||
|
||||
#include <epicsExport.h>
|
||||
|
||||
#include <exampleDatabase.h>
|
||||
#include <pv/exampleDatabase.h>
|
||||
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# Makefile at top of application tree
|
||||
|
||||
#Makefile at top of application tree
|
||||
TOP = .
|
||||
include $(TOP)/configure/CONFIG
|
||||
|
||||
DIRS += configure
|
||||
|
||||
DIRS += src
|
||||
@@ -12,7 +10,6 @@ DIRS += ioc
|
||||
ioc_DEPEND_DIRS = src
|
||||
|
||||
DIRS += iocBoot
|
||||
iocBoot_DEPEND_DIRS = src
|
||||
|
||||
include $(TOP)/configure/RULES_TOP
|
||||
|
||||
|
||||
@@ -14,11 +14,26 @@
|
||||
# Set CHECK_RELEASE to NO to disable checking completely.
|
||||
# Set CHECK_RELEASE to WARN to perform consistency checking but
|
||||
# continue building anyway if conflicts are found.
|
||||
CHECK_RELEASE = WARN
|
||||
#CHECK_RELEASE = YES
|
||||
|
||||
# Set this when you only want to compile this application
|
||||
# for a subset of the cross-compiled target architectures
|
||||
# that Base is built for.
|
||||
#CROSS_COMPILER_TARGET_ARCHS = vxWorks-68040
|
||||
|
||||
# To install files into a location other than $(TOP) define
|
||||
# INSTALL_LOCATION here.
|
||||
#INSTALL_LOCATION=</path/name/to/install/top>
|
||||
|
||||
-include $(TOP)/../configure/CONFIG_SITE.local
|
||||
# Set this when your IOC and the host use different paths
|
||||
# to access the application. This will be needed to boot
|
||||
# from a Microsoft FTP server or with some NFS mounts.
|
||||
# You must rebuild in the iocBoot directory for this to
|
||||
# take effect.
|
||||
#IOCS_APPL_TOP = </IOC/path/to/application/top>
|
||||
|
||||
INSTALL_INCLUDE = $(INSTALL_LOCATION)/include/pv
|
||||
USR_INCLUDES += -I $(INSTALL_LOCATION)/include
|
||||
|
||||
-include $(TOP)/../../CONFIG_SITE.local
|
||||
-include $(TOP)/../configure/CONFIG_SITE.local
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
|
||||
# EPICS V4 Developers: Do not edit the locations in this file!
|
||||
#
|
||||
# Create a file RELEASE.local pointing to your PVASRV, PVACCESS,
|
||||
# PVDATA, PVCOMMON and EPICS_BASE build directories, e.g.
|
||||
# PVASRV = /path/to/epics/pvaSrvCPP
|
||||
# Create a file RELEASE.local pointing to your places
|
||||
# for the dependencies, e.g.
|
||||
# PVACCESS = /path/to/epics/pvAccessCPP
|
||||
# PVDATA = /path/to/epics/pvDataCPP
|
||||
# PVCOMMON = /path/to/epics/pvCommonCPP
|
||||
@@ -28,14 +27,14 @@
|
||||
# use the following definitions:
|
||||
|
||||
PVDATABASE = $(TOP)/..
|
||||
|
||||
-include $(TOP)/../configure/RELEASE.local
|
||||
-include $(TOP)/../../RELEASE.local
|
||||
-include $(TOP)/../configure/RELEASE.local
|
||||
|
||||
# If you copied this example from pvDatabaseCPP to be built as a
|
||||
# standalone TOP, adjust and use the following definitions:
|
||||
# standalone TOP, define
|
||||
# PVDATABASE = /path/to/epics/pvDatabaseCPP
|
||||
# in the appropriate RELEASE[.local],
|
||||
# and use the following definitions instead:
|
||||
|
||||
#PVDATABASE = /path/to/epics/pvDatabaseCPP
|
||||
|
||||
#-include $(TOP)/configure/RELEASE.local
|
||||
#-include $(TOP)/../RELEASE.local
|
||||
#-include $(TOP)/configure/RELEASE.local
|
||||
|
||||
@@ -3,22 +3,27 @@ TOP=../..
|
||||
include $(TOP)/configure/CONFIG
|
||||
#----------------------------------------
|
||||
# ADD MACRO DEFINITIONS AFTER THIS LINE
|
||||
#=============================
|
||||
|
||||
#==================================================
|
||||
# Build an IOC support library
|
||||
#
|
||||
|
||||
#=============================
|
||||
# build an ioc application
|
||||
|
||||
|
||||
DBD += exampleLink.dbd
|
||||
|
||||
exampleLink_DBD += base.dbd
|
||||
exampleLink_DBD += PVAServerRegister.dbd
|
||||
exampleLink_DBD += PVAClientRegister.dbd
|
||||
exampleLink_DBD += registerChannelProviderLocal.dbd
|
||||
exampleLink_DBD += exampleLinkRegister.dbd
|
||||
|
||||
PROD_IOC += exampleLink
|
||||
|
||||
|
||||
# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
|
||||
exampleLink_SRCS += exampleLink_registerRecordDeviceDriver.cpp
|
||||
exampleLink_SRCS_DEFAULT += exampleLinkMain.cpp
|
||||
exampleLink_SRCS_vxWorks += -nil-
|
||||
|
||||
|
||||
# The following adds support from base/src/vxWorks
|
||||
exampleLink_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary
|
||||
|
||||
@@ -27,6 +32,7 @@ exampleLink_LIBS += pvDatabase
|
||||
exampleLink_LIBS += pvaSrv
|
||||
exampleLink_LIBS += pvAccess
|
||||
exampleLink_LIBS += pvData
|
||||
exampleLink_LIBS += Com
|
||||
exampleLink_LIBS += $(EPICS_BASE_IOC_LIBS)
|
||||
|
||||
#===========================
|
||||
|
||||
5
exampleLink/ioc/src/exampleLinkInclude.dbd
Normal file
5
exampleLink/ioc/src/exampleLinkInclude.dbd
Normal file
@@ -0,0 +1,5 @@
|
||||
include "base.dbd"
|
||||
include "PVAServerRegister.dbd"
|
||||
include "PVAClientRegister.dbd"
|
||||
include "registerChannelProviderLocal.dbd"
|
||||
registrar("exampleLinkRegister")
|
||||
@@ -3,5 +3,5 @@ include $(TOP)/configure/CONFIG
|
||||
DIRS += $(wildcard *ioc*)
|
||||
DIRS += $(wildcard as*)
|
||||
DIRS += $(wildcard example*)
|
||||
include $(EPICS_BASE)/configure/RULES_DIRS
|
||||
include $(CONFIG)/RULES_DIRS
|
||||
|
||||
|
||||
@@ -13,4 +13,4 @@ cd ${TOP}/iocBoot/${IOC}
|
||||
iocInit()
|
||||
startPVAClient
|
||||
startPVAServer
|
||||
exampleLinkCreateRecord exampleLinkRemote pvAccess doubleArray
|
||||
exampleLinkCreateRecord exampleLink pvAccess doubleArray
|
||||
|
||||
@@ -3,8 +3,13 @@ TOP=..
|
||||
include $(TOP)/configure/CONFIG
|
||||
#----------------------------------------
|
||||
# ADD MACRO DEFINITIONS AFTER THIS LINE
|
||||
#=============================
|
||||
|
||||
DBD += exampleLinkRegister.dbd
|
||||
#==================================================
|
||||
# Build an IOC support library
|
||||
#
|
||||
|
||||
DBD += exampleLink.dbd
|
||||
|
||||
INC += exampleLink.h
|
||||
|
||||
|
||||
@@ -10,24 +10,24 @@
|
||||
*/
|
||||
|
||||
#include <pv/standardPVField.h>
|
||||
#include <pv/convert.h>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <exampleLink.h>
|
||||
#define epicsExportSharedSymbols
|
||||
#include <pv/exampleLink.h>
|
||||
|
||||
|
||||
namespace epics { namespace pvDatabase {
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using std::tr1::static_pointer_cast;
|
||||
using std::tr1::dynamic_pointer_cast;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::string;
|
||||
|
||||
namespace epics { namespace pvDatabase {
|
||||
|
||||
ExampleLinkPtr ExampleLink::create(
|
||||
String const & recordName,
|
||||
String const & providerName,
|
||||
String const & channelName)
|
||||
string const & recordName,
|
||||
string const & providerName,
|
||||
string const & channelName)
|
||||
{
|
||||
PVStructurePtr pvStructure = getStandardPVField()->scalarArray(
|
||||
pvDouble,"alarm.timeStamp");
|
||||
@@ -39,14 +39,13 @@ ExampleLinkPtr ExampleLink::create(
|
||||
}
|
||||
|
||||
ExampleLink::ExampleLink(
|
||||
String const & recordName,
|
||||
String providerName,
|
||||
String channelName,
|
||||
string const & recordName,
|
||||
string providerName,
|
||||
string channelName,
|
||||
PVStructurePtr const & pvStructure)
|
||||
: PVRecord(recordName,pvStructure),
|
||||
providerName(providerName),
|
||||
channelName(channelName),
|
||||
convert(getConvert())
|
||||
channelName(channelName)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -62,15 +61,13 @@ bool ExampleLink::init()
|
||||
PVStructurePtr pvStructure = getPVRecordStructure()->getPVStructure();
|
||||
pvTimeStamp.attach(pvStructure->getSubField("timeStamp"));
|
||||
pvAlarm.attach(pvStructure->getSubField("alarm"));
|
||||
pvValue = static_pointer_cast<PVDoubleArray>(
|
||||
pvStructure->getScalarArrayField("value",pvDouble));
|
||||
if(pvValue==NULL) {
|
||||
pvValue = pvStructure->getSubField<PVDoubleArray>("value");
|
||||
if(!pvValue) {
|
||||
return false;
|
||||
}
|
||||
ChannelAccess::shared_pointer channelAccess = getChannelAccess();
|
||||
ChannelProvider::shared_pointer provider =
|
||||
channelAccess->getProvider(providerName);
|
||||
if(provider==NULL) {
|
||||
getChannelProviderRegistry()->getProvider(providerName);
|
||||
if(!provider) {
|
||||
cout << getRecordName() << " provider "
|
||||
<< providerName << " does not exist" << endl;
|
||||
return false;
|
||||
@@ -95,9 +92,8 @@ bool ExampleLink::init()
|
||||
<< status.getMessage() << endl;
|
||||
return false;
|
||||
}
|
||||
getPVValue = static_pointer_cast<PVDoubleArray>(
|
||||
getPVStructure->getScalarArrayField("value",pvDouble));
|
||||
if(getPVValue==NULL) {
|
||||
getPVValue = getPVStructure->getSubField<PVDoubleArray>("value");
|
||||
if(!getPVValue) {
|
||||
cout << getRecordName() << " get value not PVDoubleArray" << endl;
|
||||
return false;
|
||||
}
|
||||
@@ -107,7 +103,7 @@ bool ExampleLink::init()
|
||||
void ExampleLink::process()
|
||||
{
|
||||
status = Status::Ok;
|
||||
channelGet->get(false);
|
||||
channelGet->get();
|
||||
event.wait();
|
||||
timeStamp.getCurrent();
|
||||
pvTimeStamp.set(timeStamp);
|
||||
@@ -121,7 +117,7 @@ void ExampleLink::process()
|
||||
}
|
||||
alarm.setSeverity(severity);
|
||||
} else {
|
||||
convert->copy(getPVValue,pvValue);
|
||||
pvValue->copyUnchecked(*getPVValue);
|
||||
}
|
||||
alarm.setMessage(status.getMessage());
|
||||
pvAlarm.set(alarm);
|
||||
@@ -145,20 +141,24 @@ void ExampleLink::channelStateChange(
|
||||
void ExampleLink::channelGetConnect(
|
||||
const Status& status,
|
||||
ChannelGet::shared_pointer const & channelGet,
|
||||
PVStructure::shared_pointer const & pvStructure,
|
||||
BitSet::shared_pointer const & bitSet)
|
||||
StructureConstPtr const & structure)
|
||||
{
|
||||
this->status = status;
|
||||
this->channelGet = channelGet;
|
||||
this->getPVStructure = pvStructure;
|
||||
getPVStructure = getPVDataCreate()->createPVStructure(structure);
|
||||
event.signal();
|
||||
}
|
||||
|
||||
void ExampleLink::getDone(
|
||||
const Status& status,
|
||||
ChannelGet::shared_pointer const & channelGet,
|
||||
PVStructurePtr const & pvStructure,
|
||||
BitSetPtr const & bitSet)
|
||||
{
|
||||
this->status = status;
|
||||
getPVStructure->copyUnchecked(*pvStructure);
|
||||
this->bitSet = bitSet;
|
||||
event.signal();
|
||||
}
|
||||
|
||||
void ExampleLink::getDone(const Status& status)
|
||||
{
|
||||
this->status = status;
|
||||
event.signal();
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -8,15 +8,14 @@
|
||||
* @author mrk
|
||||
* @date 2013.08.02
|
||||
*/
|
||||
#ifndef EXAMPLELINK_H
|
||||
#define EXAMPLELINK_H
|
||||
#ifndef EXAMPLEPVADOUBLEARRAYGET_H
|
||||
#define EXAMPLEPVADOUBLEARRAYGET_H
|
||||
|
||||
#ifdef epicsExportSharedSymbols
|
||||
# define examplelinkEpicsExportSharedSymbols
|
||||
# define exampleLinkEpicsExportSharedSymbols
|
||||
# undef epicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
//#include <shareLib.h>
|
||||
#include <pv/timeStamp.h>
|
||||
#include <pv/pvTimeStamp.h>
|
||||
#include <pv/alarm.h>
|
||||
@@ -26,13 +25,12 @@
|
||||
#include <pv/pvAccess.h>
|
||||
#include <pv/serverContext.h>
|
||||
|
||||
|
||||
#ifdef examplelinkEpicsExportSharedSymbols
|
||||
#ifdef exampleLinkEpicsExportSharedSymbols
|
||||
# define epicsExportSharedSymbols
|
||||
# undef examplelinkEpicsExportSharedSymbols
|
||||
# include <shareLib.h>
|
||||
# undef exampleLinkEpicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
namespace epics { namespace pvDatabase {
|
||||
|
||||
@@ -48,9 +46,9 @@ class epicsShareClass ExampleLink :
|
||||
public:
|
||||
POINTER_DEFINITIONS(ExampleLink);
|
||||
static ExampleLinkPtr create(
|
||||
epics::pvData::String const & recordName,
|
||||
epics::pvData::String const & providerName,
|
||||
epics::pvData::String const & channelName
|
||||
std::string const & recordName,
|
||||
std::string const & providerName,
|
||||
std::string const & channelName
|
||||
);
|
||||
virtual ~ExampleLink() {}
|
||||
virtual void destroy();
|
||||
@@ -65,24 +63,26 @@ public:
|
||||
virtual void channelGetConnect(
|
||||
const epics::pvData::Status& status,
|
||||
epics::pvAccess::ChannelGet::shared_pointer const & channelGet,
|
||||
epics::pvData::PVStructure::shared_pointer const & pvStructure,
|
||||
epics::pvData::BitSet::shared_pointer const & bitSet);
|
||||
virtual void getDone(const epics::pvData::Status& status);
|
||||
virtual epics::pvData::String getRequesterName() {return channelName;}
|
||||
epics::pvData::StructureConstPtr const & structure);
|
||||
virtual void getDone(
|
||||
const epics::pvData::Status& status,
|
||||
epics::pvAccess::ChannelGet::shared_pointer const & channelGet,
|
||||
epics::pvData::PVStructurePtr const & pvStructure,
|
||||
epics::pvData::BitSetPtr const &bitSet);
|
||||
virtual std::string getRequesterName() {return channelName;}
|
||||
virtual void message(
|
||||
epics::pvData::String const & message,
|
||||
std::string const & message,
|
||||
epics::pvData::MessageType messageType)
|
||||
{
|
||||
std::cout << "Why is ExampleLink::message called\n";
|
||||
}
|
||||
private:
|
||||
ExampleLink(epics::pvData::String const & recordName,
|
||||
epics::pvData::String providerName,
|
||||
epics::pvData::String channelName,
|
||||
ExampleLink(std::string const & recordName,
|
||||
std::string providerName,
|
||||
std::string channelName,
|
||||
epics::pvData::PVStructurePtr const & pvStructure);
|
||||
epics::pvData::String providerName;
|
||||
epics::pvData::String channelName;
|
||||
epics::pvData::ConvertPtr convert;
|
||||
std::string providerName;
|
||||
std::string channelName;
|
||||
epics::pvData::PVDoubleArrayPtr pvValue;
|
||||
epics::pvData::PVTimeStamp pvTimeStamp;
|
||||
epics::pvData::TimeStamp timeStamp;
|
||||
@@ -99,4 +99,4 @@ private:
|
||||
|
||||
}}
|
||||
|
||||
#endif /* EXAMPLELINK_H */
|
||||
#endif /* EXAMPLEPVADOUBLEARRAYGET_H */
|
||||
|
||||
1
exampleLink/src/exampleLinkInclude.dbd
Normal file
1
exampleLink/src/exampleLinkInclude.dbd
Normal file
@@ -0,0 +1 @@
|
||||
registrar("exampleLinkRegister")
|
||||
@@ -35,14 +35,14 @@
|
||||
#include <pv/pvDatabase.h>
|
||||
|
||||
#include <epicsExport.h>
|
||||
|
||||
#include <exampleLink.h>
|
||||
#include <pv/exampleLink.h>
|
||||
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::pvDatabase;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::string;
|
||||
|
||||
static StandardPVFieldPtr standardPVField = getStandardPVField();
|
||||
|
||||
@@ -59,7 +59,7 @@ static void exampleLinkCallFunc(const iocshArgBuf *args)
|
||||
PVDatabasePtr master = PVDatabase::getMaster();
|
||||
PVRecordPtr pvRecord;
|
||||
bool result(false);
|
||||
String recordName;
|
||||
string recordName;
|
||||
PVStructurePtr pvStructure = standardPVField->scalarArray(
|
||||
pvDouble,"alarm,timeStamp");
|
||||
pvRecord = PVRecord::create("doubleArray",pvStructure);
|
||||
@@ -70,8 +70,8 @@ static void exampleLinkCallFunc(const iocshArgBuf *args)
|
||||
char *providerName = args[1].sval;
|
||||
char *channelName = args[2].sval;
|
||||
ExampleLinkPtr record = ExampleLink::create(recordName,providerName,channelName);
|
||||
if(record!=NULL)
|
||||
result = master->addRecord(record);
|
||||
if(record)
|
||||
result = master->addRecord(record);
|
||||
if(!result) cout << "recordname" << " not added" << endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,26 @@
|
||||
# Set CHECK_RELEASE to NO to disable checking completely.
|
||||
# Set CHECK_RELEASE to WARN to perform consistency checking but
|
||||
# continue building anyway if conflicts are found.
|
||||
CHECK_RELEASE = WARN
|
||||
#CHECK_RELEASE = YES
|
||||
|
||||
# Set this when you only want to compile this application
|
||||
# for a subset of the cross-compiled target architectures
|
||||
# that Base is built for.
|
||||
#CROSS_COMPILER_TARGET_ARCHS = vxWorks-68040
|
||||
|
||||
# To install files into a location other than $(TOP) define
|
||||
# INSTALL_LOCATION here.
|
||||
#INSTALL_LOCATION=</path/name/to/install/top>
|
||||
|
||||
-include $(TOP)/../configure/CONFIG_SITE.local
|
||||
# Set this when your IOC and the host use different paths
|
||||
# to access the application. This will be needed to boot
|
||||
# from a Microsoft FTP server or with some NFS mounts.
|
||||
# You must rebuild in the iocBoot directory for this to
|
||||
# take effect.
|
||||
#IOCS_APPL_TOP = </IOC/path/to/application/top>
|
||||
|
||||
INSTALL_INCLUDE = $(INSTALL_LOCATION)/include/pv
|
||||
USR_INCLUDES += -I $(INSTALL_LOCATION)/include
|
||||
|
||||
-include $(TOP)/../../CONFIG_SITE.local
|
||||
-include $(TOP)/../configure/CONFIG_SITE.local
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
|
||||
# EPICS V4 Developers: Do not edit the locations in this file!
|
||||
#
|
||||
# Create a file RELEASE.local pointing to your PVASRV, PVACCESS,
|
||||
# PVDATA, PVCOMMON and EPICS_BASE build directories, e.g.
|
||||
# PVASRV = /path/to/epics/pvaSrvCPP
|
||||
# Create a file RELEASE.local pointing to your places
|
||||
# for the dependencies, e.g.
|
||||
# PVACCESS = /path/to/epics/pvAccessCPP
|
||||
# PVDATA = /path/to/epics/pvDataCPP
|
||||
# PVCOMMON = /path/to/epics/pvCommonCPP
|
||||
@@ -27,17 +26,17 @@
|
||||
# If this example is built in a directory under pvDatabaseCPP,
|
||||
# use the following definitions:
|
||||
|
||||
PVDATABASETEST = $(TOP)/../testTop
|
||||
PVDATABASE = $(TOP)/..
|
||||
|
||||
-include $(TOP)/../configure/RELEASE.local
|
||||
PVDATABASETEST = $(TOP)/../test
|
||||
-include $(TOP)/../../RELEASE.local
|
||||
-include $(TOP)/../configure/RELEASE.local
|
||||
|
||||
# If you copied this example from pvDatabaseCPP to be built as a
|
||||
# standalone TOP, adjust and use the following definitions:
|
||||
|
||||
#PVDATABASETEST = /path/to/epics/pvDatabaseCPP/testTop
|
||||
#PVDATABASE = /path/to/epics/pvDatabaseCPP
|
||||
# standalone TOP, define
|
||||
# PVDATABASE = /path/to/epics/pvDatabaseCPP
|
||||
# PVDATABASETEST = /path/to/epics/pvDatabaseCPP/test
|
||||
# in the appropriate RELEASE[.local],
|
||||
# and use the following definitions instead:
|
||||
|
||||
#-include $(TOP)/../RELEASE.local
|
||||
#-include $(TOP)/configure/RELEASE.local
|
||||
|
||||
@@ -3,22 +3,26 @@ TOP=../..
|
||||
include $(TOP)/configure/CONFIG
|
||||
#----------------------------------------
|
||||
# ADD MACRO DEFINITIONS AFTER THIS LINE
|
||||
#=============================
|
||||
|
||||
#==================================================
|
||||
# Build an IOC support library
|
||||
#
|
||||
|
||||
DBD += powerSupply.dbd
|
||||
|
||||
powerSupply_DBD += base.dbd
|
||||
powerSupply_DBD += PVAServerRegister.dbd
|
||||
powerSupply_DBD += registerChannelProviderLocal.dbd
|
||||
powerSupply_DBD += dbPv.dbd
|
||||
powerSupply_DBD += powerSupplyRegister.dbd
|
||||
#=============================
|
||||
# build an ioc application
|
||||
|
||||
PROD_IOC += powerSupply
|
||||
|
||||
|
||||
# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
|
||||
powerSupply_SRCS += powerSupply_registerRecordDeviceDriver.cpp
|
||||
powerSupply_SRCS_DEFAULT += powerSupplyMain.cpp
|
||||
powerSupply_SRCS_vxWorks += -nil-
|
||||
|
||||
|
||||
# The following adds support from base/src/vxWorks
|
||||
powerSupply_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary
|
||||
|
||||
|
||||
5
examplePowerSupply/ioc/src/powerSupplyInclude.dbd
Normal file
5
examplePowerSupply/ioc/src/powerSupplyInclude.dbd
Normal file
@@ -0,0 +1,5 @@
|
||||
include "base.dbd"
|
||||
include "PVAServerRegister.dbd"
|
||||
include "registerChannelProviderLocal.dbd"
|
||||
include "dbPv.dbd"
|
||||
include "powerSupplyRegister.dbd"
|
||||
@@ -3,5 +3,5 @@ include $(TOP)/configure/CONFIG
|
||||
DIRS += $(wildcard *ioc*)
|
||||
DIRS += $(wildcard as*)
|
||||
DIRS += $(wildcard power*)
|
||||
include $(EPICS_BASE)/configure/RULES_DIRS
|
||||
include $(CONFIG)/RULES_DIRS
|
||||
|
||||
|
||||
@@ -3,14 +3,21 @@ TOP=..
|
||||
include $(TOP)/configure/CONFIG
|
||||
#----------------------------------------
|
||||
# ADD MACRO DEFINITIONS AFTER THIS LINE
|
||||
#=============================
|
||||
|
||||
#==================================================
|
||||
# Build an IOC support library
|
||||
#
|
||||
|
||||
|
||||
PROD_HOST += powerSupplyMain
|
||||
powerSupplyMain_SRCS += powerSupplyMain.cpp
|
||||
powerSupplyMain_LIBS += powerSupply
|
||||
|
||||
powerSupplyMain_LIBS += pvDatabase
|
||||
powerSupplyMain_LIBS += pvAccess
|
||||
powerSupplyMain_LIBS += pvData
|
||||
powerSupplyMain_LIBS += Com
|
||||
powerSupplyMain_LIBS += powerSupply
|
||||
|
||||
#===========================
|
||||
|
||||
|
||||
@@ -10,24 +10,15 @@
|
||||
|
||||
/* Author: Marty Kraimer */
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
|
||||
#include <pv/standardField.h>
|
||||
#include <pv/standardPVField.h>
|
||||
#include <pv/recordList.h>
|
||||
#include <pv/powerSupply.h>
|
||||
#include <pv/traceRecord.h>
|
||||
#include <pv/channelProviderLocal.h>
|
||||
#include <pv/serverContext.h>
|
||||
|
||||
#include <powerSupply.h>
|
||||
|
||||
using namespace std;
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::pvDatabase;
|
||||
@@ -36,34 +27,30 @@ using namespace epics::pvDatabase;
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
PVDatabasePtr master = PVDatabase::getMaster();
|
||||
ChannelProviderLocalPtr channelProvider = getChannelProviderLocal();
|
||||
|
||||
PVRecordPtr pvRecord;
|
||||
bool result(false);
|
||||
String recordName;
|
||||
bool result = false;
|
||||
string recordName;
|
||||
|
||||
recordName = "powerSupply";
|
||||
PVStructurePtr pv = createPowerSupply();
|
||||
pvRecord = PowerSupply::create(recordName,pv);
|
||||
result = master->addRecord(pvRecord);
|
||||
cout << "result of addRecord " << recordName << " " << result << endl;
|
||||
|
||||
recordName = "traceRecordPGRPC";
|
||||
pvRecord = TraceRecord::create(recordName);
|
||||
result = master->addRecord(pvRecord);
|
||||
if(!result) cout<< "record " << recordName << " not added" << endl;
|
||||
pvRecord.reset();
|
||||
ServerContext::shared_pointer pvaServer =
|
||||
startPVAServer(PVACCESS_ALL_PROVIDERS,0,true,true);
|
||||
cout << "powerSupply\n";
|
||||
string str;
|
||||
while(true) {
|
||||
cout << "Type exit to stop: \n";
|
||||
getline(cin,str);
|
||||
if(str.compare("exit")==0) break;
|
||||
if (!result) cout<< "record " << recordName << " not added" << endl;
|
||||
|
||||
recordName = "laptoprecordListPGRPC";
|
||||
pvRecord = RecordListRecord::create(recordName);
|
||||
result = master->addRecord(pvRecord);
|
||||
if (!result) cout<< "record " << recordName << " not added" << endl;
|
||||
|
||||
ContextLocal::shared_pointer contextLocal = ContextLocal::create();
|
||||
contextLocal->start(true);
|
||||
|
||||
}
|
||||
pvaServer->shutdown();
|
||||
epicsThreadSleep(1.0);
|
||||
pvaServer->destroy();
|
||||
channelProvider->destroy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# Makefile at top of application tree
|
||||
|
||||
#Makefile at top of application tree
|
||||
TOP = .
|
||||
include $(TOP)/configure/CONFIG
|
||||
|
||||
DIRS += configure
|
||||
|
||||
DIRS += src
|
||||
@@ -12,7 +10,6 @@ DIRS += ioc
|
||||
ioc_DEPEND_DIRS = src
|
||||
|
||||
DIRS += iocBoot
|
||||
iocBoot_DEPEND_DIRS = src
|
||||
|
||||
include $(TOP)/configure/RULES_TOP
|
||||
|
||||
|
||||
@@ -14,11 +14,26 @@
|
||||
# Set CHECK_RELEASE to NO to disable checking completely.
|
||||
# Set CHECK_RELEASE to WARN to perform consistency checking but
|
||||
# continue building anyway if conflicts are found.
|
||||
CHECK_RELEASE = WARN
|
||||
#CHECK_RELEASE = YES
|
||||
|
||||
# Set this when you only want to compile this application
|
||||
# for a subset of the cross-compiled target architectures
|
||||
# that Base is built for.
|
||||
#CROSS_COMPILER_TARGET_ARCHS = vxWorks-68040
|
||||
|
||||
# To install files into a location other than $(TOP) define
|
||||
# INSTALL_LOCATION here.
|
||||
#INSTALL_LOCATION=</path/name/to/install/top>
|
||||
|
||||
-include $(TOP)/../configure/CONFIG_SITE.local
|
||||
# Set this when your IOC and the host use different paths
|
||||
# to access the application. This will be needed to boot
|
||||
# from a Microsoft FTP server or with some NFS mounts.
|
||||
# You must rebuild in the iocBoot directory for this to
|
||||
# take effect.
|
||||
#IOCS_APPL_TOP = </IOC/path/to/application/top>
|
||||
|
||||
INSTALL_INCLUDE = $(INSTALL_LOCATION)/include/pv
|
||||
USR_INCLUDES += -I $(INSTALL_LOCATION)/include
|
||||
|
||||
-include $(TOP)/../../CONFIG_SITE.local
|
||||
-include $(TOP)/../configure/CONFIG_SITE.local
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
|
||||
# EPICS V4 Developers: Do not edit the locations in this file!
|
||||
#
|
||||
# Create a file RELEASE.local pointing to your PVASRV, PVACCESS,
|
||||
# PVDATA, PVCOMMON and EPICS_BASE build directories, e.g.
|
||||
# PVASRV = /path/to/epics/pvaSrvCPP
|
||||
# Create a file RELEASE.local pointing to your places
|
||||
# for the dependencies, e.g.
|
||||
# PVACCESS = /path/to/epics/pvAccessCPP
|
||||
# PVDATA = /path/to/epics/pvDataCPP
|
||||
# PVCOMMON = /path/to/epics/pvCommonCPP
|
||||
@@ -28,14 +27,14 @@
|
||||
# use the following definitions:
|
||||
|
||||
PVDATABASE = $(TOP)/..
|
||||
|
||||
-include $(TOP)/../configure/RELEASE.local
|
||||
-include $(TOP)/../../RELEASE.local
|
||||
-include $(TOP)/../configure/RELEASE.local
|
||||
|
||||
# If you copied this example from pvDatabaseCPP to be built as a
|
||||
# standalone TOP, adjust and use the following definitions:
|
||||
# standalone TOP, define
|
||||
# PVDATABASE = /path/to/epics/pvDatabaseCPP
|
||||
# in the appropriate RELEASE[.local],
|
||||
# and use the following definitions instead:
|
||||
|
||||
#PVDATABASE = /path/to/epics/pvDatabaseCPP
|
||||
|
||||
#-include $(TOP)/configure/RELEASE.local
|
||||
#-include $(TOP)/../RELEASE.local
|
||||
#-include $(TOP)/configure/RELEASE.local
|
||||
|
||||
@@ -3,22 +3,26 @@ TOP=../..
|
||||
include $(TOP)/configure/CONFIG
|
||||
#----------------------------------------
|
||||
# ADD MACRO DEFINITIONS AFTER THIS LINE
|
||||
#=============================
|
||||
|
||||
#==================================================
|
||||
# Build an IOC support library
|
||||
#
|
||||
|
||||
DBD += exampleServer.dbd
|
||||
|
||||
exampleServer_DBD += base.dbd
|
||||
exampleServer_DBD += PVAServerRegister.dbd
|
||||
exampleServer_DBD += registerChannelProviderLocal.dbd
|
||||
exampleServer_DBD += dbPv.dbd
|
||||
exampleServer_DBD += exampleServerRegister.dbd
|
||||
#=============================
|
||||
# build an ioc application
|
||||
|
||||
PROD_IOC += exampleServer
|
||||
|
||||
|
||||
# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
|
||||
exampleServer_SRCS += exampleServer_registerRecordDeviceDriver.cpp
|
||||
exampleServer_SRCS_DEFAULT += exampleServerMain.cpp
|
||||
exampleServer_SRCS_vxWorks += -nil-
|
||||
|
||||
|
||||
# The following adds support from base/src/vxWorks
|
||||
exampleServer_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary
|
||||
|
||||
|
||||
6
exampleServer/ioc/src/exampleServerInclude.dbd
Normal file
6
exampleServer/ioc/src/exampleServerInclude.dbd
Normal file
@@ -0,0 +1,6 @@
|
||||
include "base.dbd"
|
||||
include "PVAClientRegister.dbd"
|
||||
include "PVAServerRegister.dbd"
|
||||
include "registerChannelProviderLocal.dbd"
|
||||
include "dbPv.dbd"
|
||||
include "exampleServer.dbd"
|
||||
@@ -3,5 +3,5 @@ include $(TOP)/configure/CONFIG
|
||||
DIRS += $(wildcard *ioc*)
|
||||
DIRS += $(wildcard as*)
|
||||
DIRS += $(wildcard example*)
|
||||
include $(EPICS_BASE)/configure/RULES_DIRS
|
||||
include $(CONFIG)/RULES_DIRS
|
||||
|
||||
|
||||
@@ -3,8 +3,14 @@ TOP=..
|
||||
include $(TOP)/configure/CONFIG
|
||||
#----------------------------------------
|
||||
# ADD MACRO DEFINITIONS AFTER THIS LINE
|
||||
#=============================
|
||||
|
||||
DBD += exampleServerRegister.dbd
|
||||
#==================================================
|
||||
# Build an IOC support library
|
||||
#
|
||||
|
||||
|
||||
DBD += exampleServer.dbd
|
||||
|
||||
INC += exampleServer.h
|
||||
|
||||
@@ -14,6 +20,7 @@ exampleServer_SRCS += exampleServerRegister.cpp
|
||||
exampleServer_LIBS += pvDatabase
|
||||
exampleServer_LIBS += pvAccess
|
||||
exampleServer_LIBS += pvData
|
||||
exampleServer_LIBS += Com
|
||||
exampleServer_LIBS += $(EPICS_BASE_IOC_LIBS)
|
||||
|
||||
PROD_HOST += exampleServerMain
|
||||
|
||||
@@ -9,34 +9,36 @@
|
||||
* @date 2013.04.02
|
||||
*/
|
||||
|
||||
#include <pv/standardPVField.h>
|
||||
#include <pv/standardField.h>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <pv/exampleServer.h>
|
||||
|
||||
#include <exampleServer.h>
|
||||
|
||||
namespace epics { namespace exampleServer {
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvDatabase;
|
||||
using std::tr1::static_pointer_cast;
|
||||
using std::string;
|
||||
|
||||
namespace epics { namespace exampleServer {
|
||||
|
||||
|
||||
ExampleServerPtr ExampleServer::create(
|
||||
String const & recordName)
|
||||
string const & recordName)
|
||||
{
|
||||
StandardPVFieldPtr standardPVField = getStandardPVField();
|
||||
StandardFieldPtr standardField = getStandardField();
|
||||
FieldCreatePtr fieldCreate = getFieldCreate();
|
||||
PVDataCreatePtr pvDataCreate = getPVDataCreate();
|
||||
PVStructurePtr pvArgument = standardPVField->scalar(pvString,"");
|
||||
PVStructurePtr pvResult = standardPVField->scalar(pvString,"timeStamp");
|
||||
StringArray names;
|
||||
names.reserve(2);
|
||||
PVFieldPtrArray fields;
|
||||
fields.reserve(2);
|
||||
names.push_back("argument");
|
||||
fields.push_back(pvArgument);
|
||||
names.push_back("result");
|
||||
fields.push_back(pvResult);
|
||||
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(names,fields);
|
||||
StructureConstPtr topStructure = fieldCreate->createFieldBuilder()->
|
||||
addNestedStructure("argument")->
|
||||
add("value",pvString)->
|
||||
endNested()->
|
||||
addNestedStructure("result") ->
|
||||
add("value",pvString) ->
|
||||
add("timeStamp",standardField->timeStamp()) ->
|
||||
endNested()->
|
||||
createStructure();
|
||||
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(topStructure);
|
||||
|
||||
ExampleServerPtr pvRecord(
|
||||
new ExampleServer(recordName,pvStructure));
|
||||
if(!pvRecord->init()) pvRecord.reset();
|
||||
@@ -44,7 +46,7 @@ ExampleServerPtr ExampleServer::create(
|
||||
}
|
||||
|
||||
ExampleServer::ExampleServer(
|
||||
String const & recordName,
|
||||
string const & recordName,
|
||||
PVStructurePtr const & pvStructure)
|
||||
: PVRecord(recordName,pvStructure)
|
||||
{
|
||||
@@ -64,9 +66,9 @@ bool ExampleServer::init()
|
||||
|
||||
initPVRecord();
|
||||
PVFieldPtr pvField;
|
||||
pvArgumentValue = getPVStructure()->getStringField("argument.value");
|
||||
pvArgumentValue = getPVStructure()->getSubField<PVString>("argument.value");
|
||||
if(pvArgumentValue.get()==NULL) return false;
|
||||
pvResultValue = getPVStructure()->getStringField("result.value");
|
||||
pvResultValue = getPVStructure()->getSubField<PVString>("result.value");
|
||||
if(pvResultValue.get()==NULL) return false;
|
||||
pvTimeStamp.attach(getPVStructure()->getSubField("result.timeStamp"));
|
||||
return true;
|
||||
@@ -74,7 +76,7 @@ bool ExampleServer::init()
|
||||
|
||||
void ExampleServer::process()
|
||||
{
|
||||
pvResultValue->put(String("Hello ") + pvArgumentValue->get());
|
||||
pvResultValue->put(string("Hello ") + pvArgumentValue->get());
|
||||
timeStamp.getCurrent();
|
||||
pvTimeStamp.set(timeStamp);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# undef epicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <shareLib.h>
|
||||
#include <pv/pvDatabase.h>
|
||||
#include <pv/timeStamp.h>
|
||||
#include <pv/pvTimeStamp.h>
|
||||
@@ -24,9 +23,10 @@
|
||||
#ifdef exampleServerEpicsExportSharedSymbols
|
||||
# define epicsExportSharedSymbols
|
||||
# undef exampleServerEpicsExportSharedSymbols
|
||||
# include <shareLib.h>
|
||||
#endif
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
|
||||
namespace epics { namespace exampleServer {
|
||||
|
||||
@@ -40,13 +40,13 @@ class epicsShareClass ExampleServer :
|
||||
public:
|
||||
POINTER_DEFINITIONS(ExampleServer);
|
||||
static ExampleServerPtr create(
|
||||
epics::pvData::String const & recordName);
|
||||
std::string const & recordName);
|
||||
virtual ~ExampleServer();
|
||||
virtual void destroy();
|
||||
virtual bool init();
|
||||
virtual void process();
|
||||
private:
|
||||
ExampleServer(epics::pvData::String const & recordName,
|
||||
ExampleServer(std::string const & recordName,
|
||||
epics::pvData::PVStructurePtr const & pvStructure);
|
||||
|
||||
epics::pvData::PVStringPtr pvArgumentValue;
|
||||
|
||||
1
exampleServer/src/exampleServerInclude.dbd
Normal file
1
exampleServer/src/exampleServerInclude.dbd
Normal file
@@ -0,0 +1 @@
|
||||
registrar("exampleServerRegister")
|
||||
@@ -10,24 +10,15 @@
|
||||
|
||||
/* Author: Marty Kraimer */
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
|
||||
#include <pv/standardField.h>
|
||||
#include <pv/standardPVField.h>
|
||||
#include <pv/exampleServer.h>
|
||||
#include <pv/traceRecord.h>
|
||||
#include <pv/recordList.h>
|
||||
#include <pv/channelProviderLocal.h>
|
||||
#include <pv/serverContext.h>
|
||||
|
||||
#include <exampleServer.h>
|
||||
|
||||
using namespace std;
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::pvDatabase;
|
||||
@@ -36,33 +27,35 @@ using namespace epics::exampleServer;
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
PVDatabasePtr master = PVDatabase::getMaster();
|
||||
ChannelProviderLocalPtr channelProvider = getChannelProviderLocal();
|
||||
PVRecordPtr pvRecord;
|
||||
bool result(false);
|
||||
String recordName;
|
||||
bool result = false;
|
||||
string recordName;
|
||||
|
||||
recordName = "exampleServer";
|
||||
pvRecord = ExampleServer::create(recordName);
|
||||
result = master->addRecord(pvRecord);
|
||||
cout << "result of addRecord " << recordName << " " << result << endl;
|
||||
if(!result) cout<< "record " << recordName << " not added" << endl;
|
||||
|
||||
recordName = "traceRecordPGRPC";
|
||||
pvRecord = TraceRecord::create(recordName);
|
||||
result = master->addRecord(pvRecord);
|
||||
if(!result) cout<< "record " << recordName << " not added" << endl;
|
||||
pvRecord.reset();
|
||||
ServerContext::shared_pointer pvaServer =
|
||||
startPVAServer(PVACCESS_ALL_PROVIDERS,0,true,true);
|
||||
cout << "exampleServer\n";
|
||||
string str;
|
||||
while(true) {
|
||||
cout << "Type exit to stop: \n";
|
||||
getline(cin,str);
|
||||
if(str.compare("exit")==0) break;
|
||||
|
||||
}
|
||||
pvaServer->shutdown();
|
||||
epicsThreadSleep(1.0);
|
||||
pvaServer->destroy();
|
||||
channelProvider->destroy();
|
||||
recordName = "laptoprecordListPGRPC";
|
||||
pvRecord = RecordListRecord::create(recordName);
|
||||
result = master->addRecord(pvRecord);
|
||||
if(!result) cout<< "record " << recordName << " not added" << endl;
|
||||
|
||||
|
||||
ContextLocal::shared_pointer contextLocal = ContextLocal::create();
|
||||
contextLocal->start();
|
||||
|
||||
PVStringArrayPtr pvNames = master->getRecordNames();
|
||||
shared_vector<const string> names = pvNames->view();
|
||||
for(size_t i=0; i<names.size(); ++i) cout << names[i] << endl;
|
||||
|
||||
contextLocal->waitForExit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
#include <pv/pvData.h>
|
||||
#include <pv/pvAccess.h>
|
||||
#include <pv/pvDatabase.h>
|
||||
#include <pv/recordList.h>
|
||||
|
||||
#include <epicsExport.h>
|
||||
|
||||
#include <exampleServer.h>
|
||||
#include <pv/exampleServer.h>
|
||||
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
@@ -51,10 +51,19 @@ static const iocshFuncDef exampleServerFuncDef = {
|
||||
"exampleServerCreateRecord", 1, testArgs};
|
||||
static void exampleServerCallFunc(const iocshArgBuf *args)
|
||||
{
|
||||
PVDatabasePtr master = PVDatabase::getMaster();
|
||||
char *recordName = args[0].sval;
|
||||
ExampleServerPtr record = ExampleServer::create(recordName);
|
||||
bool result = PVDatabase::getMaster()->addRecord(record);
|
||||
bool result = master->addRecord(record);
|
||||
if(!result) cout << "recordname" << " not added" << endl;
|
||||
PVRecordPtr pvRecord = RecordListRecord::create(
|
||||
"laptoprecordListPGRPC");
|
||||
if(!pvRecord) {
|
||||
cout << "RecordListRecord::create failed" << endl;
|
||||
} else {
|
||||
result = master->addRecord(pvRecord);
|
||||
if(!result) cout<< "record " << recordName << " not added" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
static void exampleServerRegister(void)
|
||||
|
||||
@@ -1,13 +1,28 @@
|
||||
# pvDatabaseCPP
|
||||
# pvDatabase C++ implementation
|
||||
# Jenkins @ Cloudbees build script
|
||||
#
|
||||
# Jenkins invokes scripts with the "-ex" option. So the build is considered a failure
|
||||
# if any of the commands exits with a non-zero exit code.
|
||||
#
|
||||
# Author: Ralph Lange <Ralph.Lange@gmx.de>
|
||||
# Author: Ralph Lange <ralph.lange@gmx.de>
|
||||
# Copyright (C) 2014 Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
|
||||
# Copyright (C) 2014-2015 ITER Organization.
|
||||
# All rights reserved. Use is subject to license terms.
|
||||
|
||||
###########################################
|
||||
# Determine EPICS Base version
|
||||
|
||||
DEFAULT_BASE=3.14.12.5
|
||||
|
||||
BASE=${1:-${DEFAULT_BASE}}
|
||||
USE_MB=${2:-"MB_NO"}
|
||||
|
||||
# Dependent module branches (empty = master)
|
||||
PVCOMMON_BRANCH="Release-4.1-"
|
||||
PVDATA_BRANCH="Release-5.0-"
|
||||
PVACCESS_BRANCH="Release-4.1-"
|
||||
PVASRV_BRANCH="Release-0.11-"
|
||||
|
||||
###########################################
|
||||
# Fetch and unpack dependencies
|
||||
|
||||
@@ -17,17 +32,20 @@ rm -fr ${STUFF}
|
||||
mkdir -p ${STUFF}
|
||||
cd ${STUFF}
|
||||
|
||||
wget -nv https://openepics.ci.cloudbees.com/job/Base-3.14.12.3_Build/lastSuccessfulBuild/artifact/baseR3.14.12.3.CB-dist.tar.gz
|
||||
wget -nv https://openepics.ci.cloudbees.com/job/Doxygen-1.8.3_Build/lastSuccessfulBuild/artifact/doxygen-1.8.3.CB-dist.tar.gz
|
||||
wget -nv https://openepics.ci.cloudbees.com/job/pvData_CPP_Build/lastSuccessfulBuild/artifact/pvData.CB-dist.tar.gz
|
||||
wget -nv https://openepics.ci.cloudbees.com/job/pvAccess_CPP_Build/lastSuccessfulBuild/artifact/pvAccess.CB-dist.tar.gz
|
||||
wget -nv https://openepics.ci.cloudbees.com/job/pvaSrv_CPP_Build/lastSuccessfulBuild/artifact/pvaSrv.CB-dist.tar.gz
|
||||
tar -xzf baseR3.14.12.3.CB-dist.tar.gz
|
||||
tar -xzf doxygen-1.8.3.CB-dist.tar.gz
|
||||
wget -nv https://openepics.ci.cloudbees.com/job/Base-${BASE}_Build/lastSuccessfulBuild/artifact/base-${BASE}.CB-dist.tar.gz
|
||||
wget -nv https://openepics.ci.cloudbees.com/job/pvDataCPP_${PVDATA_BRANCH}Build/BASE=${BASE},USE_MB=MB_NO/lastSuccessfulBuild/artifact/pvData.CB-dist.tar.gz
|
||||
wget -nv https://openepics.ci.cloudbees.com/job/pvAccessCPP_${PVACCESS_BRANCH}Build/BASE=${BASE},USE_MB=${USE_MB}/lastSuccessfulBuild/artifact/pvAccess.CB-dist.tar.gz
|
||||
wget -nv https://openepics.ci.cloudbees.com/job/pvaSrvCPP_${PVASRV_BRANCH}Build/BASE=${BASE},USE_MB=MB_NO/lastSuccessfulBuild/artifact/pvaSrv.CB-dist.tar.gz
|
||||
tar -xzf base-${BASE}.CB-dist.tar.gz
|
||||
tar -xzf pvData.CB-dist.tar.gz
|
||||
tar -xzf pvAccess.CB-dist.tar.gz
|
||||
tar -xzf pvaSrv.CB-dist.tar.gz
|
||||
|
||||
if [ "${USE_MB}" = "MB_YES" ]; then
|
||||
wget -nv https://openepics.ci.cloudbees.com/job/pvCommonCPP_${PVCOMMON_BRANCH}Build/BASE=${BASE},USE_MB=MB_YES/lastSuccessfulBuild/artifact/pvCommon.CB-dist.tar.gz
|
||||
tar -xzf pvCommon.CB-dist.tar.gz
|
||||
fi
|
||||
|
||||
###########################################
|
||||
# Build
|
||||
|
||||
@@ -43,7 +61,6 @@ EPICS_BASE=${EPICS_BASE}
|
||||
EOF
|
||||
|
||||
make distclean all
|
||||
doxygen
|
||||
|
||||
###########################################
|
||||
# Test
|
||||
@@ -53,9 +70,4 @@ doxygen
|
||||
###########################################
|
||||
# Create distribution
|
||||
|
||||
tar -czf pvDatabaseCPP.CB-dist.tar.gz lib include dbd COPYRIGHT LICENSE
|
||||
|
||||
###########################################
|
||||
# Publish documentation
|
||||
|
||||
rsync -aP --delete -e ssh documentation epics-jenkins@web.sourceforge.net:/home/project-web/epics-pvdata/htdocs/docbuild/pvDatabaseCPP/tip
|
||||
tar -czf pvDatabase.CB-dist.tar.gz lib include dbd COPYRIGHT LICENSE
|
||||
|
||||
46
jenkins/cloudbees_doc
Normal file
46
jenkins/cloudbees_doc
Normal file
@@ -0,0 +1,46 @@
|
||||
# pvDatabase C++ implementation
|
||||
# Jenkins @ Cloudbees documentation generation and deployment
|
||||
#
|
||||
# Jenkins invokes scripts with the "-ex" option. So the build is considered a failure
|
||||
# if any of the commands exits with a non-zero exit code.
|
||||
#
|
||||
# Author: Ralph Lange <ralph.lange@gmx.de>
|
||||
# Copyright (C) 2014 Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
|
||||
# Copyright (C) 2014-2015 ITER Organization.
|
||||
# All rights reserved. Use is subject to license terms.
|
||||
|
||||
###########################################
|
||||
# Determine EPICS Base version
|
||||
|
||||
DEFAULT_BASE=3.14.12.5
|
||||
|
||||
BASE=${1:-${DEFAULT_BASE}}
|
||||
|
||||
###########################################
|
||||
# Fetch and unpack dependencies
|
||||
|
||||
export STUFF=/tmp/stuff
|
||||
|
||||
rm -fr ${STUFF}
|
||||
mkdir -p ${STUFF}
|
||||
cd ${STUFF}
|
||||
|
||||
wget -nv https://openepics.ci.cloudbees.com/job/Doxygen-1.8.3_Build/lastSuccessfulBuild/artifact/doxygen-1.8.3.CB-dist.tar.gz
|
||||
tar -xzf doxygen-1.8.3.CB-dist.tar.gz
|
||||
|
||||
###########################################
|
||||
# Generate
|
||||
|
||||
cd ${WORKSPACE}
|
||||
|
||||
wget -nv https://openepics.ci.cloudbees.com/job/pvDatabaseCPP_Build/BASE=${BASE},USE_MB=MB_NO/lastSuccessfulBuild/artifact/pvDatabase.CB-dist.tar.gz
|
||||
tar -xzf pvDatabase.CB-dist.tar.gz
|
||||
|
||||
export PATH=${STUFF}/bin:${PATH}
|
||||
|
||||
doxygen
|
||||
|
||||
###########################################
|
||||
# Publish
|
||||
|
||||
rsync -aqP --delete -e ssh documentation epics-jenkins@web.sourceforge.net:/home/project-web/epics-pvdata/htdocs/docbuild/pvDatabaseCPP/tip
|
||||
@@ -1,20 +0,0 @@
|
||||
# pvDatabaseCPP
|
||||
# Jenkins @ Cloudbees hgweb sync script
|
||||
#
|
||||
# Jenkins invokes scripts with the "-ex" option. So the build is considered a failure
|
||||
# if any of the commands exits with a non-zero exit code.
|
||||
#
|
||||
# Author: Ralph Lange <Ralph.Lange@gmx.de>
|
||||
# Copyright (C) 2014 Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
|
||||
# All rights reserved. Use is subject to license terms.
|
||||
|
||||
###########################################
|
||||
# Fetch complete repo
|
||||
|
||||
rm -fr hgweb
|
||||
hg clone -U http://hg.code.sf.net/p/epics-pvdata/pvDatabaseCPP hgweb
|
||||
|
||||
###########################################
|
||||
# Sync into SF webspace
|
||||
|
||||
rsync -aqP --delete --exclude=\.hg/hgrc -e ssh hgweb/.hg epics-jenkins@web.sourceforge.net:/home/project-web/epics-pvdata/repos/pvDatabaseCPP
|
||||
@@ -1 +0,0 @@
|
||||
// ADD PREDEFINED MACROS HERE!
|
||||
@@ -1 +0,0 @@
|
||||
[General]
|
||||
@@ -1,54 +0,0 @@
|
||||
arrayPerformance/src/arrayPerformance.cpp
|
||||
arrayPerformance/src/arrayPerformance.h
|
||||
arrayPerformance/src/arrayPerformanceMain.cpp
|
||||
arrayPerformance/src/longArrayGet.cpp
|
||||
arrayPerformance/src/longArrayGet.h
|
||||
arrayPerformance/src/longArrayGetMain.cpp
|
||||
arrayPerformance/src/longArrayMonitor.cpp
|
||||
arrayPerformance/src/longArrayMonitor.h
|
||||
arrayPerformance/src/longArrayMonitorMain.cpp
|
||||
arrayPerformance/src/longArrayPut.cpp
|
||||
arrayPerformance/src/longArrayPut.h
|
||||
arrayPerformance/src/longArrayPutMain.cpp
|
||||
arrayPerformance/src/vectorPerformanceMain.cpp
|
||||
exampleDatabase/ioc/src/O.linux-x86_64/exampleDatabase_registerRecordDeviceDriver.cpp
|
||||
exampleDatabase/ioc/src/exampleDatabaseMain.cpp
|
||||
exampleDatabase/src/exampleDatabase.cpp
|
||||
exampleDatabase/src/exampleDatabase.h
|
||||
exampleDatabase/src/exampleDatabaseMain.cpp
|
||||
exampleDatabase/src/exampleDatabaseRegister.cpp
|
||||
exampleLink/ioc/src/O.linux-x86_64/exampleLink_registerRecordDeviceDriver.cpp
|
||||
exampleLink/ioc/src/exampleLinkMain.cpp
|
||||
exampleLink/src/exampleLink.cpp
|
||||
exampleLink/src/exampleLink.h
|
||||
exampleLink/src/exampleLinkRegister.cpp
|
||||
examplePowerSupply/ioc/src/O.linux-x86_64/powerSupply_registerRecordDeviceDriver.cpp
|
||||
examplePowerSupply/ioc/src/powerSupplyMain.cpp
|
||||
examplePowerSupply/src/powerSupplyMain.cpp
|
||||
exampleServer/ioc/src/O.linux-x86_64/exampleServer_registerRecordDeviceDriver.cpp
|
||||
exampleServer/ioc/src/exampleServerMain.cpp
|
||||
exampleServer/src/exampleServer.cpp
|
||||
exampleServer/src/exampleServer.h
|
||||
exampleServer/src/exampleServerMain.cpp
|
||||
exampleServer/src/exampleServerRegister.cpp
|
||||
src/database/pvDatabase.cpp
|
||||
src/database/pvDatabase.h
|
||||
src/database/pvRecord.cpp
|
||||
src/pvAccess/channelLocal.cpp
|
||||
src/pvAccess/channelProviderLocal.cpp
|
||||
src/pvAccess/channelProviderLocal.h
|
||||
src/pvAccess/monitorAlgorithm.h
|
||||
src/pvAccess/monitorFactory.cpp
|
||||
src/pvAccess/pvCopy.cpp
|
||||
src/pvAccess/pvCopy.h
|
||||
src/pvAccess/registerChannelProviderLocal.cpp
|
||||
src/special/recordList.cpp
|
||||
src/special/recordList.h
|
||||
src/special/traceRecord.cpp
|
||||
src/special/traceRecord.h
|
||||
test/src/powerSupply.cpp
|
||||
test/src/powerSupply.h
|
||||
test/src/powerSupplyRegister.cpp
|
||||
test/src/testExampleRecord.cpp
|
||||
test/src/testPVCopy.cpp
|
||||
test/src/testPVRecord.cpp
|
||||
@@ -1,8 +0,0 @@
|
||||
arrayPerformance/src
|
||||
exampleDatabase/src
|
||||
exampleLink/src
|
||||
exampleServer/src
|
||||
src/database
|
||||
src/pvAccess
|
||||
src/special
|
||||
test/src
|
||||
@@ -3,9 +3,6 @@
|
||||
TOP = ..
|
||||
include $(TOP)/configure/CONFIG
|
||||
|
||||
INSTALL_INCLUDE = $(INSTALL_LOCATION)/include/pv
|
||||
USR_INCLUDES += -I$(INSTALL_LOCATION)/include
|
||||
|
||||
PVDATABASE_SRC = $(TOP)/src
|
||||
|
||||
LIBRARY += pvDatabase
|
||||
|
||||
@@ -70,7 +70,7 @@ void PVDatabase::unlock() {
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
PVRecordPtr PVDatabase::findRecord(String const& recordName)
|
||||
PVRecordPtr PVDatabase::findRecord(string const& recordName)
|
||||
{
|
||||
lock();
|
||||
try {
|
||||
@@ -104,13 +104,13 @@ PVStringArrayPtr PVDatabase::getRecordNames()
|
||||
PVStringArrayPtr pvStringArray = static_pointer_cast<PVStringArray>
|
||||
(getPVDataCreate()->createPVScalarArray(pvString));
|
||||
size_t len = recordMap.size();
|
||||
shared_vector<String> names(len);
|
||||
shared_vector<string> names(len);
|
||||
PVRecordMap::iterator iter;
|
||||
size_t i = 0;
|
||||
for(iter = recordMap.begin(); iter!=recordMap.end(); ++iter) {
|
||||
names[i++] = (*iter).first;
|
||||
}
|
||||
shared_vector<const String> temp(freeze(names));
|
||||
shared_vector<const string> temp(freeze(names));
|
||||
pvStringArray->replace(temp);
|
||||
unlock();
|
||||
return pvStringArray;
|
||||
@@ -128,7 +128,7 @@ bool PVDatabase::addRecord(PVRecordPtr const & record)
|
||||
unlock();
|
||||
return false;
|
||||
}
|
||||
String recordName = record->getRecordName();
|
||||
string recordName = record->getRecordName();
|
||||
PVRecordMap::iterator iter = recordMap.find(recordName);
|
||||
if(iter!=recordMap.end()) {
|
||||
unlock();
|
||||
@@ -152,7 +152,7 @@ bool PVDatabase::removeRecord(PVRecordPtr const & record)
|
||||
unlock();
|
||||
return false;
|
||||
}
|
||||
String recordName = record->getRecordName();
|
||||
string recordName = record->getRecordName();
|
||||
PVRecordMap::iterator iter = recordMap.find(recordName);
|
||||
if(iter!=recordMap.end()) {
|
||||
PVRecordPtr pvRecord = (*iter).second;
|
||||
|
||||
@@ -21,21 +21,22 @@
|
||||
#include <deque>
|
||||
|
||||
#include <pv/pvData.h>
|
||||
|
||||
#include <pv/convert.h>
|
||||
#include <pv/pvCopy.h>
|
||||
#include <pv/pvTimeStamp.h>
|
||||
|
||||
#ifdef pvdatabaseEpicsExportSharedSymbols
|
||||
# define epicsExportSharedSymbols
|
||||
# undef pvdatabaseEpicsExportSharedSymbols
|
||||
# include <shareLib.h>
|
||||
#endif
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
|
||||
namespace epics { namespace pvDatabase {
|
||||
|
||||
class PVRecord;
|
||||
typedef std::tr1::shared_ptr<PVRecord> PVRecordPtr;
|
||||
typedef std::map<epics::pvData::String,PVRecordPtr> PVRecordMap;
|
||||
typedef std::map<std::string,PVRecordPtr> PVRecordMap;
|
||||
|
||||
class PVRecordField;
|
||||
typedef std::tr1::shared_ptr<PVRecordField> PVRecordFieldPtr;
|
||||
@@ -55,10 +56,12 @@ class PVDatabase;
|
||||
typedef std::tr1::shared_ptr<PVDatabase> PVDatabasePtr;
|
||||
|
||||
/**
|
||||
* Base interface for a record.
|
||||
* @brief Base interface for a record.
|
||||
*
|
||||
* @author mrk
|
||||
*/
|
||||
class epicsShareClass PVRecord :
|
||||
public epics::pvData::PVCopyTraverseMasterCallback,
|
||||
public std::tr1::enable_shared_from_this<PVRecord>
|
||||
{
|
||||
public:
|
||||
@@ -77,12 +80,12 @@ public:
|
||||
*/
|
||||
virtual void start() {}
|
||||
/**
|
||||
* Must be implemented by derived classes.
|
||||
* Optional method.
|
||||
* It is the method that makes a record smart.
|
||||
* If it encounters errors it should raise alarms and/or
|
||||
* call the <b>message</b> method provided by the base class.
|
||||
*/
|
||||
virtual void process() {}
|
||||
virtual void process();
|
||||
/**
|
||||
* Destroy the PVRecord. Release any resources used and
|
||||
* get rid of listeners and requesters.
|
||||
@@ -97,7 +100,7 @@ public:
|
||||
* @return A shared pointer to the newly created record.
|
||||
*/
|
||||
static PVRecordPtr create(
|
||||
epics::pvData::String const & recordName,
|
||||
std::string const & recordName,
|
||||
epics::pvData::PVStructurePtr const & pvStructure);
|
||||
/**
|
||||
* The Destructor. Must be virtual.
|
||||
@@ -107,12 +110,12 @@ public:
|
||||
* Get the name of the record.
|
||||
* @return The name.
|
||||
*/
|
||||
epics::pvData::String getRecordName();
|
||||
std::string getRecordName() const;
|
||||
/**
|
||||
* Get the top level PVStructure.
|
||||
* @return The shared pointer.
|
||||
*/
|
||||
PVRecordStructurePtr getPVRecordStructure();
|
||||
PVRecordStructurePtr getPVRecordStructure() const;
|
||||
/**
|
||||
* Find the PVRecordField for the PVField.
|
||||
* @param pvField The PVField.
|
||||
@@ -166,15 +169,26 @@ public:
|
||||
* Add a PVListener.
|
||||
* This must be called before calling pvRecordField.addListener.
|
||||
* @param pvListener The listener.
|
||||
* @param pvCopy The pvStructure that has the client fields.
|
||||
* @return <b>true</b> if the listener was added.
|
||||
*/
|
||||
bool addListener(PVListenerPtr const & pvListener);
|
||||
bool addListener(
|
||||
PVListenerPtr const & pvListener,
|
||||
epics::pvData::PVCopyPtr const & pvCopy);
|
||||
/*
|
||||
* PVCopyTraverseMasterCallback method
|
||||
* @param pvField The next client field.
|
||||
*/
|
||||
void nextMasterPVField(epics::pvData::PVFieldPtr const & pvField);
|
||||
/**
|
||||
* Remove a listener.
|
||||
* @param pvListener The listener.
|
||||
* @param pvCopy The pvStructure that has the client fields.
|
||||
* @return <b>true</b> if the listener was removed.
|
||||
*/
|
||||
bool removeListener(PVListenerPtr const & pvListener);
|
||||
bool removeListener(
|
||||
PVListenerPtr const & pvListener,
|
||||
epics::pvData::PVCopyPtr const & pvCopy);
|
||||
/**
|
||||
* Begins a group of puts.
|
||||
*/
|
||||
@@ -183,17 +197,6 @@ public:
|
||||
* Ends a group of puts.
|
||||
*/
|
||||
void endGroupPut();
|
||||
/**
|
||||
* Calls the next method with indentLevel = 0.
|
||||
* @param buf String Builder.
|
||||
*/
|
||||
void toString(epics::pvData::StringBuilder buf);
|
||||
/**
|
||||
* Dumps the data from the top level PVStructure.
|
||||
* @param buf String Builder.
|
||||
* @param indentLevel The indentation level.
|
||||
*/
|
||||
void toString(epics::pvData::StringBuilder buf,int indentLevel);
|
||||
/**
|
||||
* get trace level (0,1,2) means (nothing,lifetime,process)
|
||||
* @return the level
|
||||
@@ -211,7 +214,7 @@ protected:
|
||||
* @param pvStructure The top level PVStructutre
|
||||
*/
|
||||
PVRecord(
|
||||
epics::pvData::String const & recordName,
|
||||
std::string const & recordName,
|
||||
epics::pvData::PVStructurePtr const & pvStructure);
|
||||
/**
|
||||
* Initializes the base class. Must be called by derived classes.
|
||||
@@ -230,9 +233,9 @@ private:
|
||||
PVRecordFieldPtr findPVRecordField(
|
||||
PVRecordStructurePtr const & pvrs,
|
||||
epics::pvData::PVFieldPtr const & pvField);
|
||||
epics::pvData::String recordName;
|
||||
|
||||
std::string recordName;
|
||||
epics::pvData::PVStructurePtr pvStructure;
|
||||
epics::pvData::ConvertPtr convert;
|
||||
PVRecordStructurePtr pvRecordStructure;
|
||||
std::list<PVListenerPtr> pvListenerList;
|
||||
std::list<PVRecordClientPtr> pvRecordClientList;
|
||||
@@ -240,10 +243,20 @@ private:
|
||||
std::size_t depthGroupPut;
|
||||
int traceLevel;
|
||||
bool isDestroyed;
|
||||
|
||||
epics::pvData::PVTimeStamp pvTimeStamp;
|
||||
epics::pvData::TimeStamp timeStamp;
|
||||
|
||||
// following only valid while addListener or removeListener is active.
|
||||
bool isAddListener;
|
||||
PVListenerPtr pvListener;
|
||||
};
|
||||
|
||||
epicsShareExtern std::ostream& operator<<(std::ostream& o, const PVRecord& record);
|
||||
|
||||
/**
|
||||
* Interface for a field of a record.
|
||||
* @brief Interface for a field of a record.
|
||||
*
|
||||
* One exists for each field of the top level PVStructure.
|
||||
* @author mrk
|
||||
*/
|
||||
@@ -284,32 +297,17 @@ public:
|
||||
* Get the full name of the field, i.e. field,field,..
|
||||
* @return The full name.
|
||||
*/
|
||||
epics::pvData::String getFullFieldName();
|
||||
std::string getFullFieldName();
|
||||
/**
|
||||
* Get the recordName plus the full name of the field, i.e. recordName.field,field,..
|
||||
* @return The name.
|
||||
*/
|
||||
epics::pvData::String getFullName();
|
||||
std::string getFullName();
|
||||
/**
|
||||
* Returns the PVRecord to which this field belongs.
|
||||
* @return The shared pointer,
|
||||
*/
|
||||
PVRecordPtr getPVRecord();
|
||||
/**
|
||||
* Add A PVListener to this field.
|
||||
* Whenever this field or any subfield if this field is modified the listener will be notified.
|
||||
* PVListener is described below.
|
||||
* Before a listener can call addListener it must first call PVRecord.registerListener.
|
||||
* @param pvListener The listener.
|
||||
* @return <b<true</b> if listener is added.
|
||||
*/
|
||||
bool addListener(PVListenerPtr const & pvListener);
|
||||
/**
|
||||
* Remove a listener.
|
||||
* @param pvListener The listener.
|
||||
* @return <b<true</b> if listener is removed.
|
||||
*/
|
||||
virtual void removeListener(PVListenerPtr const & pvListener);
|
||||
/**
|
||||
* This is called by the code that implements the data interface.
|
||||
* It is called whenever the put method is called.
|
||||
@@ -324,6 +322,8 @@ protected:
|
||||
virtual void postParent(PVRecordFieldPtr const & subField);
|
||||
virtual void postSubField();
|
||||
private:
|
||||
bool addListener(PVListenerPtr const & pvListener);
|
||||
virtual void removeListener(PVListenerPtr const & pvListener);
|
||||
void callListener();
|
||||
|
||||
std::list<PVListenerPtr> pvListenerList;
|
||||
@@ -331,14 +331,15 @@ private:
|
||||
bool isStructure;
|
||||
PVRecordStructurePtr parent;
|
||||
PVRecordPtr pvRecord;
|
||||
epics::pvData::String fullName;
|
||||
epics::pvData::String fullFieldName;
|
||||
std::string fullName;
|
||||
std::string fullFieldName;
|
||||
friend class PVRecordStructure;
|
||||
friend class PVRecord;
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for a field that is a structure.
|
||||
* @brief Interface for a field that is a structure.
|
||||
*
|
||||
* One exists for each structure field of the top level PVStructure.
|
||||
* @author mrk
|
||||
*/
|
||||
@@ -373,11 +374,6 @@ public:
|
||||
* @return The shared pointer.
|
||||
*/
|
||||
epics::pvData::PVStructurePtr getPVStructure();
|
||||
/**
|
||||
* Called by PVRecord::removeListener.
|
||||
* @param pvListener The listener.
|
||||
*/
|
||||
virtual void removeListener(PVListenerPtr const & pvListener);
|
||||
/**
|
||||
* Called by implementation code of PVRecord.
|
||||
*/
|
||||
@@ -388,13 +384,16 @@ protected:
|
||||
*/
|
||||
virtual void init();
|
||||
private:
|
||||
virtual void removeListener(PVListenerPtr const & pvListener);
|
||||
|
||||
epics::pvData::PVStructurePtr pvStructure;
|
||||
PVRecordFieldPtrArrayPtr pvRecordFields;
|
||||
friend class PVRecord;
|
||||
};
|
||||
|
||||
/**
|
||||
* An interface that must be implemented by any code that accesses the record.
|
||||
* @brief An interface implemented by code that accesses the record.
|
||||
*
|
||||
* @author mrk
|
||||
*/
|
||||
class epicsShareClass PVRecordClient {
|
||||
@@ -412,6 +411,8 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Listener for PVRecord::message.
|
||||
*
|
||||
* An interface that is implemented by code that traps calls to PVRecord::message.
|
||||
* @author mrk
|
||||
*/
|
||||
@@ -456,7 +457,8 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* The interface to a database of PVRecords.
|
||||
* @brief The interface for a database of PVRecords.
|
||||
*
|
||||
* @author mrk
|
||||
*/
|
||||
class epicsShareClass PVDatabase {
|
||||
@@ -481,7 +483,7 @@ public:
|
||||
* @param recordName The record to find.
|
||||
* @return The shared pointer.
|
||||
*/
|
||||
PVRecordPtr findRecord(epics::pvData::String const& recordName);
|
||||
PVRecordPtr findRecord(std::string const& recordName);
|
||||
/**
|
||||
* Add a record.
|
||||
* @param The record to add.
|
||||
@@ -511,3 +513,10 @@ private:
|
||||
}}
|
||||
|
||||
#endif /* PVDATABASE_H */
|
||||
|
||||
/** @page Overview Documentation
|
||||
*
|
||||
* <a href = "pvDatabaseCPP.html">pvDatabase.html</a>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ using namespace std;
|
||||
namespace epics { namespace pvDatabase {
|
||||
|
||||
PVRecordPtr PVRecord::create(
|
||||
String const &recordName,
|
||||
string const &recordName,
|
||||
PVStructurePtr const & pvStructure)
|
||||
{
|
||||
PVRecordPtr pvRecord(new PVRecord(recordName,pvStructure));
|
||||
@@ -35,14 +35,14 @@ PVRecordPtr PVRecord::create(
|
||||
|
||||
|
||||
PVRecord::PVRecord(
|
||||
String const & recordName,
|
||||
string const & recordName,
|
||||
PVStructurePtr const & pvStructure)
|
||||
: recordName(recordName),
|
||||
pvStructure(pvStructure),
|
||||
convert(getConvert()),
|
||||
depthGroupPut(0),
|
||||
traceLevel(0),
|
||||
isDestroyed(false)
|
||||
isDestroyed(false),
|
||||
isAddListener(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -59,6 +59,8 @@ void PVRecord::initPVRecord()
|
||||
pvRecordStructure = PVRecordStructurePtr(
|
||||
new PVRecordStructure(pvStructure,parent,getPtrSelf()));
|
||||
pvRecordStructure->init();
|
||||
PVFieldPtr pvField = pvStructure->getSubField("timeStamp");
|
||||
if(pvField) pvTimeStamp.attach(pvField);
|
||||
}
|
||||
|
||||
void PVRecord::destroy()
|
||||
@@ -73,6 +75,7 @@ void PVRecord::destroy()
|
||||
return;
|
||||
}
|
||||
isDestroyed = true;
|
||||
pvTimeStamp.detach();
|
||||
|
||||
std::list<PVRecordClientPtr>::iterator clientIter;
|
||||
while(true) {
|
||||
@@ -94,7 +97,6 @@ void PVRecord::destroy()
|
||||
}
|
||||
pvRecordStructure->destroy();
|
||||
pvRecordStructure.reset();
|
||||
convert.reset();
|
||||
pvStructure.reset();
|
||||
unlock();
|
||||
} catch(...) {
|
||||
@@ -103,9 +105,20 @@ void PVRecord::destroy()
|
||||
}
|
||||
}
|
||||
|
||||
String PVRecord::getRecordName() {return recordName;}
|
||||
void PVRecord::process()
|
||||
{
|
||||
if(traceLevel>2) {
|
||||
cout << "PVRecord::process() " << recordName << endl;
|
||||
}
|
||||
if(pvTimeStamp.isAttached()) {
|
||||
timeStamp.getCurrent();
|
||||
pvTimeStamp.set(timeStamp);
|
||||
}
|
||||
}
|
||||
|
||||
PVRecordStructurePtr PVRecord::getPVRecordStructure() {return pvRecordStructure;}
|
||||
string PVRecord::getRecordName() const {return recordName;}
|
||||
|
||||
PVRecordStructurePtr PVRecord::getPVRecordStructure() const {return pvRecordStructure;}
|
||||
|
||||
PVStructurePtr PVRecord::getPVStructure() {return pvStructure;}
|
||||
|
||||
@@ -263,7 +276,9 @@ void PVRecord::detachClients()
|
||||
}
|
||||
}
|
||||
|
||||
bool PVRecord::addListener(PVListenerPtr const & pvListener)
|
||||
bool PVRecord::addListener(
|
||||
PVListenerPtr const & pvListener,
|
||||
PVCopyPtr const & pvCopy)
|
||||
{
|
||||
if(traceLevel>1) {
|
||||
cout << "PVRecord::addListener() " << recordName << endl;
|
||||
@@ -283,6 +298,10 @@ bool PVRecord::addListener(PVListenerPtr const & pvListener)
|
||||
}
|
||||
}
|
||||
pvListenerList.push_back(pvListener);
|
||||
this->pvListener = pvListener;
|
||||
isAddListener = true;
|
||||
pvCopy->traverseMaster(getPtrSelf());
|
||||
this->pvListener = PVListenerPtr();;
|
||||
unlock();
|
||||
return true;
|
||||
} catch(...) {
|
||||
@@ -291,7 +310,19 @@ bool PVRecord::addListener(PVListenerPtr const & pvListener)
|
||||
}
|
||||
}
|
||||
|
||||
bool PVRecord::removeListener(PVListenerPtr const & pvListener)
|
||||
void PVRecord::nextMasterPVField(PVFieldPtr const & pvField)
|
||||
{
|
||||
PVRecordFieldPtr pvRecordField = findPVRecordField(pvField);
|
||||
if(isAddListener) {
|
||||
pvRecordField->addListener(pvListener);
|
||||
} else {
|
||||
pvRecordField->removeListener(pvListener);
|
||||
}
|
||||
}
|
||||
|
||||
bool PVRecord::removeListener(
|
||||
PVListenerPtr const & pvListener,
|
||||
PVCopyPtr const & pvCopy)
|
||||
{
|
||||
if(traceLevel>1) {
|
||||
cout << "PVRecord::removeListener() " << recordName << endl;
|
||||
@@ -307,7 +338,10 @@ bool PVRecord::removeListener(PVListenerPtr const & pvListener)
|
||||
{
|
||||
if((*iter).get()==pvListener.get()) {
|
||||
pvListenerList.erase(iter);
|
||||
pvRecordStructure->removeListener(pvListener);
|
||||
this->pvListener = pvListener;
|
||||
isAddListener = false;
|
||||
pvCopy->traverseMaster(getPtrSelf());
|
||||
this->pvListener = PVListenerPtr();;
|
||||
unlock();
|
||||
return true;
|
||||
}
|
||||
@@ -346,15 +380,14 @@ void PVRecord::endGroupPut()
|
||||
}
|
||||
}
|
||||
|
||||
void PVRecord::toString(StringBuilder buf)
|
||||
std::ostream& operator<<(std::ostream& o, const PVRecord& record)
|
||||
{
|
||||
toString(buf,0);
|
||||
}
|
||||
|
||||
void PVRecord::toString(StringBuilder buf,int indentLevel)
|
||||
{
|
||||
*buf += "\nrecord " + recordName + " ";
|
||||
pvRecordStructure->getPVStructure()->toString(buf, indentLevel);
|
||||
o << format::indent() << "record " << record.getRecordName() << endl;
|
||||
{
|
||||
format::indent_scope s(o);
|
||||
o << *record.getPVRecordStructure()->getPVStructure();
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
PVRecordField::PVRecordField(
|
||||
@@ -372,8 +405,8 @@ void PVRecordField::init()
|
||||
{
|
||||
fullFieldName = pvField->getFieldName();
|
||||
PVRecordStructurePtr pvParent = parent;
|
||||
while(pvParent.get()!= NULL) {
|
||||
String parentName = pvParent->getPVField()->getFieldName();
|
||||
while(pvParent) {
|
||||
string parentName = pvParent->getPVField()->getFieldName();
|
||||
if(parentName.size()>0) {
|
||||
fullFieldName = pvParent->getPVField()->getFieldName()
|
||||
+ '.' + fullFieldName;
|
||||
@@ -404,14 +437,17 @@ PVRecordStructurePtr PVRecordField::getParent() {return parent;}
|
||||
|
||||
PVFieldPtr PVRecordField::getPVField() {return pvField;}
|
||||
|
||||
String PVRecordField::getFullFieldName() {return fullFieldName; }
|
||||
string PVRecordField::getFullFieldName() {return fullFieldName; }
|
||||
|
||||
String PVRecordField::getFullName() {return fullName; }
|
||||
string PVRecordField::getFullName() {return fullName; }
|
||||
|
||||
PVRecordPtr PVRecordField::getPVRecord() {return pvRecord;}
|
||||
|
||||
bool PVRecordField::addListener(PVListenerPtr const & pvListener)
|
||||
{
|
||||
if(pvRecord->getTraceLevel()>1) {
|
||||
cout << "PVRecordField::addListener() " << getFullName() << endl;
|
||||
}
|
||||
std::list<PVListenerPtr>::iterator iter;
|
||||
for (iter = pvListenerList.begin(); iter!=pvListenerList.end(); iter++ ) {
|
||||
if((*iter).get()==pvListener.get()) {
|
||||
@@ -424,6 +460,9 @@ bool PVRecordField::addListener(PVListenerPtr const & pvListener)
|
||||
|
||||
void PVRecordField::removeListener(PVListenerPtr const & pvListener)
|
||||
{
|
||||
if(pvRecord->getTraceLevel()>1) {
|
||||
cout << "PVRecordField::removeListener() " << getFullName() << endl;
|
||||
}
|
||||
std::list<PVListenerPtr>::iterator iter;
|
||||
for (iter = pvListenerList.begin(); iter!=pvListenerList.end(); iter++ ) {
|
||||
if((*iter).get()==pvListener.get()) {
|
||||
@@ -435,7 +474,7 @@ void PVRecordField::removeListener(PVListenerPtr const & pvListener)
|
||||
|
||||
void PVRecordField::postPut()
|
||||
{
|
||||
if(parent!=NULL) {
|
||||
if(parent) {
|
||||
parent->postParent(getPtrSelf());
|
||||
}
|
||||
postSubField();
|
||||
@@ -449,7 +488,7 @@ void PVRecordField::postParent(PVRecordFieldPtr const & subField)
|
||||
{
|
||||
(*iter)->dataPut(pvrs,subField);
|
||||
}
|
||||
if(parent!=NULL) parent->postParent(subField);
|
||||
if(parent) parent->postParent(subField);
|
||||
}
|
||||
|
||||
void PVRecordField::postSubField()
|
||||
|
||||
@@ -3,13 +3,11 @@
|
||||
SRC_DIRS += $(PVDATABASE_SRC)/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 += monitorFactory.cpp
|
||||
LIBSRCS += registerChannelProviderLocal.cpp
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user