diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8b3be2f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
+bin/
+lib/
+doc/
+include/
+db/
+dbd/
+documentation/html
+documentation/*.tag
+envPaths
+configure/*.local
+!configure/ExampleRELEASE.local
+**/O.*
diff --git a/.hgflow b/.hgflow
deleted file mode 100644
index 9a28791..0000000
--- a/.hgflow
+++ /dev/null
@@ -1,8 +0,0 @@
-[branchname]
-master = master
-develop = default
-feature = feature/
-release = release/
-hotfix = hotfix/
-support = support/
-
diff --git a/.hgignore b/.hgignore
deleted file mode 100644
index 20e12e6..0000000
--- a/.hgignore
+++ /dev/null
@@ -1,11 +0,0 @@
-^QtC-
-bin/
-lib/
-doc/
-include/
-db/
-dbd/
-documentation/html
-envPaths
-configure/.*\.local
-/O\..*
diff --git a/README.txt b/README.txt
index e234c21..123cdc6 100644
--- a/README.txt
+++ b/README.txt
@@ -6,4 +6,4 @@ edit RELEASE.local
cd ..
make
-Now read documentation/easyPVA.html
+Now read documentation/pvaClientCPP.html
diff --git a/configure/ExampleRELEASE.local b/configure/ExampleRELEASE.local
index 483ab6e..28a63d1 100644
--- a/configure/ExampleRELEASE.local
+++ b/configure/ExampleRELEASE.local
@@ -2,7 +2,7 @@
TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top
EPICS_BASE=/home/install/epics/base
-V4BASE=/home/hg
+V4BASE=/home/epicsv4
PVCOMMON=${V4BASE}/pvCommonCPP
PVDATA=${V4BASE}/pvDataCPP
NORMATIVETYPES=${V4BASE}/normativeTypesCPP
diff --git a/documentation/easyPVA.html b/documentation/easyPVA_20150609.html
similarity index 97%
rename from documentation/easyPVA.html
rename to documentation/easyPVA_20150609.html
index 487937d..dec0657 100644
--- a/documentation/easyPVA.html
+++ b/documentation/easyPVA_20150609.html
@@ -36,16 +36,21 @@
Latest version:
easyPVA_20150325.html
+ href="easyPVA_20150609.html">easyPVA_20150609.html
Previous version:
- none
+ easyPVA_20150325.html
+
Editors:
Marty Kraimer, BNL
Matej Sekoranja, Cosylab
Abstract
+NO LONGER SUPPPORTED:
+The functionality has been moved to pvAccessCPP and EasyPva renamed to Pva.
+
EasyPVA (Easy PVAccess) is a software library that provides to an EPICS client programmer, a friendly
client side programming interface to the data of an EPICS based control system. It is intended
diff --git a/documentation/pvClientCPP.html b/documentation/pvClientCPP.html
new file mode 100644
index 0000000..2050a6e
--- /dev/null
+++ b/documentation/pvClientCPP.html
@@ -0,0 +1,199 @@
+
+
+
+
+
+ EPICS pva
+
+
+
+
+
+
+
+
+
+
+
+
+
EPICS pvaClientCPP
+
+
EPICS V4 Working Group, Working Draft,
+29-May-2015
+
+ This version:
+ pvaClientCPP.html
+
+ Latest version:
+ Still under revision
+ Previous version:
+ easyPVA_20150609.html
+
+ Editors:
+ Marty Kraimer, BNL
+
+
+
Abstract
+
+
pvaClient is a software library that provides to an EPICS client programmer, a friendly
+client side programming interface to the data of an EPICS based control system. It is intended
+for such uses as rapid development of ad hoc programs by controls engineers, or to provide
+scientists a way to directly develop analytical applications.
+
+
Specifically, pvaClient provides a synchronous interface for pvAccess, which is the
+software support for high speed controls network communications used in EPICS version 4.
+pvAccess provides a callback based interface, which can be hard to use.
+pvaClient provides an interface that does not require callbacks even for monitors.
+
+p>
+pvaClientChannel provides many "convenience" methods to directly get and put
+scalar and scalarArray data types.
+Additional methods provide access to the full features of pvAccess.
+
+
+pvaClientMultiChannel provides access to data from multiple channels.
+It can be used directly by a client or via pvaClientMultiDouble or pvaClientNTMultiChannel.
+pvaClientMultiDouble allows the client to get and put data to multiple channels.
+But each channel must have a value field that is a numeric scalar.
+pvaClientNTMultiChannel allows the client to get and put data to multiple channels.
+Each channel must have a value field.
+The data for the channels is presented via normative type NTMultiChannel.
+
+
+
For more information about EPICS generally, please refer to the home page of the Experimental Physics and Industrial
+ Control System .
+
+
+
+
Status of this Document and of the pvaClient Software
+
+
pvaClientCPP is ready for use.
+
+
+
+
+
Table of Contents
+
+
+
+
+
+
+
Introduction
+
+
pvaClient is a synchronous API for accessing PVData via PVAccess. It provides
+an interface to many of the features provided by pvData and pvAccess.
+
+
This document describes the layout of the source files in this project.
+
+A user overview is available via
+pvaClientOverview.html
+
+
+
+Doxygen documentation is available at
+doxygenDoc
+
+
+
Example Database
+
The examples and tests require that an example pvAccess server is runnimg.
+This distribution has a file exampleDatabasePvaClient.zip .
+When unzipped this is used to create an example IOC database.
+
+
+After unzipping the file:
+
+
+cd configure
+cp ExampleRELEASE.local RELEASE.local
+edit RELEASE.local
+cd ..
+make
+cd iocBoot/exampleDatabase
+../../bin/<arch:>/exampleDatabase st.cmd
+
+
Testing
+
The tests will fail unless the example database is running.
+
Once it is running:
+
+make runtests
+
+
Examples
+
Examples are in directory pvaExample/src .
+An example of how to run them is:
+
+mrk> pwd
+/home/epicsv4/pvAccessCPP/pvaExample
+mrk> bin/linux-x86_64/examplepvaClientGet
+
+
The following is a brief description of each example.
+In order to understand each example it
+helps to also look at the source for the example.
+
examplePvaClientGet
+
This has a number of examples:
+
+ exampleDouble
+
+ This shows two methods for getting data from a channel that has a numeric
+ scalar value field.
+
+ exampleDoubleArray
+
+ This shows two methods for getting data from a channel that has a
+ double array value field.
+
+ exampleCADouble
+
+ This is like exampleDouble except it uses provider ca .
+
+ exampleCADoubleArray
+
+ This is like exampleDoubleArray except it uses provider ca .
+
+ examplePowerSupply
+
+ This is an example of getting data from a channel that does not
+ have a value field.
+
+
+
examplePvaClientMonitor
+
This is an example of creating a monitor on a channel.
+It monitors a channel that models a powerSupply, i. e. it is not a "standard" record.
+It does not have a value field.
+
+
After starting the example a change can be made to the powerSupply by issuing:
+
+pvput -r "power.value,voltage.value" examplePowerSupply 6 6
+
+
examplePvaClientPut
+
This example gets and puts to channel exampleDouble.
+
examplePvaClientProcess
+
This example makes a process request to channel exampleDouble.
+
helloWorldPutGet
+
This is an example of issuing a channelPutGet.
+
examplePvaClientMultiDouble
+
This is an example of issuing gets and puts to multiple channels where each
+channel has a numeric scalar value field.
+
examplePvaClientNTMultiChannel
+
This is an example of using NDMultiChannel to obtain data from multiple channels.
+
+
helloWorldRPC
+
This is an example of issuing a channelRPC request.
+It does not use pva.
+
+
+
diff --git a/documentation/overview.html b/documentation/pvaClientOverview.html
similarity index 62%
rename from documentation/overview.html
rename to documentation/pvaClientOverview.html
index 4e07a0d..cc6e5b7 100644
--- a/documentation/overview.html
+++ b/documentation/pvaClientOverview.html
@@ -4,7 +4,7 @@
- easyPVA C++ Overview
+ pva C++ Overview
-
easyPVA C++ Overview
+PvaClient C++ Overview
@@ -39,135 +39,135 @@
Introduction
-EasyPVA is a synchronous API for accessing PVData via PVAccess.
-It also provides a number of convience methods.
+
PvaClient is a synchronous API for accessing PVData via PVAccess.
+It also provides a number of convenience methods.
It allows the client to request access without checking for failure,
-but throws an exception when a reuest fails.
-A client can also check for failues and thus prevent failures.
+but throws an exception if a request fails.
+A client can also check for failues and thus prevent exceptions.
-The EasyPVA API has the following features:
+The PvaClient API has the following features:
Provides a synchronous API rather than the callback API provided by pvAccess.
- Makes common requests easy.
+ Makes common requests pva.
Provides full access to the pvAccess API for more demanding
applications
Allows efficient client side programs.
Takes care of most object resource management problems.
-Simple examples of using easyPVA:
+Simple examples of using pva:
-// easyGet
-EasyPVAPtr easyPVA = EasyPVA::create();
-double value = easyPVA->channel("exampleDouble")->get()->getData()->getDouble();
+// pvaGet
+PvaClientPtr pva = PvaClient::create();
+double value = pva->channel("exampleDouble")->get()->getData()->getDouble();
-// easyPut
-EasyChannelPtr channel = easyPVA->channel("exampleDouble");
-EasyPutPtr put = channel->put();
-EasyPutDataPtr putData = put->getData();
+// pvaPut
+PvaClientChannelPtr channel = pva->channel("exampleDouble");
+PvaClientPutPtr put = channel->put();
+PvaClientPutDataPtr putData = put->getData();
putData->putDouble(3.0); put->put();
-// easyMonitor
-EasyMonitorPtr monitor = easyPVA->channel("examplePowerSupply")->monitor("");
-EasyMonitorDataPtr easyData = monitor->getData();
+// pvaMonitor
+PvaClientMonitorPtr monitor = pva->channel("examplePowerSupply")->monitor("");
+PvaClientMonitorDataPtr pvaData = monitor->getData();
while(true) {
monitor->waitEvent();
cout << "changed\n";
- easyData->showChanged(cout);
+ pvaData->showChanged(cout);
cout << "overrun\n";
- easyData->showOverrun(cout);
+ pvaData->showOverrun(cout);
monitor->releaseEvent();
}
-// easyProcess
-EasyChannelPtr channel = easyPVA->channel("exampleDouble");
-EasyProcessPtr process = channel->createProcess();
+// pvaProcess
+PvaClientChannelPtr channel = pva->channel("exampleDouble");
+PvaClientProcessPtr process = channel->createProcess();
process->process();
-easyPVACPP includes a number of examples.
-easyPVA does not provide support for:
+pvaExample includes a number of examples.
+pva does not provide support for:
ChannelArray
TBD
ChannelRPC
- pvAccess itself already provides an easy to use synchronous interface.
+ pvAccess itself already provides a synchronous interface.
The examples include helloWorldRPC, which is an example of using channelRP.
-EasyPVA
-An instance of EasyPVA is obtained via the call:
+PvaClient
+An instance of PvaClient is obtained via the call:
-EasyPVAPtr easyPVA = EasyPVA::create();
+PvaClientPtr pva = PvaClient::create();
-EasyPVA has methods to create instances of EasyChannel .
+
PvaClient has methods to create instances of PvaClientChannel .
The client can specify the provider name or use the default provider.
-The client can manage it's own channels or can let easyPVA cache channels.
+The client can manage it's own channels or can let pva cache channels.
An example of using the cached method is:
-EasyChannelPtr easyChannel = easyPVA->channel("exampleDouble");
+PvaClientChannelPtr pvaChannel = pva->channel("exampleDouble");
This will attempt to connect to channel exampleDouble.
Since the client did not specify a timeout an exception wll be thrown if
the connection request fails.
The client will block until the connection is made or an exception is thrown.
-If the request succeeds, easyPVA caches the easyChannel so that if the
+If the request succeeds, pva caches the pvaChannel so that if the
client makes another request for the same channel the cached object is
returned to the client.
An example of using a non cached method is:
-EasyChannelPtr easyChannel = easyPVA->createChannel("exampleDouble");
+PvaClientChannelPtr pvaChannel = pva->createChannel("exampleDouble");
-This will create an EasyChannel and return it to the client.
+
This will create an PvaClientChannel and return it to the client.
The client must itself connect.
This is useful if the client wants to connect to multiple channels in parallel.
-EasyChannel - Wrapper For Single Channel
-EasyChannel
+PvaClientChannel - Wrapper For Single Channel
+PvaClientChannel
This provides methods for connecting to a channel and for creating instances of
-EasyField, EasyProcess, ..., EasyPutGet.
+PvaClientField, PvaClientProcess, ..., PvaClientPutGet.
Connection must be made before any create method is called or
an exception is raised.
The following is a synchronous connection request:
-easyChannel->connect(5.0); // BLOCKS AND THROWS IF NO CONNECT
+pvaChannel->connect(5.0); // BLOCKS AND THROWS IF NO CONNECT
This blocks until then connection is made or until timout occurs.
An exception is raised if the connection request fails.
The same request can be made without blocking and without exceptions.
-easyChannel->issueConnect(); // DOES NOT BLOCK
+pvaChannel->issueConnect(); // DOES NOT BLOCK
.....
-Status status =easyChannel->waitConnect(5.0); // BLOCKS DOES NOT THROW
+Status status =pvaChannel->waitConnect(5.0); // BLOCKS DOES NOT THROW
if(!status.isOK()) {
// failure do something
}
-Once the channel is connected other Easy objects can be created.
+
Once the channel is connected other PvaClient objects can be created.
For example:
-EasyGetPtr easyGet = easyChannel->get(); // DOES BLOCK
+PvaClientGetPtr pvaGet = pvaChannel->get(); // DOES BLOCK
This is a caching request.
If the client already has made an identical request the client will receive the
cached object.
-If a new easyGet is created than it is connected before it is returned to the client.
+If a new pvaGet is created than it is connected before it is returned to the client.
The client can also managed it's own objects:
-EasyGetPtr easyGet = easyChannel->createGet(); // DOES NOT BLOCK
+PvaClientGetPtr pvaGet = pvaChannel->createGet(); // DOES NOT BLOCK
-The client must connect the easyGet.
+The client must connect the pvaGet.
-EasyGetData
-This provides the data returned by easyGet and easyPutGet.
+
PvaClientGetData
+This provides the data returned by pvaGet and pvaPutGet.
It is obtained via:
-EasyGetDataPtr easyData = easyGet->getData();
+PvaClientGetDataPtr pvaData = pvaGet->getData();
It provides methods to get everything returned by channelGet.
In addition there are methods that make it easier to handle a value
@@ -176,24 +176,24 @@ Also for a scalar that is a double or a scalarArray with element type double.
An example is:
-double value = easyData->getDouble();
+double value = pvaData->getDouble();
It also keeps a bitSet showing which fields have changed since the last channelGet or channelPutGet.
-EasyMonitorData
-To the client this looks identical to EasyGetData except that
+
PvaClientMonitorData
+To the client this looks identical to PvaClientGetData except that
it provides two BitSets: changedBitSet and overrrunBitSet.
-It is used by easyMonitor.
+It is used by pvaMonitor.
-EasyPutData
-This is used to provided data for easyPut and easyPutGet.
-It has many of the same methods as easyGetData.
+
PvaClientPutData
+This is used to provided data for pvaPut and pvaPutGet.
+It has many of the same methods as pvaGetData.
It does not have a bitSet.
It also has put methods like:
-void easyData->putDouble(5.0);
+void pvaData->putDouble(5.0);
-EasyGet
+PvaClientGet
This provides methods to connect to channelGet and to issue get request.
To connect via a single synchronous call:
@@ -201,35 +201,35 @@ eastGet->connect(); // BLOCKS AND CAN THROW
This can also be done in two steps:
-easyGet->issueConnect(); // DOES NOT BLOCK
+pvaGet->issueConnect(); // DOES NOT BLOCK
...
-Status status = easyGet->waitConnect(); // BLOCKS AND DOES NOT HROW
+Status status = pvaGet->waitConnect(); // BLOCKS AND DOES NOT HROW
Once connected gets are issued via either:
-void easyGet->get(); // BLOCKS AND CAN THROW
+void pvaGet->get(); // BLOCKS AND CAN THROW
or
-easyGet->issueGet(); // DOES NOT BLOCK
+pvaGet->issueGet(); // DOES NOT BLOCK
...
-Status status = easyGet->waitGet(); // BLOCKS AND DOES NOT THROW
+Status status = pvaGet->waitGet(); // BLOCKS AND DOES NOT THROW
-EasyPut
-This is similar to easyGet except that it wraps channelPut instead of channelGet.
+
PvaClientPut
+This is similar to pvaGet except that it wraps channelPut instead of channelGet.
Once connected puts are issued via either:
-void easyPut->put(); // BLOCKS AND CAN THROW
+void pvaPut->put(); // BLOCKS AND CAN THROW
or
-easyPut->issuePut(); // DOES NOT BLOCK
+pvaPut->issuePut(); // DOES NOT BLOCK
...
-Status status = easyPut->waitPut(); // BLOCKS AND DOES NOT THROW
+Status status = pvaPut->waitPut(); // BLOCKS AND DOES NOT THROW
-EasyMonitor
-Connecting is similar to easyGet and easyPut.
+
PvaClientMonitor
+Connecting is similar to pvaGet and pvaPut.
The other methods are:
start
@@ -238,7 +238,7 @@ The other methods are:
Stops monitoring
poll
polls for a monitorEvent.
- The data is avalable via easyMonitorData.
+ The data is avalable via pvaMonitorData.
releaseEvent
Release the data from the last poll.
@@ -251,8 +251,8 @@ The other methods are:
setRequester
A client callback is registered to receive notice of monitorEvents.
-EasyProcess
-Connecting is similar to easyGet.
+
PvaClientProcess
+Connecting is similar to pvaGet.
It has methods:
process
@@ -263,8 +263,8 @@ It has methods:
waitProcess
Wait for process to complete.
-EasyPutGet
-Connecting is similar to easyGet.
+
PvaClientPutGet
+Connecting is similar to pvaGet.
It has methods:
putGet
@@ -285,29 +285,29 @@ It has methods:
Gets the data for the put part of channelPutGet.
getPutData
- Returns the EasyData for the put part of channelPutGet.
+ Returns the PvaClientData for the put part of channelPutGet.
getGetData
- Returns the EasyData for the get part of channelPutGet.
+ Returns the PvaClientData for the get part of channelPutGet.
Look at javaDoc for details.
-EasyMultiChannel - Wrapper For Multiple Channels
-EasyMultiChannel
+PvaClientMultiChannel - Wrapper For Multiple Channels
+PvaClientMultiChannel
This provides methods for connecting to multiple channels.
-A client can either use EasyMultiChannel directly or use EasyMultiDouble or EasyNTMultiChannel.
+A client can either use PvaClientMultiChannel directly or use PvaClientMultiDouble or PvaClientNTMultiChannel.
But both impose restrictions on what can be accessed.
-EasyMultiDouble
+PvaClientMultiDouble
This provides support for gets and puts to the value field of multiple channels.
Each channel must have a value field that is a numeric scalar.
The client always sees the data as a PVDoubleArray.
All channels must connect.
If any problems occur an exception is thrown.
-EasyNTMultiChannel
+PvaClientNTMultiChannel
This provides support for gets and puts to the value field of multiple channels.
Each channel must have a value field.
The client always sees the data as a NTMultiChannel, which is one
diff --git a/example/src/Makefile b/example/src/Makefile
index e19c5fe..3fb3d78 100644
--- a/example/src/Makefile
+++ b/example/src/Makefile
@@ -5,52 +5,52 @@ include $(TOP)/configure/CONFIG
# ADD MACRO DEFINITIONS AFTER THIS LINE
-PROD_HOST += exampleEasyProcess
-exampleEasyProcess_SRCS += exampleEasyProcess.cpp
-exampleEasyProcess_LIBS += easyPVA
-exampleEasyProcess_LIBS += pvAccess
-exampleEasyProcess_LIBS += pvData
-exampleEasyProcess_LIBS += Com
+PROD_HOST += examplePvaClientProcess
+examplePvaClientProcess_SRCS += examplePvaClientProcess.cpp
+examplePvaClientProcess_LIBS += pvaClient
+examplePvaClientProcess_LIBS += pvAccess
+examplePvaClientProcess_LIBS += pvData
+examplePvaClientProcess_LIBS += Com
-PROD_HOST += exampleEasyGet
-exampleEasyGet_SRCS += exampleEasyGet.cpp
-exampleEasyGet_LIBS += easyPVA
-exampleEasyGet_LIBS += pvAccess
-exampleEasyGet_LIBS += pvData
-exampleEasyGet_LIBS += Com
+PROD_HOST += examplePvaClientGet
+examplePvaClientGet_SRCS += examplePvaClientGet.cpp
+examplePvaClientGet_LIBS += pvaClient
+examplePvaClientGet_LIBS += pvAccess
+examplePvaClientGet_LIBS += pvData
+examplePvaClientGet_LIBS += Com
-PROD_HOST += exampleEasyPut
-exampleEasyPut_SRCS += exampleEasyPut.cpp
-exampleEasyPut_LIBS += easyPVA
-exampleEasyPut_LIBS += pvAccess
-exampleEasyPut_LIBS += pvData
-exampleEasyPut_LIBS += Com
+PROD_HOST += examplePvaClientPut
+examplePvaClientPut_SRCS += examplePvaClientPut.cpp
+examplePvaClientPut_LIBS += pvaClient
+examplePvaClientPut_LIBS += pvAccess
+examplePvaClientPut_LIBS += pvData
+examplePvaClientPut_LIBS += Com
-PROD_HOST += exampleEasyMonitor
-exampleEasyMonitor_SRCS += exampleEasyMonitor.cpp
-exampleEasyMonitor_LIBS += easyPVA
-exampleEasyMonitor_LIBS += pvAccess
-exampleEasyMonitor_LIBS += pvData
-exampleEasyMonitor_LIBS += Com
+PROD_HOST += examplePvaClientMonitor
+examplePvaClientMonitor_SRCS += examplePvaClientMonitor.cpp
+examplePvaClientMonitor_LIBS += pvaClient
+examplePvaClientMonitor_LIBS += pvAccess
+examplePvaClientMonitor_LIBS += pvData
+examplePvaClientMonitor_LIBS += Com
-PROD_HOST += exampleEasyMultiDouble
-exampleEasyMultiDouble_SRCS += exampleEasyMultiDouble.cpp
-exampleEasyMultiDouble_LIBS += easyPVA
-exampleEasyMultiDouble_LIBS += pvAccess
-exampleEasyMultiDouble_LIBS += pvData
-exampleEasyMultiDouble_LIBS += Com
+PROD_HOST += examplePvaClientMultiDouble
+examplePvaClientMultiDouble_SRCS += examplePvaClientMultiDouble.cpp
+examplePvaClientMultiDouble_LIBS += pvaClient
+examplePvaClientMultiDouble_LIBS += pvAccess
+examplePvaClientMultiDouble_LIBS += pvData
+examplePvaClientMultiDouble_LIBS += Com
-PROD_HOST += exampleEasyNTMultiChannel
-exampleEasyNTMultiChannel_SRCS += exampleEasyNTMultiChannel.cpp
-exampleEasyNTMultiChannel_LIBS += easyPVA
-exampleEasyNTMultiChannel_LIBS += pvAccess
-exampleEasyNTMultiChannel_LIBS += nt
-exampleEasyNTMultiChannel_LIBS += pvData
-exampleEasyNTMultiChannel_LIBS += Com
+PROD_HOST += examplePvaClientNTMultiChannel
+examplePvaClientNTMultiChannel_SRCS += examplePvaClientNTMultiChannel.cpp
+examplePvaClientNTMultiChannel_LIBS += pvaClient
+examplePvaClientNTMultiChannel_LIBS += pvAccess
+examplePvaClientNTMultiChannel_LIBS += nt
+examplePvaClientNTMultiChannel_LIBS += pvData
+examplePvaClientNTMultiChannel_LIBS += Com
PROD_HOST += helloWorldRPC
helloWorldRPC_SRCS += helloWorldRPC.cpp
-helloWorldRPC_LIBS += easyPVA
+helloWorldRPC_LIBS += pvaClient
helloWorldRPC_LIBS += pvAccess
helloWorldRPC_LIBS += nt
helloWorldRPC_LIBS += pvData
@@ -58,7 +58,7 @@ helloWorldRPC_LIBS += Com
PROD_HOST += helloWorldPutGet
helloWorldPutGet_SRCS += helloWorldPutGet.cpp
-helloWorldPutGet_LIBS += easyPVA
+helloWorldPutGet_LIBS += pvaClient
helloWorldPutGet_LIBS += pvAccess
helloWorldPutGet_LIBS += nt
helloWorldPutGet_LIBS += pvData
diff --git a/example/src/exampleEasyGet.cpp b/example/src/examplePvaClientGet.cpp
similarity index 54%
rename from example/src/exampleEasyGet.cpp
rename to example/src/examplePvaClientGet.cpp
index 97dd6e9..1e7e713 100644
--- a/example/src/exampleEasyGet.cpp
+++ b/example/src/examplePvaClientGet.cpp
@@ -1,4 +1,4 @@
-/*exampleEasyGet.cpp */
+/*examplePvaClientGet.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -12,70 +12,70 @@
#include
-#include
+#include
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
-using namespace epics::easyPVA;
+using namespace epics::pvaClient;
-static void exampleDouble(EasyPVAPtr const &easyPVA)
+static void exampleDouble(PvaClientPtr const &pva)
{
cout << "example double scalar\n";
double value;
try {
cout << "short way\n";
- value = easyPVA->channel("exampleDouble")->get()->getData()->getDouble();
+ value = pva->channel("exampleDouble")->get()->getData()->getDouble();
cout << "as double " << value << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
}
cout << "long way\n";
- EasyChannelPtr easyChannel = easyPVA->createChannel("exampleDouble");
- easyChannel->issueConnect();
- Status status = easyChannel->waitConnect(2.0);
+ PvaClientChannelPtr pvaChannel = pva->createChannel("exampleDouble");
+ pvaChannel->issueConnect();
+ Status status = pvaChannel->waitConnect(2.0);
if(!status.isOK()) {cout << " connect failed\n"; return;}
- EasyGetPtr easyGet = easyChannel->createGet();
- easyGet->issueConnect();
- status = easyGet->waitConnect();
+ PvaClientGetPtr pvaGet = pvaChannel->createGet();
+ pvaGet->issueConnect();
+ status = pvaGet->waitConnect();
if(!status.isOK()) {cout << " createGet failed\n"; return;}
- EasyGetDataPtr easyData = easyGet->getData();
- value = easyData->getDouble();
+ PvaClientGetDataPtr pvaData = pvaGet->getData();
+ value = pvaData->getDouble();
cout << "as double " << value << endl;
}
-static void exampleDoubleArray(EasyPVAPtr const &easyPVA)
+static void exampleDoubleArray(PvaClientPtr const &pva)
{
cout << "example double array\n";
shared_vector value;
try {
cout << "short way\n";
- value = easyPVA->channel("exampleDoubleArray")->get()->getData()->getDoubleArray();
+ value = pva->channel("exampleDoubleArray")->get()->getData()->getDoubleArray();
cout << "as doubleArray " << value << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
}
try {
cout << "long way\n";
- EasyChannelPtr easyChannel = easyPVA->createChannel("exampleDoubleArray");
- easyChannel->connect(2.0);
- EasyGetPtr easyGet = easyChannel->createGet();
- EasyGetDataPtr easyData = easyGet->getData();
- value = easyData->getDoubleArray();
+ PvaClientChannelPtr pvaChannel = pva->createChannel("exampleDoubleArray");
+ pvaChannel->connect(2.0);
+ PvaClientGetPtr pvaGet = pvaChannel->createGet();
+ PvaClientGetDataPtr pvaData = pvaGet->getData();
+ value = pvaData->getDoubleArray();
cout << "as doubleArray " << value << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
}
}
-static void examplePowerSupply(EasyPVAPtr const &easyPVA)
+static void examplePowerSupply(PvaClientPtr const &pva)
{
cout << "example powerSupply\n";
PVStructurePtr pvStructure;
try {
cout << "short way\n";
- pvStructure = easyPVA->channel("examplePowerSupply")->
+ pvStructure = pva->channel("examplePowerSupply")->
get("field()")->getData()->getPVStructure();
cout << pvStructure << endl;
} catch (std::runtime_error e) {
@@ -84,49 +84,49 @@ static void examplePowerSupply(EasyPVAPtr const &easyPVA)
}
-static void exampleCADouble(EasyPVAPtr const &easyPVA)
+static void exampleCADouble(PvaClientPtr const &pva)
{
cout << "example double scalar\n";
double value;
try {
cout << "short way\n";
- value = easyPVA->channel("double00","ca",5.0)->get()->getData()->getDouble();
+ value = pva->channel("double00","ca",5.0)->get()->getData()->getDouble();
cout << "as double " << value << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
}
cout << "long way\n";
- EasyChannelPtr easyChannel = easyPVA->createChannel("double00","ca");
- easyChannel->issueConnect();
- Status status = easyChannel->waitConnect(2.0);
+ PvaClientChannelPtr pvaChannel = pva->createChannel("double00","ca");
+ pvaChannel->issueConnect();
+ Status status = pvaChannel->waitConnect(2.0);
if(!status.isOK()) {cout << " connect failed\n"; return;}
- EasyGetPtr easyGet = easyChannel->createGet();
- easyGet->issueConnect();
- status = easyGet->waitConnect();
+ PvaClientGetPtr pvaGet = pvaChannel->createGet();
+ pvaGet->issueConnect();
+ status = pvaGet->waitConnect();
if(!status.isOK()) {cout << " createGet failed\n"; return;}
- EasyGetDataPtr easyData = easyGet->getData();
- value = easyData->getDouble();
+ PvaClientGetDataPtr pvaData = pvaGet->getData();
+ value = pvaData->getDouble();
cout << "as double " << value << endl;
}
-static void exampleCADoubleArray(EasyPVAPtr const &easyPVA)
+static void exampleCADoubleArray(PvaClientPtr const &pva)
{
cout << "example double array\n";
shared_vector value;
try {
cout << "short way\n";
- value = easyPVA->channel("doubleArray","ca",5.0)->get()->getData()->getDoubleArray();
+ value = pva->channel("doubleArray","ca",5.0)->get()->getData()->getDoubleArray();
cout << "as doubleArray " << value << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
}
try {
cout << "long way\n";
- EasyChannelPtr easyChannel = easyPVA->createChannel("doubleArray","ca");
- easyChannel->connect(2.0);
- EasyGetPtr easyGet = easyChannel->createGet();
- EasyGetDataPtr easyData = easyGet->getData();
- value = easyData->getDoubleArray();
+ PvaClientChannelPtr pvaChannel = pva->createChannel("doubleArray","ca");
+ pvaChannel->connect(2.0);
+ PvaClientGetPtr pvaGet = pvaChannel->createGet();
+ PvaClientGetDataPtr pvaData = pvaGet->getData();
+ value = pvaData->getDoubleArray();
cout << "as doubleArray " << value << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
@@ -135,12 +135,12 @@ static void exampleCADoubleArray(EasyPVAPtr const &easyPVA)
int main(int argc,char *argv[])
{
- EasyPVAPtr easyPVA = EasyPVA::create();
- exampleDouble(easyPVA);
- exampleDoubleArray(easyPVA);
- examplePowerSupply(easyPVA);
- exampleCADouble(easyPVA);
- exampleCADoubleArray(easyPVA);
+ PvaClientPtr pva= PvaClient::create();
+ exampleDouble(pva);
+ exampleDoubleArray(pva);
+ examplePowerSupply(pva);
+ exampleCADouble(pva);
+ exampleCADoubleArray(pva);
cout << "done\n";
return 0;
}
diff --git a/example/src/exampleEasyMonitor.cpp b/example/src/examplePvaClientMonitor.cpp
similarity index 59%
rename from example/src/exampleEasyMonitor.cpp
rename to example/src/examplePvaClientMonitor.cpp
index 111b77e..e459bab 100644
--- a/example/src/exampleEasyMonitor.cpp
+++ b/example/src/examplePvaClientMonitor.cpp
@@ -1,4 +1,4 @@
-/*monitorPowerSupply.cpp */
+/*examplePvaClientClientMonitor.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -14,24 +14,24 @@
#include
-#include
+#include
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
-using namespace epics::easyPVA;
+using namespace epics::pvaClient;
-static void exampleMonitor(EasyPVAPtr const &easyPVA)
+static void exampleMonitor(PvaClientPtr const &pva)
{
- EasyMonitorPtr monitor = easyPVA->channel("examplePowerSupply")->monitor("");
- EasyMonitorDataPtr easyData = monitor->getData();
+ PvaClientMonitorPtr monitor = pva->channel("examplePowerSupply")->monitor("");
+ PvaClientMonitorDataPtr pvaData = monitor->getData();
while(true) {
monitor->waitEvent();
cout << "changed\n";
- easyData->showChanged(cout);
+ pvaData->showChanged(cout);
cout << "overrun\n";
- easyData->showOverrun(cout);
+ pvaData->showOverrun(cout);
monitor->releaseEvent();
}
}
@@ -39,8 +39,8 @@ static void exampleMonitor(EasyPVAPtr const &easyPVA)
int main(int argc,char *argv[])
{
- EasyPVAPtr easyPVA = EasyPVA::create();
- exampleMonitor(easyPVA);
+ PvaClientPtr pva = PvaClient::create();
+ exampleMonitor(pva);
cout << "done\n";
return 0;
}
diff --git a/example/src/exampleEasyMultiDouble.cpp b/example/src/examplePvaClientMultiDouble.cpp
similarity index 81%
rename from example/src/exampleEasyMultiDouble.cpp
rename to example/src/examplePvaClientMultiDouble.cpp
index 681ae0a..c58cf37 100644
--- a/example/src/exampleEasyMultiDouble.cpp
+++ b/example/src/examplePvaClientMultiDouble.cpp
@@ -1,4 +1,4 @@
-/*exampleEasyMultiDouble.cpp */
+/*examplePvaClientMultiDouble.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -12,15 +12,15 @@
#include
-#include
+#include
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
-using namespace epics::easyPVA;
+using namespace epics::pvaClient;
-static void example(EasyPVAPtr const &easyPVA)
+static void example(PvaClientPtr const &pva)
{
cout << "example multiDouble\n";
size_t num = 5;
@@ -33,7 +33,7 @@ static void example(EasyPVAPtr const &easyPVA)
PVStringArrayPtr pvNames =
getPVDataCreate()->createPVScalarArray();
pvNames->replace(freeze(channelNames));
- EasyMultiDoublePtr multiDouble(EasyMultiDouble::create(easyPVA,pvNames));
+ PvaClientMultiDoublePtr multiDouble(PvaClientMultiDouble::create(pva,pvNames));
try {
shared_vector data = multiDouble->get();
cout << "initial " << data << endl;
@@ -47,7 +47,7 @@ static void example(EasyPVAPtr const &easyPVA)
}
-static void exampleCA(EasyPVAPtr const &easyPVA)
+static void exampleCA(PvaClientPtr const &pva)
{
cout << "example multiDouble\n";
size_t num = 5;
@@ -60,7 +60,7 @@ static void exampleCA(EasyPVAPtr const &easyPVA)
PVStringArrayPtr pvNames =
getPVDataCreate()->createPVScalarArray();
pvNames->replace(freeze(channelNames));
- EasyMultiDoublePtr multiDouble(EasyMultiDouble::create(easyPVA,pvNames,5.0,"ca"));
+ PvaClientMultiDoublePtr multiDouble(PvaClientMultiDouble::create(pva,pvNames,5.0,"ca"));
try {
shared_vector data = multiDouble->get();
cout << "initial " << data << endl;
@@ -77,8 +77,8 @@ static void exampleCA(EasyPVAPtr const &easyPVA)
int main(int argc,char *argv[])
{
- EasyPVAPtr easyPVA = EasyPVA::create();
- example(easyPVA);
- exampleCA(easyPVA);
+ PvaClientPtr pva = PvaClient::create();
+ example(pva);
+ exampleCA(pva);
return 0;
}
diff --git a/example/src/exampleEasyNTMultiChannel.cpp b/example/src/examplePvaClientNTMultiChannel.cpp
similarity index 80%
rename from example/src/exampleEasyNTMultiChannel.cpp
rename to example/src/examplePvaClientNTMultiChannel.cpp
index ca02edd..c175708 100644
--- a/example/src/exampleEasyNTMultiChannel.cpp
+++ b/example/src/examplePvaClientNTMultiChannel.cpp
@@ -1,4 +1,4 @@
-/*exampleEasyNTMultiChannel.cpp */
+/*examplePvaClientNTMultiChannel.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -12,16 +12,16 @@
#include
-#include
+#include
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
-using namespace epics::easyPVA;
+using namespace epics::pvaClient;
using namespace epics::nt;
-static void example(EasyPVAPtr const &easyPVA)
+static void example(PvaClientPtr const &pva)
{
cout << "example ntMultiChannel\n";
size_t num = 5;
@@ -44,10 +44,10 @@ static void example(EasyPVAPtr const &easyPVA)
addNanoseconds() ->
addUserTag() ->
createStructure();
- EasyNTMultiChannelPtr easy = EasyNTMultiChannel::create(
- easyPVA,pvNames,structure);
+ PvaClientNTMultiChannelPtr multi = PvaClientNTMultiChannel::create(
+ pva,pvNames,structure);
try {
- NTMultiChannelPtr nt = easy->get();
+ NTMultiChannelPtr nt = multi->get();
cout << "initial\n" << nt->getPVStructure() << endl;
} catch (std::runtime_error e) {
@@ -56,7 +56,7 @@ static void example(EasyPVAPtr const &easyPVA)
}
-static void exampleCA(EasyPVAPtr const &easyPVA)
+static void exampleCA(PvaClientPtr const &pva)
{
cout << "example ntMultiChannel\n";
size_t num = 5;
@@ -79,10 +79,10 @@ static void exampleCA(EasyPVAPtr const &easyPVA)
addNanoseconds() ->
addUserTag() ->
createStructure();
- EasyNTMultiChannelPtr easy = EasyNTMultiChannel::create(
- easyPVA,pvNames,structure,5.0,"ca");
+ PvaClientNTMultiChannelPtr multi = PvaClientNTMultiChannel::create(
+ pva,pvNames,structure,5.0,"ca");
try {
- NTMultiChannelPtr nt = easy->get();
+ NTMultiChannelPtr nt = multi->get();
cout << "initial\n" << nt->getPVStructure() << endl;
} catch (std::runtime_error e) {
@@ -94,8 +94,8 @@ static void exampleCA(EasyPVAPtr const &easyPVA)
int main(int argc,char *argv[])
{
- EasyPVAPtr easyPVA = EasyPVA::create();
- example(easyPVA);
- exampleCA(easyPVA);
+ PvaClientPtr pva = PvaClient::create();
+ example(pva);
+ exampleCA(pva);
return 0;
}
diff --git a/example/src/exampleEasyProcess.cpp b/example/src/examplePvaClientProcess.cpp
similarity index 69%
rename from example/src/exampleEasyProcess.cpp
rename to example/src/examplePvaClientProcess.cpp
index 1c671d9..43571c4 100644
--- a/example/src/exampleEasyProcess.cpp
+++ b/example/src/examplePvaClientProcess.cpp
@@ -1,4 +1,4 @@
-/*exampleEasyProcess.cpp */
+/*examplePvaClientProcess.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -12,19 +12,19 @@
#include
-#include
+#include
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
-using namespace epics::easyPVA;
+using namespace epics::pvaClient;
-static void exampleProcess(EasyPVAPtr const &easyPVA)
+static void exampleProcess(PvaClientPtr const &pva)
{
cout << "example process\n";
- EasyChannelPtr channel = easyPVA->channel("exampleDouble");
- EasyProcessPtr process = channel->createProcess();
+ PvaClientChannelPtr channel = pva->channel("exampleDouble");
+ PvaClientProcessPtr process = channel->createProcess();
try {
process->process();
cout << channel->get("field()")->getData()->showChanged(cout) << endl;
@@ -38,7 +38,7 @@ static void exampleProcess(EasyPVAPtr const &easyPVA)
int main(int argc,char *argv[])
{
- EasyPVAPtr easyPVA = EasyPVA::create();
- exampleProcess(easyPVA);
+ PvaClientPtr pva = PvaClient::create();
+ exampleProcess(pva);
return 0;
}
diff --git a/example/src/exampleEasyPut.cpp b/example/src/examplePvaClientPut.cpp
similarity index 69%
rename from example/src/exampleEasyPut.cpp
rename to example/src/examplePvaClientPut.cpp
index 6f3d02d..a7f87e1 100644
--- a/example/src/exampleEasyPut.cpp
+++ b/example/src/examplePvaClientPut.cpp
@@ -1,4 +1,4 @@
-/*exampleEasyPut.cpp */
+/*examplePvaClientPut.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -12,20 +12,20 @@
#include
-#include
+#include
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
-using namespace epics::easyPVA;
+using namespace epics::pvaClient;
-static void examplePut(EasyPVAPtr const &easyPVA)
+static void examplePut(PvaClientPtr const &pva)
{
cout << "example put\n";
- EasyChannelPtr channel = easyPVA->channel("exampleDouble");
- EasyPutPtr put = channel->put();
- EasyPutDataPtr putData = put->getData();
+ PvaClientChannelPtr channel = pva->channel("exampleDouble");
+ PvaClientPutPtr put = channel->put();
+ PvaClientPutDataPtr putData = put->getData();
try {
putData->putDouble(3.0); put->put();
cout << channel->get("field()")->getData()->showChanged(cout) << endl;
@@ -39,7 +39,7 @@ static void examplePut(EasyPVAPtr const &easyPVA)
int main(int argc,char *argv[])
{
- EasyPVAPtr easyPVA = EasyPVA::create();
- examplePut(easyPVA);
+ PvaClientPtr pva = PvaClient::create();
+ examplePut(pva);
return 0;
}
diff --git a/example/src/helloWorldPutGet.cpp b/example/src/helloWorldPutGet.cpp
index f826de1..58f784d 100644
--- a/example/src/helloWorldPutGet.cpp
+++ b/example/src/helloWorldPutGet.cpp
@@ -12,27 +12,27 @@
#include
-#include
+#include
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
-using namespace epics::easyPVA;
+using namespace epics::pvaClient;
-static void example(EasyPVAPtr const &easyPVA)
+static void example(PvaClientPtr const &pva)
{
cout << "helloWorldPutGet\n";
try {
- EasyChannelPtr channel = easyPVA->channel("exampleHello");
- EasyPutGetPtr putGet = channel->createPutGet();
+ PvaClientChannelPtr channel = pva->channel("exampleHello");
+ PvaClientPutGetPtr putGet = channel->createPutGet();
putGet->connect();
- EasyPutDataPtr putData = putGet->getPutData();
+ PvaClientPutDataPtr putData = putGet->getPutData();
PVStructurePtr arg = putData->getPVStructure();
PVStringPtr pvValue = arg->getSubField("argument.value");
pvValue->put("World");
putGet->putGet();
- EasyGetDataPtr getData = putGet->getGetData();
+ PvaClientGetDataPtr getData = putGet->getGetData();
cout << getData->getPVStructure() << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
@@ -42,7 +42,7 @@ static void example(EasyPVAPtr const &easyPVA)
int main(int argc,char *argv[])
{
- EasyPVAPtr easyPVA = EasyPVA::create();
- example(easyPVA);
+ PvaClientPtr pva = PvaClient::create();
+ example(pva);
return 0;
}
diff --git a/example/src/helloWorldRPC.cpp b/example/src/helloWorldRPC.cpp
index 9106842..238aad3 100644
--- a/example/src/helloWorldRPC.cpp
+++ b/example/src/helloWorldRPC.cpp
@@ -1,4 +1,4 @@
-/*exampleChannelRPC.cpp */
+/*helloWorldRPC.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
diff --git a/exampleDatabaseEasyPVA.zip b/exampleDatabasePvaClient.zip
similarity index 100%
rename from exampleDatabaseEasyPVA.zip
rename to exampleDatabasePvaClient.zip
diff --git a/jenkins/cloudbees_build b/jenkins/cloudbees_build
index 2c602a9..8d72d0e 100644
--- a/jenkins/cloudbees_build
+++ b/jenkins/cloudbees_build
@@ -1,4 +1,4 @@
-# easyPVA C++ implementation
+# pvaClient C++ implementation
# Jenkins @ Cloudbees build script
#
# Jenkins invokes scripts with the "-ex" option. So the build is considered a failure
@@ -68,11 +68,11 @@ make runtests
###########################################
# Create distribution
-tar --exclude=test* -czf easyPVA.CB-dist.tar.gz lib include
+tar --exclude=test* -czf pvaClient.CB-dist.tar.gz lib include
###########################################
# Publish documentation
if [ "${BUILD_DOCS}" ]; then
- rsync -aqP --delete -e ssh documentation epics-jenkins@web.sourceforge.net:/home/project-web/epics-pvdata/htdocs/docbuild/easyPVACPP/tip
+ rsync -aqP --delete -e ssh documentation epics-jenkins@web.sourceforge.net:/home/project-web/epics-pvdata/htdocs/docbuild/pvaClientCPP/tip
fi
diff --git a/src/Makefile b/src/Makefile
index 29d25fb..f61bab4 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -3,29 +3,28 @@
TOP = ..
include $(TOP)/configure/CONFIG
-LIBRARY += easyPVA
+LIBRARY += pvaClient
-INC += easyPVA.h
-INC += easyMultiDouble.h
-INC += easyNTMultiChannel.h
+INC += pvaClient.h
+INC += pvaClientMultiDouble.h
+INC += pvaClientNTMultiChannel.h
-LIBSRCS += easyPVA.cpp
-LIBSRCS += easyPutData.cpp
-LIBSRCS += easyGetData.cpp
-LIBSRCS += easyMonitorData.cpp
-LIBSRCS += easyChannel.cpp
-LIBSRCS += easyProcess.cpp
-LIBSRCS += easyGet.cpp
-LIBSRCS += easyPut.cpp
-LIBSRCS += easyMonitor.cpp
-LIBSRCS += easyPutGet.cpp
-LIBSRCS += easyMultiChannel.cpp
-LIBSRCS += easyMultiDouble.cpp
-LIBSRCS += easyNTMultiChannel.cpp
-#LIBSRCS += easyRPC.cpp
+LIBSRCS += pvaClient.cpp
+LIBSRCS += pvaClientPutData.cpp
+LIBSRCS += pvaClientGetData.cpp
+LIBSRCS += pvaClientMonitorData.cpp
+LIBSRCS += pvaClientChannel.cpp
+LIBSRCS += pvaClientProcess.cpp
+LIBSRCS += pvaClientGet.cpp
+LIBSRCS += pvaClientPut.cpp
+LIBSRCS += pvaClientMonitor.cpp
+LIBSRCS += pvaClientPutGet.cpp
+LIBSRCS += pvaClientMultiChannel.cpp
+LIBSRCS += pvaClientMultiDouble.cpp
+LIBSRCS += pvaClientNTMultiChannel.cpp
-easyPVA_LIBS += pvAccess pvData nt Com
-easyPVA_LIBS += $(EPICS_BASE_IOC_LIBS)
+pvaClient_LIBS += pvAccess pvData nt Com
+pvaClient_LIBS += $(EPICS_BASE_IOC_LIBS)
include $(TOP)/configure/RULES
diff --git a/src/easyChannel.cpp b/src/easyChannel.cpp
deleted file mode 100644
index 43f02ce..0000000
--- a/src/easyChannel.cpp
+++ /dev/null
@@ -1,495 +0,0 @@
-/* easyChannel.cpp */
-/**
- * Copyright - See the COPYRIGHT that is included with this distribution.
- * EPICS pvData is distributed subject to a Software License Agreement found
- * in file LICENSE that is included with this distribution.
- */
-/**
- * @author mrk
- * @date 2015.02
- */
-#define epicsExportSharedSymbols
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-
-using std::tr1::static_pointer_cast;
-using namespace epics::pvData;
-using namespace epics::pvAccess;
-using namespace std;
-
-namespace epics { namespace easyPVA {
-
-
-class EasyGetCache
-{
-public:
- EasyGetCache(){}
- ~EasyGetCache();
- void destroy() {
- easyGetMap.clear();
- }
- EasyGetPtr getGet(string const & request);
- void addGet(string const & request,EasyGetPtr const & easyGet);
-private:
- map easyGetMap;
-};
-
-EasyGetCache::~EasyGetCache()
-{
- destroy();
-}
-
-EasyGetPtr EasyGetCache::getGet(string const & request)
-{
- map::iterator iter = easyGetMap.find(request);
- if(iter!=easyGetMap.end()) return iter->second;
- return EasyGetPtr();
-}
-
-void EasyGetCache::addGet(string const & request,EasyGetPtr const & easyGet)
-{
- easyGetMap.insert(std::pair(
- request,easyGet));
-}
-
-
-class EasyPutCache
-{
-public:
- EasyPutCache(){}
- ~EasyPutCache();
- void destroy() {
- easyPutMap.clear();
- }
- EasyPutPtr getPut(string const & request);
- void addPut(string const & request,EasyPutPtr const & easyPut);
-private:
- map easyPutMap;
-};
-
-EasyPutCache::~EasyPutCache()
-{
- destroy();
-}
-
-EasyPutPtr EasyPutCache::getPut(string const & request)
-{
- map::iterator iter = easyPutMap.find(request);
- if(iter!=easyPutMap.end()) return iter->second;
- return EasyPutPtr();
-}
-
-void EasyPutCache::addPut(string const & request,EasyPutPtr const & easyPut)
-{
- easyPutMap.insert(std::pair(
- request,easyPut));
-}
-
-class ChannelRequesterImpl : public ChannelRequester
-{
- EasyChannel *easyChannel;
-public:
- ChannelRequesterImpl(EasyChannel *easyChannel)
- : easyChannel(easyChannel) {}
- void channelCreated(
- const Status& status,
- Channel::shared_pointer const & channel)
- { easyChannel->channelCreated(status,channel); }
- void channelStateChange(
- Channel::shared_pointer const & channel,
- Channel::ConnectionState connectionState)
- {easyChannel->channelStateChange(channel,connectionState);}
- tr1::shared_ptr getChannel() {return easyChannel->getChannel();}
- string getRequesterName()
- {return easyChannel->getRequesterName();}
- void message(
- string const & message,
- MessageType messageType)
- { easyChannel->message(message,messageType); }
- void destroy() {easyChannel->destroy();}
-};
-
-
-EasyChannel::EasyChannel(
- EasyPVAPtr const &easyPVA,
- string const & channelName,
- string const & providerName)
-: easyPVA(easyPVA),
- channelName(channelName),
- providerName(providerName),
- connectState(connectIdle),
- isDestroyed(false),
- createRequest(CreateRequest::create()),
- easyGetCache(new EasyGetCache()),
- easyPutCache(new EasyPutCache())
-{}
-
-EasyChannel::~EasyChannel()
-{
- destroy();
-}
-
-void EasyChannel::channelCreated(const Status& status, Channel::shared_pointer const & channel)
-{
- if(isDestroyed) throw std::runtime_error("easyChannel was destroyed");
- if(status.isOK()) {
- this->channel = channel;
- return;
- }
- cout << "EasyChannel::channelCreated status " << status.getMessage() << " why??\n";
-}
-
-void EasyChannel::channelStateChange(
- Channel::shared_pointer const & channel,
- Channel::ConnectionState connectionState)
-{
- if(isDestroyed) return;
- bool waitingForConnect = false;
- if(connectState==connectActive) waitingForConnect = true;
- if(connectionState!=Channel::CONNECTED) {
- string mess(channelName +
- " connection state " + Channel::ConnectionStateNames[connectionState]);
- message(mess,errorMessage);
- channelConnectStatus = Status(Status::STATUSTYPE_ERROR,mess);
- connectState = notConnected;
- } else {
- connectState = connected;
- }
- if(waitingForConnect) waitForConnect.signal();
-}
-
-string EasyChannel::getRequesterName()
-{
- EasyPVAPtr yyy = easyPVA.lock();
- if(!yyy) throw std::runtime_error("EasyPVA was destroyed");
- return yyy->getRequesterName();
-}
-
-void EasyChannel::message(
- string const & message,
- MessageType messageType)
-{
- if(isDestroyed) throw std::runtime_error("easyChannel was destroyed");
- EasyPVAPtr yyy = easyPVA.lock();
- if(!yyy) throw std::runtime_error("EasyPVA was destroyed");
- yyy->message(message, messageType);
-}
-
-void EasyChannel::destroy()
-{
- {
- Lock xx(mutex);
- if(isDestroyed) return;
- isDestroyed = true;
- }
- if(channel) channel->destroy();
- channel.reset();
- easyGetCache.reset();
- easyPutCache.reset();
-}
-
-string EasyChannel::getChannelName()
-{
- if(isDestroyed) throw std::runtime_error("easyChannel was destroyed");
- return channelName;
-}
-
-Channel::shared_pointer EasyChannel::getChannel()
-{
- if(isDestroyed) throw std::runtime_error("easyChannel was destroyed");
- return channel;
-}
-
-void EasyChannel::connect(double timeout)
-{
- if(isDestroyed) throw std::runtime_error("easyChannel was destroyed");
- issueConnect();
- Status status = waitConnect(timeout);
- if(status.isOK()) return;
- stringstream ss;
- ss << "channel " << getChannelName() << " EasyChannel::connect " << status.getMessage();
- throw std::runtime_error(ss.str());
-}
-
-void EasyChannel::issueConnect()
-{
- if(isDestroyed) throw std::runtime_error("easyChannel was destroyed");
- if(connectState!=connectIdle) {
- throw std::runtime_error("easyChannel already connected");
- }
- channelRequester = ChannelRequester::shared_pointer(new ChannelRequesterImpl(this));
-
- channelConnectStatus = Status(
- Status::STATUSTYPE_ERROR,
- getChannelName() + " createChannel failed");
- connectState = connectActive;
- ChannelProviderRegistry::shared_pointer reg = getChannelProviderRegistry();
- ChannelProvider::shared_pointer provider = reg->getProvider(providerName);
- if(!provider) {
- throw std::runtime_error(getChannelName() + " provider " + providerName + " not registered");
- }
- channel = provider->createChannel(channelName,channelRequester,ChannelProvider::PRIORITY_DEFAULT);
- if(!channel) {
- throw std::runtime_error(channelConnectStatus.getMessage());
- }
-}
-
-Status EasyChannel::waitConnect(double timeout)
-{
- if(isDestroyed) throw std::runtime_error("easyChannel was destroyed");
- waitForConnect.wait(timeout);
- if(connectState==connected) return Status::Ok;
- return Status(Status::STATUSTYPE_ERROR,channelConnectStatus.getMessage());
-}
-
-EasyFieldPtr EasyChannel::createField()
-{
- return createField("");
-}
-
-EasyFieldPtr EasyChannel::createField(string const & subField)
-{
- throw std::runtime_error("EasyChannel::createField not implemented");
-}
-
-EasyProcessPtr EasyChannel::createProcess()
-{
- return createProcess("");
-}
-
-EasyProcessPtr EasyChannel::createProcess(string const & request)
-{
- PVStructurePtr pvRequest = createRequest->createRequest(request);
- if(!pvRequest) {
- stringstream ss;
- ss << "channel " << getChannelName();
- ss << " EasyChannel::createProcess invalid pvRequest: " + createRequest->getMessage();
- throw std::runtime_error(ss.str());
- }
- return createProcess(pvRequest);
-}
-
-EasyProcessPtr EasyChannel::createProcess(PVStructurePtr const & pvRequest)
-{
- if(connectState!=connected) connect(5.0);
- if(connectState!=connected) throw std::runtime_error("EasyChannel::creatProcess not connected");
- EasyPVAPtr yyy = easyPVA.lock();
- if(!yyy) throw std::runtime_error("EasyPVA was destroyed");
- return EasyProcess::create(yyy,getPtrSelf(),channel,pvRequest);
-}
-
-EasyGetPtr EasyChannel::get() {return get("value,alarm,timeStamp");}
-
-EasyGetPtr EasyChannel::get(string const & request)
-{
- EasyGetPtr easyGet = easyGetCache->getGet(request);
- if(easyGet) return easyGet;
- easyGet = createGet(request);
- easyGet->connect();
- easyGetCache->addGet(request,easyGet);
- return easyGet;
-}
-
-EasyGetPtr EasyChannel::createGet()
-{
- return EasyChannel::createGet("value,alarm,timeStamp");
-}
-
-EasyGetPtr EasyChannel::createGet(string const & request)
-{
- PVStructurePtr pvRequest = createRequest->createRequest(request);
- if(!pvRequest) {
- stringstream ss;
- ss << "channel " << getChannelName();
- ss << " EasyChannel::createGet invalid pvRequest: " + createRequest->getMessage();
- throw std::runtime_error(ss.str());
- }
- return createGet(pvRequest);
-}
-
-EasyGetPtr EasyChannel::createGet(PVStructurePtr const & pvRequest)
-{
- if(connectState!=connected) connect(5.0);
- if(connectState!=connected) throw std::runtime_error("EasyChannel::creatGet not connected");
- EasyPVAPtr yyy = easyPVA.lock();
- if(!yyy) throw std::runtime_error("EasyPVA was destroyed");
- return EasyGet::create(yyy,getPtrSelf(),channel,pvRequest);
-}
-
-EasyPutPtr EasyChannel::put() {return put("value");}
-
-EasyPutPtr EasyChannel::put(string const & request)
-{
- EasyPutPtr easyPut = easyPutCache->getPut(request);
- if(easyPut) return easyPut;
- easyPut = createPut(request);
- easyPut->connect();
- easyPut->get();
- easyPutCache->addPut(request,easyPut);
- return easyPut;
-}
-
-EasyPutPtr EasyChannel::createPut()
-{
- return createPut("value");
-}
-
-EasyPutPtr EasyChannel::createPut(string const & request)
-{
- PVStructurePtr pvRequest = createRequest->createRequest(request);
- if(!pvRequest) {
- stringstream ss;
- ss << "channel " << getChannelName();
- ss << " EasyChannel::createPut invalid pvRequest: " + createRequest->getMessage();
- throw std::runtime_error(ss.str());
- }
- return createPut(pvRequest);
-}
-
-EasyPutPtr EasyChannel::createPut(PVStructurePtr const & pvRequest)
-{
- if(connectState!=connected) connect(5.0);
- if(connectState!=connected) throw std::runtime_error("EasyChannel::creatPut not connected");
- EasyPVAPtr yyy = easyPVA.lock();
- if(!yyy) throw std::runtime_error("EasyPVA was destroyed");
- return EasyPut::create(yyy,getPtrSelf(),channel,pvRequest);
-}
-
-EasyPutGetPtr EasyChannel::createPutGet()
-{
- return createPutGet("putField(argument)getField(result)");
-}
-
-EasyPutGetPtr EasyChannel::createPutGet(string const & request)
-{
- PVStructurePtr pvRequest = createRequest->createRequest(request);
- if(!pvRequest) {
- stringstream ss;
- ss << "channel " << getChannelName();
- ss << " EasyChannel::createPutGet invalid pvRequest: " + createRequest->getMessage();
- throw std::runtime_error(ss.str());
- }
- return createPutGet(pvRequest);
-}
-
-EasyPutGetPtr EasyChannel::createPutGet(PVStructurePtr const & pvRequest)
-{
- if(connectState!=connected) connect(5.0);
- if(connectState!=connected) throw std::runtime_error("EasyChannel::creatPutGet not connected");
- EasyPVAPtr yyy = easyPVA.lock();
- if(!yyy) throw std::runtime_error("EasyPVA was destroyed");
- return EasyPutGet::create(yyy,getPtrSelf(),channel,pvRequest);
-}
-
-EasyRPCPtr EasyChannel::createRPC()
-{
- return createRPC("");
-}
-
-EasyRPCPtr EasyChannel::createRPC(string const & request)
-{
- PVStructurePtr pvRequest = createRequest->createRequest(request);
- if(!pvRequest) {
- stringstream ss;
- ss << "channel " << getChannelName();
- ss << " EasyChannel::createRPC invalid pvRequest: " + createRequest->getMessage();
- throw std::runtime_error(ss.str());
- }
- return createRPC(pvRequest);
-}
-
-EasyRPCPtr EasyChannel::createRPC(PVStructurePtr const & pvRequest)
-{
- throw std::runtime_error("EasyChannel::createRPC not implemented");
-}
-
-EasyArrayPtr EasyChannel::createArray()
-{
- return createArray("value");
-}
-
-EasyArrayPtr EasyChannel::createArray(string const & request)
-{
- PVStructurePtr pvRequest = createRequest->createRequest(request);
- if(!pvRequest) {
- stringstream ss;
- ss << "channel " << getChannelName();
- ss << " EasyChannel::createArray invalid pvRequest: " + createRequest->getMessage();
- throw std::runtime_error(ss.str());
- }
- return createArray(pvRequest);
-}
-
-EasyArrayPtr EasyChannel::createArray(PVStructurePtr const & pvRequest)
-{
- throw std::runtime_error("EasyChannel::createArray not implemented");
-}
-
-
-EasyMonitorPtr EasyChannel::monitor() {return monitor("value,alarm,timeStamp");}
-
-EasyMonitorPtr EasyChannel::monitor(string const & request)
-{
- EasyMonitorPtr easyMonitor = createMonitor(request);
- easyMonitor->connect();
- easyMonitor->start();
- return easyMonitor;
-}
-
-EasyMonitorPtr EasyChannel::monitor(EasyMonitorRequesterPtr const & easyMonitorRequester)
-{ return monitor("value,alarm,timeStamp",easyMonitorRequester);
-}
-
-EasyMonitorPtr EasyChannel::monitor(string const & request,
- EasyMonitorRequesterPtr const & easyMonitorRequester)
-{
- EasyMonitorPtr easyMonitor = createMonitor(request);
- easyMonitor->connect();
- easyMonitor->setRequester(easyMonitorRequester);
- easyMonitor->start();
- return easyMonitor;
-}
-
-EasyMonitorPtr EasyChannel::createMonitor()
-{
- return createMonitor("value,alarm,timeStamp");
-}
-
-EasyMonitorPtr EasyChannel::createMonitor(string const & request)
-{
- PVStructurePtr pvRequest = createRequest->createRequest(request);
- if(!pvRequest) {
- stringstream ss;
- ss << "channel " << getChannelName();
- ss << " EasyChannel::createMonitor invalid pvRequest: " + createRequest->getMessage();
- throw std::runtime_error(ss.str());
- }
- return createMonitor(pvRequest);
-}
-
-EasyMonitorPtr EasyChannel::createMonitor(PVStructurePtr const & pvRequest)
-{
- if(connectState!=connected) connect(5.0);
- if(connectState!=connected) throw std::runtime_error("EasyChannel::createMonitor not connected");
- EasyPVAPtr yyy = easyPVA.lock();
- if(!yyy) throw std::runtime_error("EasyPVA was destroyed");
- return EasyMonitor::create(yyy,getPtrSelf(),channel,pvRequest);
-}
-
-
-EasyChannelPtr EasyChannel::create(
- EasyPVAPtr const &easyPVA,
- string const & channelName,
- string const & providerName)
-{
- EasyChannelPtr channel(new EasyChannel(easyPVA,channelName,providerName));
- return channel;
-}
-
-}}
diff --git a/src/easyMonitor.cpp b/src/easyMonitor.cpp
deleted file mode 100644
index c862737..0000000
--- a/src/easyMonitor.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/* easyMonitor.cpp */
-/**
- * Copyright - See the COPYRIGHT that is included with this distribution.
- * EPICS pvData is distributed subject to a Software License Agreement found
- * in file LICENSE that is included with this distribution.
- */
-/**
- * @author mrk
- * @date 2015.03
- */
-#define epicsExportSharedSymbols
-
-#include
-#include
-#include
-#include
-
-using std::tr1::static_pointer_cast;
-using namespace epics::pvData;
-using namespace epics::pvAccess;
-using namespace std;
-
-namespace epics { namespace easyPVA {
-
-
-class ChannelMonitorRequester : public MonitorRequester
-{
- EasyMonitor * easyMonitor;
-public:
- ChannelMonitorRequester(EasyMonitor * easyMonitor)
- : easyMonitor(easyMonitor) {}
- string getRequesterName()
- {return easyMonitor->getRequesterName();}
- void message(string const & message,MessageType messageType)
- {easyMonitor->message(message,messageType);}
- void monitorConnect(
- const Status& status,
- Monitor::shared_pointer const & monitor,
- StructureConstPtr const & structure)
- {easyMonitor->monitorConnect(status,monitor,structure);}
- void monitorEvent(MonitorPtr const & monitor)
- {
- easyMonitor->monitorEvent(monitor);
- }
- void unlisten(MonitorPtr const & monitor)
- {easyMonitor->unlisten();}
-};
-
-EasyMonitor::EasyMonitor(
- EasyPVAPtr const &pva,
- EasyChannelPtr const & easyChannel,
- Channel::shared_pointer const & channel,
- PVStructurePtr const &pvRequest)
-: easyPVA(pva),
- easyChannel(easyChannel),
- channel(channel),
- pvRequest(pvRequest),
- isDestroyed(false),
- connectState(connectIdle),
- userPoll(false),
- userWait(false)
-{
-}
-
-EasyMonitor::~EasyMonitor()
-{
- destroy();
-}
-
-void EasyMonitor::checkMonitorState()
-{
- if(isDestroyed) throw std::runtime_error("easyMonitor was destroyed");
- if(connectState==connectIdle) connect();
- if(connectState==connected) start();
-}
-
-// from MonitorRequester
-string EasyMonitor::getRequesterName()
-{
- EasyPVAPtr yyy = easyPVA.lock();
- if(!yyy) throw std::runtime_error("easyPVA was destroyed");
- return yyy->getRequesterName();
-}
-
-void EasyMonitor::message(string const & message,MessageType messageType)
-{
- if(isDestroyed) throw std::runtime_error("easyMonitor was destroyed");
- EasyPVAPtr yyy = easyPVA.lock();
- if(!yyy) throw std::runtime_error("easyPVA was destroyed");
- yyy->message(message, messageType);
-}
-
-void EasyMonitor::monitorConnect(
- const Status& status,
- Monitor::shared_pointer const & monitor,
- StructureConstPtr const & structure)
-{
- if(isDestroyed) throw std::runtime_error("easyMonitor was destroyed");
- connectStatus = status;
- this->monitor = monitor;
- if(status.isOK()) {
- easyData = EasyMonitorData::create(structure);
- easyData->setMessagePrefix(channel->getChannelName());
- }
- waitForConnect.signal();
-
-}
-
-void EasyMonitor::monitorEvent(MonitorPtr const & monitor)
-{
- EasyMonitorRequesterPtr req = easyMonitorRequester.lock();
- if(req) req->event(getPtrSelf());
- if(userWait) waitForEvent.signal();
-}
-
-void EasyMonitor::unlisten()
-{
- destroy();
-}
-
-// from EasyMonitor
-void EasyMonitor::destroy()
-{
- {
- Lock xx(mutex);
- if(isDestroyed) return;
- isDestroyed = true;
- }
- if(monitor) monitor->destroy();
- monitor.reset();
-}
-
-void EasyMonitor::connect()
-{
- if(isDestroyed) throw std::runtime_error("easyMonitor was destroyed");
- issueConnect();
- Status status = waitConnect();
- if(status.isOK()) return;
- stringstream ss;
- ss << "channel " << channel->getChannelName() << " EasyMonitor::connect " << status.getMessage();
- throw std::runtime_error(ss.str());
-}
-
-void EasyMonitor::issueConnect()
-{
- if(isDestroyed) throw std::runtime_error("easyMonitor was destroyed");
- if(connectState!=connectIdle) {
- stringstream ss;
- ss << "channel " << channel->getChannelName() << " easyMonitor already connected ";
- throw std::runtime_error(ss.str());
- }
- monitorRequester = ChannelMonitorRequester::shared_pointer(new ChannelMonitorRequester(this));
- connectState = connectActive;
- monitor = channel->createMonitor(monitorRequester,pvRequest);
-}
-
-Status EasyMonitor::waitConnect()
-{
- if(isDestroyed) throw std::runtime_error("easyMonitor was destroyed");
- if(connectState!=connectActive) {
- stringstream ss;
- ss << "channel " << channel->getChannelName() << " easyMonitor illegal connect state ";
- throw std::runtime_error(ss.str());
- }
- waitForConnect.wait();
- if(connectStatus.isOK()){
- connectState = connected;
- return Status::Ok;
- }
- connectState = connectIdle;
- return Status(Status::STATUSTYPE_ERROR,connectStatus.getMessage());
-}
-
-void EasyMonitor::setRequester(EasyMonitorRequesterPtr const & easyMonitorrRequester)
-{
- this->easyMonitorRequester = easyMonitorrRequester;
-}
-
-void EasyMonitor::start()
-{
- if(isDestroyed) throw std::runtime_error("easyMonitor was destroyed");
- if(connectState==monitorStarted) return;
- if(connectState==connectIdle) connect();
- if(connectState!=connected) throw std::runtime_error("EasyMonitor::start illegal state");
- connectState = monitorStarted;
- monitor->start();
-}
-
-
-void EasyMonitor::stop()
-{
- if(isDestroyed) throw std::runtime_error("easyMonitor was destroyed");
- if(connectState!=monitorStarted) return;
- connectState = connected;
- monitor->stop();
-}
-
-bool EasyMonitor::poll()
-{
- checkMonitorState();
- if(connectState!=monitorStarted) throw std::runtime_error("EasyMonitor::poll illegal state");
- if(userPoll) throw std::runtime_error("EasyMonitor::poll did not release last");
- monitorElement = monitor->poll();
- if(!monitorElement) return false;
- userPoll = true;
- easyData->setData(monitorElement);
- return true;
-}
-
-bool EasyMonitor::waitEvent(double secondsToWait)
-{
- if(isDestroyed) throw std::runtime_error("easyMonitor was destroyed");
- if(connectState!=monitorStarted) throw std::runtime_error("EasyMonitor::poll illegal state");
- if(poll()) return true;
- userWait = true;
- if(secondsToWait==0.0) {
- waitForEvent.wait();
- } else {
- waitForEvent.wait(secondsToWait);
- }
- userWait = false;
- return poll();
-}
-
-void EasyMonitor::releaseEvent()
-{
- if(isDestroyed) throw std::runtime_error("easyMonitor was destroyed");
- if(connectState!=monitorStarted) throw std::runtime_error("EasyMonitor::poll illegal state");
- if(!userPoll) throw std::runtime_error("EasyMonitor::releaseEvent did not call poll");
- userPoll = false;
- monitor->release(monitorElement);
-}
-
-EasyMonitorDataPtr EasyMonitor::getData()
-{
- checkMonitorState();
- return easyData;
-}
-
-EasyMonitorPtr EasyMonitor::create(
- EasyPVAPtr const &pva,
- EasyChannelPtr const & easyChannel,
- Channel::shared_pointer const & channel,
- PVStructurePtr const &pvRequest)
-{
- EasyMonitorPtr epv(new EasyMonitor(pva,easyChannel,channel,pvRequest));
- return epv;
-}
-
-}}
diff --git a/src/easyMultiChannel.cpp b/src/easyMultiChannel.cpp
deleted file mode 100644
index a1d2f84..0000000
--- a/src/easyMultiChannel.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/* easyMultiChannel.cpp */
-/**
- * Copyright - See the COPYRIGHT that is included with this distribution.
- * EPICS pvData is distributed subject to a Software License Agreement found
- * in file LICENSE that is included with this distribution.
- */
-/**
- * @author mrk
- * @date 2015.02
- */
-#define epicsExportSharedSymbols
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-
-using std::tr1::static_pointer_cast;
-using namespace epics::pvData;
-using namespace epics::pvAccess;
-using namespace std;
-
-namespace epics { namespace easyPVA {
-
-
-
-EasyMultiChannel::EasyMultiChannel(
- EasyPVAPtr const &easyPVA,
- PVStringArrayPtr const & channelName,
- string const & providerName)
-: easyPVA(easyPVA),
- channelName(channelName),
- providerName(providerName),
- numChannel(channelName->getLength()),
- isConnected(getPVDataCreate()->createPVScalarArray()),
- isDestroyed(false)
-{
-}
-
-EasyMultiChannel::~EasyMultiChannel()
-{
- destroy();
-}
-
-void EasyMultiChannel::destroy()
-{
- {
- Lock xx(mutex);
- if(isDestroyed) return;
- isDestroyed = true;
- }
- easyChannelArray.reset();
-}
-
-PVStringArrayPtr EasyMultiChannel::getChannelNames()
-{
- if(isDestroyed) throw std::runtime_error("easyMultiChannel was destroyed");
- return channelName;
-}
-
-Status EasyMultiChannel::connect(double timeout,size_t maxNotConnected)
-{
- if(isDestroyed) throw std::runtime_error("easyMultiChannel was destroyed");
- if(easyChannelArray) throw std::runtime_error("easyMultiChannel already connected");
- EasyPVAPtr easy = easyPVA.lock();
- if(!easy) return Status(Status::STATUSTYPE_ERROR,"easyPVA is gone");
- shared_vector easyChannel(numChannel,EasyChannelPtr());
- PVStringArray::const_svector channelNames = channelName->view();
- shared_vector isConnected(numChannel,false);
- for(size_t i=0; i< numChannel; ++i) {
- easyChannel[i] = easy->createChannel(channelNames[i],providerName);
- easyChannel[i]->issueConnect();
- }
- Status returnStatus = Status::Ok;
- Status status = Status::Ok;
- size_t numBad = 0;
- for(size_t i=0; i< numChannel; ++i) {
- if(numBad==0) {
- status = easyChannel[i]->waitConnect(timeout);
- } else {
- status = easyChannel[i]->waitConnect(.001);
- }
- if(status.isOK()) {
- ++numConnected;
- isConnected[i] = true;
- continue;
- }
- if(returnStatus.isOK()) returnStatus = status;
- ++numBad;
- if(numBad>maxNotConnected) break;
- }
- easyChannelArray = EasyChannelArrayPtr(new EasyChannelArray(freeze(easyChannel)));
- this->isConnected->replace(freeze(isConnected));
- return numBad>maxNotConnected ? returnStatus : Status::Ok;
-}
-
-
-bool EasyMultiChannel::allConnected()
-{
- if(isDestroyed) throw std::runtime_error("easyMultiChannel was destroyed");
- if(!easyChannelArray) throw std::runtime_error("easyMultiChannel not connected");
- if(numConnected==numChannel) return true;
- return (numConnected==numChannel) ? true : false;
-}
-
-bool EasyMultiChannel::connectionChange()
-{
- if(isDestroyed) throw std::runtime_error("easyMultiChannel was destroyed");
- if(!easyChannelArray) throw std::runtime_error("easyMultiChannel not connected");
- if(numConnected==numChannel) return true;
- PVBooleanArray::const_svector isConnected = this->isConnected->view();
- shared_vector channels = *easyChannelArray.get();
- for(size_t i=0; igetChannel();
- Channel::ConnectionState stateNow = channel->getConnectionState();
- bool connectedNow = stateNow==Channel::CONNECTED ? true : false;
- if(connectedNow!=isConnected[i]) return true;
- }
- return false;
-}
-
-PVBooleanArrayPtr EasyMultiChannel::getIsConnected()
-{
- if(isDestroyed) throw std::runtime_error("easyMultiChannel was destroyed");
- if(!easyChannelArray) throw std::runtime_error("easyMultiChannel not connected");
- if(!connectionChange()) return isConnected;
- shared_vector isConnected(numChannel,false);
- shared_vector channels = *easyChannelArray.get();
- for(size_t i=0; igetChannel();
- Channel::ConnectionState stateNow = channel->getConnectionState();
- if(stateNow==Channel::CONNECTED) isConnected[i] = true;
- }
- this->isConnected->replace(freeze(isConnected));
- return this->isConnected;
-}
-
-EasyChannelArrayWPtr EasyMultiChannel::getEasyChannelArray()
-{
- if(isDestroyed) throw std::runtime_error("easyMultiChannel was destroyed");
- if(!easyChannelArray) throw std::runtime_error("easyMultiChannel not connected");
- return easyChannelArray;
-}
-
-EasyPVA::weak_pointer EasyMultiChannel::getEasyPVA()
-{
- if(isDestroyed) throw std::runtime_error("easyMultiChannel was destroyed");
- return easyPVA;
-}
-
-EasyMultiChannelPtr EasyMultiChannel::create(
- EasyPVAPtr const &easyPVA,
- PVStringArrayPtr const & channelNames,
- string const & providerName)
-{
- EasyMultiChannelPtr channel(new EasyMultiChannel(easyPVA,channelNames,providerName));
- return channel;
-}
-
-}}
diff --git a/src/easyMultiDouble.cpp b/src/easyMultiDouble.cpp
deleted file mode 100644
index c7f18f3..0000000
--- a/src/easyMultiDouble.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/* easyMultiDouble.cpp */
-/**
- * Copyright - See the COPYRIGHT that is included with this distribution.
- * EPICS pvData is distributed subject to a Software License Agreement found
- * in file LICENSE that is included with this distribution.
- */
-/**
- * @author mrk
- * @date 2015.03
- */
-
-#include
-
-using std::tr1::static_pointer_cast;
-using namespace epics::pvData;
-using namespace epics::pvAccess;
-using namespace std;
-
-namespace epics { namespace easyPVA {
-
-EasyMultiDoublePtr EasyMultiDouble::create(
- EasyPVAPtr const & easyPVA,
- PVStringArrayPtr const & channelName,
- double timeout,
- std::string const & providerName)
-{
- EasyMultiChannelPtr easyMultiChannel(
- EasyMultiChannel::create(easyPVA,channelName,providerName));
- Status status = easyMultiChannel->connect(timeout,0);
- if(!status.isOK()) throw std::runtime_error(status.getMessage());
- return EasyMultiDoublePtr(new EasyMultiDouble(easyMultiChannel));
-}
-
-EasyMultiDouble::EasyMultiDouble(EasyMultiChannelPtr const &easyMultiChannel)
-:
- easyMultiChannel(easyMultiChannel)
-{}
-
-EasyMultiDouble::~EasyMultiDouble()
-{
-}
-
-void EasyMultiDouble::createGet()
-{
- EasyChannelArrayPtr easyChannelArray = easyMultiChannel->getEasyChannelArray().lock();
- if(!easyChannelArray) throw std::runtime_error("easyChannelArray is gone");
- shared_vector easyChannels = *easyChannelArray;
- size_t numChannel = easyChannels.size();
- easyGet = std::vector(numChannel,EasyGetPtr());
- bool allOK = true;
- string message;
- for(size_t i=0; icreateGet("value");
- easyGet[i]->issueConnect();
- }
- for(size_t i=0; iwaitConnect();
- if(!status.isOK()) {
- message = "connect status " + status.getMessage();
- allOK = false;
- break;
- }
- }
- if(!allOK) throw std::runtime_error(message);
-}
-
-void EasyMultiDouble::createPut()
-{
- EasyChannelArrayPtr easyChannelArray = easyMultiChannel->getEasyChannelArray().lock();
- if(!easyChannelArray) throw std::runtime_error("easyChannelArray is gone");
- shared_vector easyChannels = *easyChannelArray;
- size_t numChannel = easyChannels.size();
- easyPut = std::vector(numChannel,EasyPutPtr());
- bool allOK = true;
- string message;
- for(size_t i=0; icreatePut("value");
- easyPut[i]->issueConnect();
- }
- for(size_t i=0; iwaitConnect();
- if(!status.isOK()) {
- message = "connect status " + status.getMessage();
- allOK = false;
- break;
- }
- }
- if(!allOK) throw std::runtime_error(message);
-}
-
-epics::pvData::shared_vector EasyMultiDouble::get()
-{
- if(easyGet.empty()) createGet();
- shared_vector channelNames = easyMultiChannel->getChannelNames()->view();
- size_t numChannel = channelNames.size();
- epics::pvData::shared_vector data(channelNames.size());
- for(size_t i=0; iissueGet();
- }
- for(size_t i=0; iwaitGet();
- if(!status.isOK()) {
- string message = channelNames[i] + " " + status.getMessage();
- throw std::runtime_error(message);
- }
- data[i] = easyGet[i]->getData()->getDouble();
- }
- return data;
-}
-
-void EasyMultiDouble::put(shared_vector const &value)
-{
- if(easyPut.empty()) createPut();
- shared_vector channelNames = easyMultiChannel->getChannelNames()->view();
- size_t numChannel = channelNames.size();
- for(size_t i=0; igetData()->putDouble(value[i]);
- easyPut[i]->issuePut();
- }
- for(size_t i=0; iwaitPut();
- if(!status.isOK()) {
- string message = channelNames[i] + " " + status.getMessage();
- throw std::runtime_error(message);
- }
- }
-}
-
-
-}}
diff --git a/src/easyPVA.cpp b/src/easyPVA.cpp
deleted file mode 100644
index a2c2dc6..0000000
--- a/src/easyPVA.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-/* easyPVA.cpp */
-/**
- * Copyright - See the COPYRIGHT that is included with this distribution.
- * EPICS pvData is distributed subject to a Software License Agreement found
- * in file LICENSE that is included with this distribution.
- */
-/**
- * @author mrk
- * @date 2015.02
- */
-
-#define epicsExportSharedSymbols
-#include
-#include
-#include
-#include
-#include
-
-using std::tr1::static_pointer_cast;
-using namespace epics::pvData;
-using namespace epics::pvAccess;
-using namespace epics::pvAccess::ca;
-using namespace std;
-
-namespace epics { namespace easyPVA {
-
-static FieldCreatePtr fieldCreate = getFieldCreate();
-static const string easyPVAName = "easyPVA";
-static const string defaultProvider = "pva";
-static UnionConstPtr variantUnion = fieldCreate->createVariantUnion();
-
-namespace easyPVAPvt {
-
- static size_t numberEasyPVA = 0;
- static bool firstTime = true;
- static Mutex mutex;
-
- class StartStopClientFactory {
- public:
- static void EasyPVABeingConstructed()
- {
- bool saveFirst = false;
- {
- Lock xx(mutex);
- ++numberEasyPVA;
- saveFirst = firstTime;
- firstTime = false;
- }
- if(saveFirst) {
- ClientFactory::start();
- CAClientFactory::start();
- }
- }
-
- static void EasyPVABeingDestroyed() {
- size_t numLeft = 0;
- {
- Lock xx(mutex);
- --numberEasyPVA;
- numLeft = numberEasyPVA;
- }
- if(numLeft<=0) {
- ClientFactory::stop();
- CAClientFactory::stop();
- }
- }
- };
-
-} // namespace easyPVAPvt
-
-class EasyChannelCache
-{
-public:
- EasyChannelCache(){}
- ~EasyChannelCache(){
- destroy();
- }
- void destroy() {
- easyChannelMap.clear();
- }
- EasyChannelPtr getChannel(string const & channelName);
- void addChannel(EasyChannelPtr const & easyChannel);
- void removeChannel(string const & channelName);
-private:
- map easyChannelMap;
-};
-
-EasyChannelPtr EasyChannelCache::getChannel(string const & channelName)
-{
- map::iterator iter = easyChannelMap.find(channelName);
- if(iter!=easyChannelMap.end()) return iter->second;
- return EasyChannelPtr();
-}
-
-void EasyChannelCache::addChannel(EasyChannelPtr const & easyChannel)
-{
- easyChannelMap.insert(std::pair(
- easyChannel->getChannelName(),easyChannel));
-}
-
-void EasyChannelCache::removeChannel(string const & channelName)
-{
- map::iterator iter = easyChannelMap.find(channelName);
- if(iter!=easyChannelMap.end()) easyChannelMap.erase(iter);
-}
-
-using namespace epics::easyPVA::easyPVAPvt;
-
-EasyPVAPtr EasyPVA::create()
-{
- EasyPVAPtr xx(new EasyPVA());
- StartStopClientFactory::EasyPVABeingConstructed();
- return xx;
-}
-
-PVStructurePtr EasyPVA::createRequest(string const &request)
-{
- CreateRequest::shared_pointer createRequest = CreateRequest::create();
- PVStructurePtr pvRequest = createRequest->createRequest(request);
- if(!pvRequest) {
- throw std::invalid_argument("invalid pvRequest: " + createRequest->getMessage());
- }
- return pvRequest;
-}
-
-EasyPVA::EasyPVA()
-: easyChannelCache(new EasyChannelCache()),
- isDestroyed(false)
-{
-}
-
-EasyPVA::~EasyPVA() {
- destroy();
-}
-
-void EasyPVA::destroy()
-{
- {
- Lock xx(mutex);
- if(isDestroyed) return;
- isDestroyed = true;
- }
- easyChannelCache.reset();
- channelList.clear();
- multiChannelList.clear();
- StartStopClientFactory::EasyPVABeingDestroyed();
-}
-
-string EasyPVA:: getRequesterName()
-{
- static string name("easyPVA");
- return name;
-}
-
-void EasyPVA::message(
- string const & message,
- MessageType messageType)
-{
- cout << getMessageTypeName(messageType) << " " << message << endl;
-}
-
-EasyChannelPtr EasyPVA::channel(
- std::string const & channelName,
- std::string const & providerName,
- double timeOut)
-{
- EasyChannelPtr easyChannel = easyChannelCache->getChannel(channelName);
- if(easyChannel) return easyChannel;
- easyChannel = createChannel(channelName,providerName);
- easyChannel->connect(timeOut);
- easyChannelCache->addChannel(easyChannel);
- return easyChannel;
-}
-
-EasyChannelPtr EasyPVA::createChannel(string const & channelName)
-{
- return EasyChannel::create(getPtrSelf(),channelName);
-}
-
-EasyChannelPtr EasyPVA::createChannel(string const & channelName, string const & providerName)
-{
- return EasyChannel::create(getPtrSelf(),channelName,providerName);
-}
-
-EasyMultiChannelPtr EasyPVA::createMultiChannel(
- epics::pvData::PVStringArrayPtr const & channelNames)
-{
- return createMultiChannel(channelNames,"pva");
-}
-
-EasyMultiChannelPtr EasyPVA::createMultiChannel(
- epics::pvData::PVStringArrayPtr const & channelNames,
- std::string const & providerName)
-{
- return EasyMultiChannel::create(getPtrSelf(),channelNames,providerName);
-}
-
-}}
-
diff --git a/src/pvaClient.cpp b/src/pvaClient.cpp
new file mode 100644
index 0000000..c88533c
--- /dev/null
+++ b/src/pvaClient.cpp
@@ -0,0 +1,199 @@
+/* pvaClient.cpp */
+/**
+ * Copyright - See the COPYRIGHT that is included with this distribution.
+ * EPICS pvData is distributed subject to a Software License Agreement found
+ * in file LICENSE that is included with this distribution.
+ */
+/**
+ * @author mrk
+ * @date 2015.02
+ */
+
+#define epicsExportSharedSymbols
+#include
+#include
+#include
+#include
+#include
+
+using std::tr1::static_pointer_cast;
+using namespace epics::pvData;
+using namespace epics::pvAccess;
+using namespace epics::pvAccess::ca;
+using namespace std;
+
+namespace epics { namespace pvaClient {
+
+static FieldCreatePtr fieldCreate = getFieldCreate();
+static const string pvaClientName = "pvaClient";
+static const string defaultProvider = "pva";
+static UnionConstPtr variantUnion = fieldCreate->createVariantUnion();
+
+namespace pvaClientPvt {
+
+ static size_t numberPvaClient = 0;
+ static bool firstTime = true;
+ static Mutex mutex;
+
+ class StartStopClientFactory {
+ public:
+ static void PvaClientBeingConstructed()
+ {
+ bool saveFirst = false;
+ {
+ Lock xx(mutex);
+ ++numberPvaClient;
+ saveFirst = firstTime;
+ firstTime = false;
+ }
+ if(saveFirst) {
+ ClientFactory::start();
+ CAClientFactory::start();
+ }
+ }
+
+ static void PvaClientBeingDestroyed() {
+ size_t numLeft = 0;
+ {
+ Lock xx(mutex);
+ --numberPvaClient;
+ numLeft = numberPvaClient;
+ }
+ if(numLeft<=0) {
+ ClientFactory::stop();
+ CAClientFactory::stop();
+ }
+ }
+ };
+
+} // namespace pvaClientPvt
+
+class PvaClientChannelCache
+{
+public:
+ PvaClientChannelCache(){}
+ ~PvaClientChannelCache(){
+ destroy();
+ }
+ void destroy() {
+ pvaClientChannelMap.clear();
+ }
+ PvaClientChannelPtr getChannel(string const & channelName);
+ void addChannel(PvaClientChannelPtr const & pvaClientChannel);
+ void removeChannel(string const & channelName);
+private:
+ map pvaClientChannelMap;
+};
+
+PvaClientChannelPtr PvaClientChannelCache::getChannel(string const & channelName)
+{
+ map::iterator iter = pvaClientChannelMap.find(channelName);
+ if(iter!=pvaClientChannelMap.end()) return iter->second;
+ return PvaClientChannelPtr();
+}
+
+void PvaClientChannelCache::addChannel(PvaClientChannelPtr const & pvaClientChannel)
+{
+ pvaClientChannelMap.insert(std::pair(
+ pvaClientChannel->getChannelName(),pvaClientChannel));
+}
+
+void PvaClientChannelCache::removeChannel(string const & channelName)
+{
+ map::iterator iter = pvaClientChannelMap.find(channelName);
+ if(iter!=pvaClientChannelMap.end()) pvaClientChannelMap.erase(iter);
+}
+
+using namespace epics::pvaClient::pvaClientPvt;
+
+PvaClientPtr PvaClient::create()
+{
+ PvaClientPtr xx(new PvaClient());
+ StartStopClientFactory::PvaClientBeingConstructed();
+ return xx;
+}
+
+PVStructurePtr PvaClient::createRequest(string const &request)
+{
+ CreateRequest::shared_pointer createRequest = CreateRequest::create();
+ PVStructurePtr pvRequest = createRequest->createRequest(request);
+ if(!pvRequest) {
+ throw std::invalid_argument("invalid pvRequest: " + createRequest->getMessage());
+ }
+ return pvRequest;
+}
+
+PvaClient::PvaClient()
+: pvaClientChannelCache(new PvaClientChannelCache()),
+ isDestroyed(false)
+{
+}
+
+PvaClient::~PvaClient() {
+ destroy();
+}
+
+void PvaClient::destroy()
+{
+ {
+ Lock xx(mutex);
+ if(isDestroyed) return;
+ isDestroyed = true;
+ }
+ pvaClientChannelCache.reset();
+ channelList.clear();
+ multiChannelList.clear();
+ StartStopClientFactory::PvaClientBeingDestroyed();
+}
+
+string PvaClient:: getRequesterName()
+{
+ static string name("pvaClient");
+ return name;
+}
+
+void PvaClient::message(
+ string const & message,
+ MessageType messageType)
+{
+ cout << getMessageTypeName(messageType) << " " << message << endl;
+}
+
+PvaClientChannelPtr PvaClient::channel(
+ std::string const & channelName,
+ std::string const & providerName,
+ double timeOut)
+{
+ PvaClientChannelPtr pvaClientChannel = pvaClientChannelCache->getChannel(channelName);
+ if(pvaClientChannel) return pvaClientChannel;
+ pvaClientChannel = createChannel(channelName,providerName);
+ pvaClientChannel->connect(timeOut);
+ pvaClientChannelCache->addChannel(pvaClientChannel);
+ return pvaClientChannel;
+}
+
+PvaClientChannelPtr PvaClient::createChannel(string const & channelName)
+{
+ return PvaClientChannel::create(getPtrSelf(),channelName);
+}
+
+PvaClientChannelPtr PvaClient::createChannel(string const & channelName, string const & providerName)
+{
+ return PvaClientChannel::create(getPtrSelf(),channelName,providerName);
+}
+
+PvaClientMultiChannelPtr PvaClient::createMultiChannel(
+ epics::pvData::PVStringArrayPtr const & channelNames)
+{
+ return createMultiChannel(channelNames,"pvaClient");
+}
+
+PvaClientMultiChannelPtr PvaClient::createMultiChannel(
+ epics::pvData::PVStringArrayPtr const & channelNames,
+ std::string const & providerName)
+{
+ return PvaClientMultiChannel::create(getPtrSelf(),channelNames,providerName);
+}
+
+}}
+
diff --git a/src/easyPVA.h b/src/pvaClient.h
similarity index 74%
rename from src/easyPVA.h
rename to src/pvaClient.h
index 243ad1b..b79db45 100644
--- a/src/easyPVA.h
+++ b/src/pvaClient.h
@@ -1,4 +1,4 @@
-/* easyPVA.h */
+/* pvaClient.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -8,11 +8,11 @@
* @author mrk
* @date 2015.02
*/
-#ifndef EASYPVA_H
-#define EASYPVA_H
+#ifndef PVACLIENT_H
+#define PVACLIENT_H
#ifdef epicsExportSharedSymbols
-# define easyPVAEpicsExportSharedSymbols
+# define pvaClientEpicsExportSharedSymbols
# undef epicsExportSharedSymbols
#endif
@@ -34,78 +34,78 @@
#include
#include
-#ifdef easyPVAEpicsExportSharedSymbols
+#ifdef pvaClientEpicsExportSharedSymbols
# define epicsExportSharedSymbols
-# undef easyPVAEpicsExportSharedSymbols
+# undef pvaClientEpicsExportSharedSymbols
#endif
#include
-namespace epics { namespace easyPVA {
+namespace epics { namespace pvaClient {
-class EasyPVA;
-typedef std::tr1::shared_ptr EasyPVAPtr;
-class EasyGetData;
-typedef std::tr1::shared_ptr EasyGetDataPtr;
-class EasyPutData;
-typedef std::tr1::shared_ptr EasyPutDataPtr;
-class EasyMonitorData;
-typedef std::tr1::shared_ptr EasyMonitorDataPtr;
-class EasyChannel;
-typedef std::tr1::shared_ptr EasyChannelPtr;
-class EasyField;
-typedef std::tr1::shared_ptr EasyFieldPtr;
-class EasyProcess;
-typedef std::tr1::shared_ptr EasyProcessPtr;
-class EasyGet;
-typedef std::tr1::shared_ptr EasyGetPtr;
-class EasyPut;
-typedef std::tr1::shared_ptr EasyPutPtr;
-class EasyPutGet;
-typedef std::tr1::shared_ptr EasyPutGetPtr;
-class EasyMonitor;
-typedef std::tr1::shared_ptr EasyMonitorPtr;
-class EasyMonitorRequester;
-typedef std::tr1::shared_ptr EasyMonitorRequesterPtr;
-class EasyArray;
-typedef std::tr1::shared_ptr EasyArrayPtr;
-class EasyRPC;
-typedef std::tr1::shared_ptr EasyRPCPtr;
+class PvaClient;
+typedef std::tr1::shared_ptr PvaClientPtr;
+class PvaClientGetData;
+typedef std::tr1::shared_ptr PvaClientGetDataPtr;
+class PvaClientPutData;
+typedef std::tr1::shared_ptr PvaClientPutDataPtr;
+class PvaClientMonitorData;
+typedef std::tr1::shared_ptr PvaClientMonitorDataPtr;
+class PvaClientChannel;
+typedef std::tr1::shared_ptr PvaClientChannelPtr;
+class PvaClientField;
+typedef std::tr1::shared_ptr PvaClientFieldPtr;
+class PvaClientProcess;
+typedef std::tr1::shared_ptr PvaClientProcessPtr;
+class PvaClientGet;
+typedef std::tr1::shared_ptr PvaClientGetPtr;
+class PvaClientPut;
+typedef std::tr1::shared_ptr PvaClientPutPtr;
+class PvaClientPutGet;
+typedef std::tr1::shared_ptr PvaClientPutGetPtr;
+class PvaClientMonitor;
+typedef std::tr1::shared_ptr PvaClientMonitorPtr;
+class PvaClientMonitorRequester;
+typedef std::tr1::shared_ptr PvaClientMonitorRequesterPtr;
+class PvaClientArray;
+typedef std::tr1::shared_ptr PvaClientArrayPtr;
+class PvaClientRPC;
+typedef std::tr1::shared_ptr PvaClientRPCPtr;
-typedef epics::pvData::shared_vector EasyChannelArray;
-typedef std::tr1::shared_ptr EasyChannelArrayPtr;
-typedef std::tr1::weak_ptr EasyChannelArrayWPtr;
+typedef epics::pvData::shared_vector PvaClientChannelArray;
+typedef std::tr1::shared_ptr PvaClientChannelArrayPtr;
+typedef std::tr1::weak_ptr PvaClientChannelArrayWPtr;
-class EasyMultiChannel;
-typedef std::tr1::shared_ptr EasyMultiChannelPtr;
-class EasyMultiChannelGet;
+class PvaClientMultiChannel;
+typedef std::tr1::shared_ptr PvaClientMultiChannelPtr;
+class PvaClientMultiChannelGet;
-// following are private to easyPVA
-class EasyChannelCache;
-typedef std::tr1::shared_ptr EasyChannelCachePtr;
+// following are private to pvaClient
+class PvaClientChannelCache;
+typedef std::tr1::shared_ptr PvaClientChannelCachePtr;
/**
- * @brief EasyPVA is an easy to use interface to pvAccess.
+ * @brief PvaClient is a synchronous interface to pvAccess plus convenience methods.
*
* @author mrk
*/
-class epicsShareClass EasyPVA :
+class epicsShareClass PvaClient :
public epics::pvData::Requester,
- public std::tr1::enable_shared_from_this
+ public std::tr1::enable_shared_from_this
{
public:
- POINTER_DEFINITIONS(EasyPVA);
+ POINTER_DEFINITIONS(PvaClient);
/**
* Destructor
*/
- ~EasyPVA();
+ ~PvaClient();
/**
- * @brief Create an instance of EasyPVA
+ * @brief Create an instance of PvaClient
* @return shared_ptr to new instance.
*/
- static EasyPVAPtr create();
+ static PvaClientPtr create();
/** @brief get the requester name.
* @return The name.
*/
@@ -126,12 +126,12 @@ public:
void destroy();
/**
* @brief get a cached channel or create and connect to a new channel.
- * The provider is pva. The timeout is 5 seconds.
+ * The provider is pvaClient. The timeout is 5 seconds.
* If connection can not be made an exception is thrown.
* @param channelName The channelName.
* @return The interface.
*/
- EasyChannelPtr channel(std::string const & channelName)
+ PvaClientChannelPtr channel(std::string const & channelName)
{ return channel(channelName,"pva", 5.0); }
/**
* @brief get a cached channel or create and connect to a new channel.
@@ -139,118 +139,118 @@ public:
* @param channelName The channelName.
* @return The interface.
*/
- EasyChannelPtr channel(
+ PvaClientChannelPtr channel(
std::string const & channelName,
std::string const &providerName,
double timeOut);
/**
- * @brief Create an EasyChannel. The provider is pva.
+ * @brief Create an PvaClientChannel. The provider is pvaClient.
* @param channelName The channelName.
* @return The interface.
*/
- EasyChannelPtr createChannel(std::string const & channelName);
+ PvaClientChannelPtr createChannel(std::string const & channelName);
/**
- * @brief Create an EasyChannel with the specified provider.
+ * @brief Create an PvaClientChannel with the specified provider.
* @param channelName The channelName.
* @param providerName The provider.
* @return The interface or null if the provider does not exist.
*/
- EasyChannelPtr createChannel(
+ PvaClientChannelPtr createChannel(
std::string const & channelName,
std::string const & providerName);
/**
- * @brief Create an EasyMultiChannel. The provider is pvAccess.
+ * @brief Create an PvaClientMultiChannel. The provider is pvAccess.
* @param channelName The channelName array.
* @return The interface.
*/
- EasyMultiChannelPtr createMultiChannel(
+ PvaClientMultiChannelPtr createMultiChannel(
epics::pvData::PVStringArrayPtr const & channelNames);
/**
- * @brief Create an EasyMultiChannel with the specified provider.
+ * @brief Create an PvaClientMultiChannel with the specified provider.
* @param channelName The channelName array.
* @param providerName The provider.
* @return The interface.
*/
- EasyMultiChannelPtr createMultiChannel(
+ PvaClientMultiChannelPtr createMultiChannel(
epics::pvData::PVStringArrayPtr const & channelNames,
std::string const & providerName);
/**
* @brief Set a requester.
- * The default is for EasyPVA to handle messages by printing to System.out.
+ * The default is for PvaClient to handle messages by printing to System.out.
* @param requester The requester.
*/
void setRequester(epics::pvData::RequesterPtr const & requester);
/**
- * @brief Clear the requester. EasyPVA will handle messages.
+ * @brief Clear the requester. PvaClient will handle messages.
*/
void clearRequester();
/**
* @brief get shared pointer to this
*/
- EasyPVAPtr getPtrSelf()
+ PvaClientPtr getPtrSelf()
{
return shared_from_this();
}
private:
- EasyPVA();
- EasyChannelCachePtr easyChannelCache;
+ PvaClient();
+ PvaClientChannelCachePtr pvaClientChannelCache;
epics::pvData::PVStructurePtr createRequest(std::string const &request);
- std::list channelList;
- std::list multiChannelList;
+ std::list channelList;
+ std::list multiChannelList;
epics::pvData::Requester::weak_pointer requester;
bool isDestroyed;
epics::pvData::Mutex mutex;
};
-// folowing private to EasyChannel
-class EasyGetCache;
-typedef std::tr1::shared_ptr EasyGetCachePtr;
-class EasyPutCache;
-typedef std::tr1::shared_ptr EasyPutCachePtr;
+// folowing private to PvaClientChannel
+class PvaClientGetCache;
+typedef std::tr1::shared_ptr PvaClientGetCachePtr;
+class PvaClientPutCache;
+typedef std::tr1::shared_ptr PvaClientPutCachePtr;
class ChannelRequesterImpl;
/**
* @brief An easy to use alternative to directly calling the Channel methods of pvAccess.
*
* @author mrk
*/
-class epicsShareClass EasyChannel :
- public std::tr1::enable_shared_from_this
+class epicsShareClass PvaClientChannel :
+ public std::tr1::enable_shared_from_this
{
public:
- POINTER_DEFINITIONS(EasyChannel);
+ POINTER_DEFINITIONS(PvaClientChannel);
/**
- * @brief Create a EasyChannel.
- * @param easyPVA Interface to EasyPVA
+ * @brief Create a PvaClientChannel.
+ * @param pvaClient Interface to PvaClient
* @param channelName The name of the channel.
* @return The interface.
*/
- static EasyChannelPtr create(
- EasyPVAPtr const &easyPVA,
+ static PvaClientChannelPtr create(
+ PvaClientPtr const &pvaClient,
std::string const & channelName)
- {return create(easyPVA,channelName,"pva");}
+ {return create(pvaClient,channelName,"pva");}
/**
- * @brief Create a EasyChannel.
+ * @brief Create a PvaClientChannel.
* @param channelName The name of the channel.
* @param providerName The name of the provider.
- * @return The interface to the EasyPVAStructure.
+ * @return The interface to the PvaClientStructure.
*/
- static EasyChannelPtr create(
- EasyPVAPtr const &easyPVA,
+ static PvaClientChannelPtr create(
+ PvaClientPtr const &pvaClient,
std::string const & channelName,
std::string const & providerName);
- ~EasyChannel();
+ ~PvaClientChannel();
/**
* @brief Destroy the pvAccess connection.
*/
void destroy();
/**
- * @brief Get the name of the channel to which EasyChannel is connected.
+ * @brief Get the name of the channel to which PvaClientChannel is connected.
* @return The channel name.
*/
std::string getChannelName();
/**
- * @brief Get the the channel to which EasyChannel is connected.
+ * @brief Get the the channel to which PvaClientChannel is connected.
* @return The channel interface.
*/
epics::pvAccess::Channel::shared_pointer getChannel();
@@ -275,196 +275,196 @@ public:
* @brief Calls the next method with subField = "";
* @return The interface.
*/
- EasyFieldPtr createField();
+ PvaClientFieldPtr createField();
/**
- * @brief Create an EasyField for the specified subField.
+ * @brief Create an PvaClientField for the specified subField.
* @param subField The syntax for subField is defined in package org.epics.pvdata.copy
* @return The interface.
*/
- EasyFieldPtr createField(std::string const & subField);
+ PvaClientFieldPtr createField(std::string const & subField);
/**
* @brief Calls the next method with request = "";
* @return The interface.
*/
- EasyProcessPtr createProcess();
+ PvaClientProcessPtr createProcess();
/**
* @brief First call createRequest as implemented by pvDataJava and then calls the next method.
* @param request The request as described in package org.epics.pvdata.copy
* @return The interface.
*/
- EasyProcessPtr createProcess(std::string const & request);
+ PvaClientProcessPtr createProcess(std::string const & request);
/**
- * @brief Creates an EasyProcess.
+ * @brief Creates an PvaClientProcess.
* @param pvRequest The syntax of pvRequest is described in package org.epics.pvdata.copy.
* @return The interface.
*/
- EasyProcessPtr createProcess(epics::pvData::PVStructurePtr const & pvRequest);
+ PvaClientProcessPtr createProcess(epics::pvData::PVStructurePtr const & pvRequest);
/**
* @brief Call the next method with request = "field(value,alarm,timeStamp)"
* @return The interface.
*/
- EasyGetPtr get();
+ PvaClientGetPtr get();
/**
- * @brief get a cached EasyGet or create and connect to a new EasyGet.
+ * @brief get a cached PvaClientGet or create and connect to a new PvaClientGet.
* Then call it's get method.
* If connection can not be made an exception is thrown.
* @param request The request as described in package org.epics.pvdata.copy
* @return The interface.
*/
- EasyGetPtr get(std::string const & request);
+ PvaClientGetPtr get(std::string const & request);
/**
* @brief Call the next method with request = "field(value,alarm,timeStamp)"
* @return The interface.
*/
- EasyGetPtr createGet();
+ PvaClientGetPtr createGet();
/**
* @brief First call createRequest as implemented by pvDataJava and then call the next method.
* @param request The request as described in package org.epics.pvdata.copy
* @return The interface.
*/
- EasyGetPtr createGet(std::string const & request);
+ PvaClientGetPtr createGet(std::string const & request);
/**
- * @brief Creates an EasyGet.
+ * @brief Creates an PvaClientGet.
* @param pvRequest The syntax of pvRequest is described in package org.epics.pvdata.copy.
* @return The interface.
*/
- EasyGetPtr createGet(epics::pvData::PVStructurePtr const & pvRequest);
+ PvaClientGetPtr createGet(epics::pvData::PVStructurePtr const & pvRequest);
/**
* @brief Call the next method with request = "field(value)"
* @return The interface.
*/
- EasyPutPtr put();
+ PvaClientPutPtr put();
/**
- * @brief get a cached EasyPut or create and connect to a new EasyPut.
+ * @brief get a cached PvaClientPut or create and connect to a new PvaClientPut.
* Then call it's get method.
* If connection can not be made an exception is thrown.
* @param request The request as described in package org.epics.pvdata.copy
* @return The interface.
*/
- EasyPutPtr put(std::string const & request);
+ PvaClientPutPtr put(std::string const & request);
/**
* @brief Call the next method with request = "field(value)"
* @return The interface.
*/
- EasyPutPtr createPut();
+ PvaClientPutPtr createPut();
/**
* @brief First call createRequest as implemented by pvDataJava and then calls the next method.
* @param request The request as described in package org.epics.pvdata.copy
* @return The interface.
*/
- EasyPutPtr createPut(std::string const & request);
+ PvaClientPutPtr createPut(std::string const & request);
/**
- * @brief Create an EasyPut.
+ * @brief Create an PvaClientPut.
* @param pvRequest The syntax of pvRequest is described in package org.epics.pvdata.copy.
* @return The interface.
*/
- EasyPutPtr createPut(epics::pvData::PVStructurePtr const & pvRequest);
+ PvaClientPutPtr createPut(epics::pvData::PVStructurePtr const & pvRequest);
/**
* @brief Call the next method with request = "record[process=true]putField(argument)getField(result)".
* @return The interface.
*/
- EasyPutGetPtr createPutGet();
+ PvaClientPutGetPtr createPutGet();
/**
* @brief First call createRequest as implemented by pvDataJava and then calls the next method.
* @param request The request as described in package org.epics.pvdata.copy
* @return The interface.
*/
- EasyPutGetPtr createPutGet(std::string const & request);
+ PvaClientPutGetPtr createPutGet(std::string const & request);
/**
- * @brief Create an EasyPutGet.
+ * @brief Create an PvaClientPutGet.
* @param pvRequest The syntax of pvRequest is described in package org.epics.pvdata.copy.
* @return The interface.
*/
- EasyPutGetPtr createPutGet(epics::pvData::PVStructurePtr const & pvRequest);
+ PvaClientPutGetPtr createPutGet(epics::pvData::PVStructurePtr const & pvRequest);
/**
* @brief Call createRPC(PVStructure(null))
* @return The interface.
*/
- EasyRPCPtr createRPC();
+ PvaClientRPCPtr createRPC();
/**
* @brief First call createRequest as implemented by pvDataJava and then calls the next method.
* @param request The request as described in package org.epics.pvdata.copy
* @return The interface.
*/
- EasyRPCPtr createRPC(std::string const & request);
+ PvaClientRPCPtr createRPC(std::string const & request);
/**
- * @brief Create an EasyRPC.
+ * @brief Create an PvaClientRPC.
* @param pvRequest The syntax of pvRequest is described in package org.epics.pvdata.copy.
* @return The interface.
*/
- EasyRPCPtr createRPC(epics::pvData::PVStructurePtr const & pvRequest);
+ PvaClientRPCPtr createRPC(epics::pvData::PVStructurePtr const & pvRequest);
/**
* @brief Call the next method with request = "field(value)";
* @return The interface.
*/
- EasyArrayPtr createArray();
+ PvaClientArrayPtr createArray();
/**
* @brief First call createRequest as implemented by pvDataJava and then calls the next method.
* @param request The request as described in package org.epics.pvdata.copy
* @return The interface.
*/
- EasyArrayPtr createArray(std::string const & request);
+ PvaClientArrayPtr createArray(std::string const & request);
/**
- * @brief Create an EasyArray.
+ * @brief Create an PvaClientArray.
* @param pvRequest The syntax of pvRequest is described in package org.epics.pvdata.copy.
* @return The interface.
*/
- EasyArrayPtr createArray(epics::pvData::PVStructurePtr const & pvRequest);
+ PvaClientArrayPtr createArray(epics::pvData::PVStructurePtr const & pvRequest);
/**
* @brief Call the next method with request = "field(value,alarm,timeStamp)"
* @return The interface.
*/
- EasyMonitorPtr monitor();
+ PvaClientMonitorPtr monitor();
/**
- * @brief get a cached EasyMonitor or create and connect to a new EasyMonitor.
+ * @brief get a cached PvaClientMonitor or create and connect to a new PvaClientMonitor.
* Then call it's start method.
* If connection can not be made an exception is thrown.
* @param request The request as described in package org.epics.pvdata.copy
* @return The interface.
*/
- EasyMonitorPtr monitor(std::string const & request);
+ PvaClientMonitorPtr monitor(std::string const & request);
/**
* @brief Call the next method with request = "field(value,alarm,timeStamp)"
- * @param easyMonitorRequester The client callback.
+ * @param pvaClientMonitorRequester The client callback.
* @return The interface.
*/
- EasyMonitorPtr monitor(EasyMonitorRequesterPtr const & easyMonitorRequester);
+ PvaClientMonitorPtr monitor(PvaClientMonitorRequesterPtr const & pvaClientMonitorRequester);
/**
- * @brief get a cached EasyMonitor or create and connect to a new EasyMonitor.
+ * @brief get a cached PvaClientMonitor or create and connect to a new PvaClientMonitor.
* Then call it's start method.
* If connection can not be made an exception is thrown.
* @param request The request as described in package org.epics.pvdata.copy
- * @param easyMonitorRequester The client callback.
+ * @param pvaClientMonitorRequester The client callback.
* @return The interface.
*/
- EasyMonitorPtr monitor(
+ PvaClientMonitorPtr monitor(
std::string const & request,
- EasyMonitorRequesterPtr const & easyMonitorRequester);
+ PvaClientMonitorRequesterPtr const & pvaClientMonitorRequester);
/**
* @brief Call the next method with request = "field(value.alarm,timeStamp)"
* @return The interface.
*/
- EasyMonitorPtr createMonitor();
+ PvaClientMonitorPtr createMonitor();
/**
* @brief First call createRequest as implemented by pvDataJava and then calls the next method.
* @param request The request as described in package org.epics.pvdata.copy
* @return The interface.
*/
- EasyMonitorPtr createMonitor(std::string const & request);
+ PvaClientMonitorPtr createMonitor(std::string const & request);
/**
- * @brief Create an EasyMonitor.
+ * @brief Create an PvaClientMonitor.
* @param pvRequest The syntax of pvRequest is described in package org.epics.pvdata.copy.
* @return The interface.
*/
- EasyMonitorPtr createMonitor(epics::pvData::PVStructurePtr const & pvRequest);
- EasyChannelPtr getPtrSelf()
+ PvaClientMonitorPtr createMonitor(epics::pvData::PVStructurePtr const & pvRequest);
+ PvaClientChannelPtr getPtrSelf()
{
return shared_from_this();
}
private:
- EasyChannel(
- EasyPVAPtr const &pva,
+ PvaClientChannel(
+ PvaClientPtr const &pvaClient,
std::string const & channelName,
std::string const & providerName);
void channelCreated(
@@ -480,14 +480,14 @@ private:
enum ConnectState {connectIdle,connectActive,notConnected,connected};
- EasyPVA::weak_pointer easyPVA;
+ PvaClient::weak_pointer pvaClient;
std::string channelName;
std::string providerName;
ConnectState connectState;
bool isDestroyed;
epics::pvData::CreateRequest::shared_pointer createRequest;
- EasyGetCachePtr easyGetCache;
- EasyPutCachePtr easyPutCache;
+ PvaClientGetCachePtr pvaClientGetCache;
+ PvaClientPutCachePtr pvaClientPutCache;
epics::pvData::Status channelConnectStatus;
epics::pvData::Mutex mutex;
@@ -498,18 +498,18 @@ private:
};
/**
- * @brief This is a class that holds data returned by EasyGet or EasyPutGet
+ * @brief This is a class that holds data returned by PvaClientGet or PvaClientPutGet
*
*/
-class epicsShareClass EasyGetData
+class epicsShareClass PvaClientGetData
{
public:
- POINTER_DEFINITIONS(EasyGetData);
+ POINTER_DEFINITIONS(PvaClientGetData);
/**
- * @brief Factory method for creating an instance of EasyGetData.
+ * @brief Factory method for creating an instance of PvaClientGetData.
*/
- static EasyGetDataPtr create(epics::pvData::StructureConstPtr const & structure);
- ~EasyGetData() {}
+ static PvaClientGetDataPtr create(epics::pvData::StructureConstPtr const & structure);
+ ~PvaClientGetData() {}
/**
* @brief Set a prefix for throw messages.
* @param value The prefix.
@@ -618,7 +618,7 @@ public:
*/
epics::pvData::TimeStamp getTimeStamp();
private:
- EasyGetData(epics::pvData::StructureConstPtr const & structure);
+ PvaClientGetData(epics::pvData::StructureConstPtr const & structure);
void checkValue();
epics::pvData::StructureConstPtr structure;
epics::pvData::PVStructurePtr pvStructure;
@@ -630,20 +630,20 @@ private:
epics::pvData::PVTimeStamp pvTimeStamp;
};
-class EasyPostHandlerPvt; // private to EasyPutData
+class PvaClientPostHandlerPvt; // private to PvaClientPutData
/**
- * @brief This is a class that holds data given to by EasyPut or EasyPutGet
+ * @brief This is a class that holds data given to by PvaClientPut or PvaClientPutGet
*
*/
-class epicsShareClass EasyPutData
+class epicsShareClass PvaClientPutData
{
public:
- POINTER_DEFINITIONS(EasyPutData);
+ POINTER_DEFINITIONS(PvaClientPutData);
/**
- * @brief Factory method for creating an instance of EasyPutData.
+ * @brief Factory method for creating an instance of PvaClientPutData.
*/
- static EasyPutDataPtr create(epics::pvData::StructureConstPtr const & structure);
- ~EasyPutData() {}
+ static PvaClientPutDataPtr create(epics::pvData::StructureConstPtr const & structure);
+ ~PvaClientPutData() {}
/**
* @brief Set a prefix for throw messages.
* @param value The prefix.
@@ -759,7 +759,7 @@ public:
*/
void putStringArray(std::vector const & value);
private:
- EasyPutData(epics::pvData::StructureConstPtr const &structure);
+ PvaClientPutData(epics::pvData::StructureConstPtr const &structure);
void checkValue();
void postPut(size_t fieldNumber);
@@ -767,25 +767,25 @@ private:
epics::pvData::StructureConstPtr structure;
epics::pvData::PVStructurePtr pvStructure;
epics::pvData::BitSetPtr bitSet;
- friend class EasyPostHandlerPvt;
+ friend class PvaClientPostHandlerPvt;
std::string messagePrefix;
epics::pvData::PVFieldPtr pvValue;
};
/**
- * @brief This is a class that holds data returned by EasyMonitor
+ * @brief This is a class that holds data returned by PvaClientMonitor
*
*/
-class epicsShareClass EasyMonitorData
+class epicsShareClass PvaClientMonitorData
{
public:
- POINTER_DEFINITIONS(EasyMonitorData);
+ POINTER_DEFINITIONS(PvaClientMonitorData);
/**
- * @brief Factory method for creating an instance of EasyMonitorData.
+ * @brief Factory method for creating an instance of PvaClientMonitorData.
*/
- static EasyMonitorDataPtr create(epics::pvData::StructureConstPtr const & structure);
- ~EasyMonitorData() {}
+ static PvaClientMonitorDataPtr create(epics::pvData::StructureConstPtr const & structure);
+ ~PvaClientMonitorData() {}
/**
* @brief Set a prefix for throw messages.
* @param value The prefix.
@@ -901,7 +901,7 @@ public:
*/
epics::pvData::TimeStamp getTimeStamp();
private:
- EasyMonitorData(epics::pvData::StructureConstPtr const & structure);
+ PvaClientMonitorData(epics::pvData::StructureConstPtr const & structure);
void checkValue();
epics::pvData::StructureConstPtr structure;
@@ -915,34 +915,34 @@ private:
epics::pvData::PVTimeStamp pvTimeStamp;
};
-class ChannelProcessRequesterImpl; // private to EasyProcess
+class ChannelProcessRequesterImpl; // private to PvaClientProcess
/**
* @brief An easy to use alternative to ChannelProcess.
*
* @author mrk
*/
-class epicsShareClass EasyProcess
+class epicsShareClass PvaClientProcess
{
public:
- POINTER_DEFINITIONS(EasyProcess);
+ POINTER_DEFINITIONS(PvaClientProcess);
/**
- * @brief Create a EasyProcess.
- * @param &easyPVA Interface to EasyPVA
- * @param easyChannel Interface to EasyChannel
+ * @brief Create a PvaClientProcess.
+ * @param &pvaClient Interface to PvaClient
+ * @param pvaClientChannel Interface to PvaClientChannel
* @param channel Interface to Channel
* @param pvRequest The request structure.
- * @return The interface to the EasyPVAStructure.
+ * @return The interface to the PvaClientStructure.
*/
- static EasyProcessPtr create(
- EasyPVAPtr const &easyPVA,
- EasyChannelPtr const & easyChannel,
+ static PvaClientProcessPtr create(
+ PvaClientPtr const &pvaClient,
+ PvaClientChannelPtr const & pvaClientChannel,
epics::pvAccess::Channel::shared_pointer const & channel,
epics::pvData::PVStructurePtr const &pvRequest
);
/**
* @brief destructor
*/
- ~EasyProcess();
+ ~PvaClientProcess();
/**
* @brief destroy an resources used.
*/
@@ -977,9 +977,9 @@ public:
*/
epics::pvData::Status waitProcess();
private:
- EasyProcess(
- EasyPVAPtr const &easyPVA,
- EasyChannelPtr const & easyChannel,
+ PvaClientProcess(
+ PvaClientPtr const &pvaClient,
+ PvaClientChannelPtr const & pvaClientChannel,
epics::pvAccess::Channel::shared_pointer const & channel,
epics::pvData::PVStructurePtr const &pvRequest);
std::string getRequesterName();
@@ -993,8 +993,8 @@ private:
void checkProcessState();
enum ProcessConnectState {connectIdle,connectActive,connected};
- EasyPVA::weak_pointer easyPVA;
- EasyChannel::weak_pointer easyChannel;
+ PvaClient::weak_pointer pvaClient;
+ PvaClientChannel::weak_pointer pvaClientChannel;
epics::pvAccess::Channel::shared_pointer channel;
epics::pvAccess::ChannelProcessRequester::shared_pointer processRequester;
epics::pvData::PVStructurePtr pvRequest;
@@ -1015,34 +1015,34 @@ private:
friend class ChannelProcessRequesterImpl;
};
-class ChannelGetRequesterImpl; // private to EasyGet
+class ChannelGetRequesterImpl; // private to PvaClientGet
/**
* @brief An easy to use alternative to ChannelGet.
*
* @author mrk
*/
-class epicsShareClass EasyGet
+class epicsShareClass PvaClientGet
{
public:
- POINTER_DEFINITIONS(EasyGet);
+ POINTER_DEFINITIONS(PvaClientGet);
/**
- * @brief Create a EasyGet.
- * @param &easyPVA Interface to EasyPVA
- * @param easyChannel Interface to EasyChannel
+ * @brief Create a PvaClientGet.
+ * @param &pvaClient Interface to PvaClient
+ * @param pvaClientChannel Interface to PvaClientChannel
* @param channel Interface to Channel
* @param pvRequest The request structure.
- * @return The interface to the EasyPVAStructure.
+ * @return The interface to the PvaClientStructure.
*/
- static EasyGetPtr create(
- EasyPVAPtr const &easyPVA,
- EasyChannelPtr const & easyChannel,
+ static PvaClientGetPtr create(
+ PvaClientPtr const &pvaClient,
+ PvaClientChannelPtr const & pvaClientChannel,
epics::pvAccess::Channel::shared_pointer const & channel,
epics::pvData::PVStructurePtr const &pvRequest
);
/**
* @brief destructor
*/
- ~EasyGet();
+ ~PvaClientGet();
/**
* @brief destroy an resources used.
*/
@@ -1080,11 +1080,11 @@ public:
* @brief Get the data/
* @return The interface.
*/
- EasyGetDataPtr getData();
+ PvaClientGetDataPtr getData();
private:
- EasyGet(
- EasyPVAPtr const &easyPVA,
- EasyChannelPtr const & easyChannel,
+ PvaClientGet(
+ PvaClientPtr const &pvaClient,
+ PvaClientChannelPtr const & pvaClientChannel,
epics::pvAccess::Channel::shared_pointer const & channel,
epics::pvData::PVStructurePtr const &pvRequest);
std::string getRequesterName();
@@ -1101,15 +1101,15 @@ private:
void checkGetState();
enum GetConnectState {connectIdle,connectActive,connected};
- EasyPVA::weak_pointer easyPVA;
- EasyChannel::weak_pointer easyChannel;
+ PvaClient::weak_pointer pvaClient;
+ PvaClientChannel::weak_pointer pvaClientChannel;
epics::pvAccess::Channel::shared_pointer channel;
epics::pvAccess::ChannelGetRequester::shared_pointer getRequester;
epics::pvData::PVStructurePtr pvRequest;
epics::pvData::Mutex mutex;
epics::pvData::Event waitForConnect;
epics::pvData::Event waitForGet;
- EasyGetDataPtr easyData;
+ PvaClientGetDataPtr pvaClientData;
std::string messagePrefix;
bool isDestroyed;
@@ -1124,34 +1124,34 @@ private:
friend class ChannelGetRequesterImpl;
};
-class ChannelPutRequesterImpl; // private to EasyPut
+class ChannelPutRequesterImpl; // private to PvaClientPut
/**
* @brief An easy to use alternative to ChannelPut.
*
* @author mrk
*/
-class epicsShareClass EasyPut
+class epicsShareClass PvaClientPut
{
public:
- POINTER_DEFINITIONS(EasyPut);
+ POINTER_DEFINITIONS(PvaClientPut);
/**
- * @brief Create a EasyPut.
- * @param &easyPVA Interface to EasyPVA
- * @param easyChannel Interface to EasyChannel
+ * @brief Create a PvaClientPut.
+ * @param &pvaClient Interface to PvaClient
+ * @param pvaClientChannel Interface to PvaClientChannel
* @param channel Interface to Channel
* @param pvRequest The request structure.
- * @return The interface to the EasyPVAStructure.
+ * @return The interface to the PvaClientStructure.
*/
- static EasyPutPtr create(
- EasyPVAPtr const &easyPVA,
- EasyChannelPtr const & easyChannel,
+ static PvaClientPutPtr create(
+ PvaClientPtr const &pvaClient,
+ PvaClientChannelPtr const & pvaClientChannel,
epics::pvAccess::Channel::shared_pointer const & channel,
epics::pvData::PVStructurePtr const &pvRequest
);
/**
* @brief destructor
*/
- ~EasyPut();
+ ~PvaClientPut();
/**
* @brief destroy an resources used.
*/
@@ -1203,11 +1203,11 @@ public:
* @brief Get the data/
* @return The interface.
*/
- EasyPutDataPtr getData();
+ PvaClientPutDataPtr getData();
private :
- EasyPut(
- EasyPVAPtr const &easyPVA,
- EasyChannelPtr const & easyChannel,
+ PvaClientPut(
+ PvaClientPtr const &pvaClient,
+ PvaClientChannelPtr const & pvaClientChannel,
epics::pvAccess::Channel::shared_pointer const & channel,
epics::pvData::PVStructurePtr const &pvRequest);
std::string getRequesterName();
@@ -1227,15 +1227,15 @@ private :
void checkPutState();
enum PutConnectState {connectIdle,connectActive,connected};
- EasyPVA::weak_pointer easyPVA;
- EasyChannel::weak_pointer easyChannel;
+ PvaClient::weak_pointer pvaClient;
+ PvaClientChannel::weak_pointer pvaClientChannel;
epics::pvAccess::Channel::shared_pointer channel;
epics::pvAccess::ChannelPutRequester::shared_pointer putRequester;
epics::pvData::PVStructurePtr pvRequest;
epics::pvData::Mutex mutex;
epics::pvData::Event waitForConnect;
epics::pvData::Event waitForGetPut;
- EasyPutDataPtr easyData;
+ PvaClientPutDataPtr pvaClientData;
std::string messagePrefix;
bool isDestroyed;
@@ -1250,34 +1250,34 @@ private :
friend class ChannelPutRequesterImpl;
};
-class ChannelPutGetRequesterImpl; // private to EasyPutGet
+class ChannelPutGetRequesterImpl; // private to PvaClientPutGet
/**
* @brief An easy to use alternative to ChannelPutGet.
*
* @author mrk
*/
-class epicsShareClass EasyPutGet
+class epicsShareClass PvaClientPutGet
{
public:
- POINTER_DEFINITIONS(EasyPutGet);
+ POINTER_DEFINITIONS(PvaClientPutGet);
/**
- * @brief Create a EasyPutGet.
- * @param &easyPVA Interface to EasyPVA
- * @param easyChannel Interface to EasyChannel
+ * @brief Create a PvaClientPutGet.
+ * @param &pvaClient Interface to PvaClient
+ * @param pvaClientChannel Interface to PvaClientChannel
* @param channel Interface to Channel
* @param pvRequest The request structure.
- * @return The interface to the EasyPVAStructure.
+ * @return The interface to the PvaClientStructure.
*/
- static EasyPutGetPtr create(
- EasyPVAPtr const &easyPVA,
- EasyChannelPtr const & easyChannel,
+ static PvaClientPutGetPtr create(
+ PvaClientPtr const &pvaClient,
+ PvaClientChannelPtr const & pvaClientChannel,
epics::pvAccess::Channel::shared_pointer const & channel,
epics::pvData::PVStructurePtr const &pvRequest
);
/**
* @brief destructor
*/
- ~EasyPutGet();
+ ~PvaClientPutGet();
/**
* @brief destroy an resources used.
*/
@@ -1346,16 +1346,16 @@ public:
* @brief Get the put data.
* @return The interface.
*/
- EasyPutDataPtr getPutData();
+ PvaClientPutDataPtr getPutData();
/**
* @brief Get the get data.
* @return The interface.
*/
- EasyGetDataPtr getGetData();
+ PvaClientGetDataPtr getGetData();
private :
- EasyPutGet(
- EasyPVAPtr const &easyPVA,
- EasyChannelPtr const & easyChannel,
+ PvaClientPutGet(
+ PvaClientPtr const &pvaClient,
+ PvaClientChannelPtr const & pvaClientChannel,
epics::pvAccess::Channel::shared_pointer const & channel,
epics::pvData::PVStructurePtr const &pvRequest);
std::string getRequesterName();
@@ -1383,16 +1383,16 @@ private :
void checkPutGetState();
enum PutGetConnectState {connectIdle,connectActive,connected};
- EasyPVA::weak_pointer easyPVA;
- EasyChannel::weak_pointer easyChannel;
+ PvaClient::weak_pointer pvaClient;
+ PvaClientChannel::weak_pointer pvaClientChannel;
epics::pvAccess::Channel::shared_pointer channel;
epics::pvAccess::ChannelPutGetRequester::shared_pointer putGetRequester;
epics::pvData::PVStructurePtr pvRequest;
epics::pvData::Mutex mutex;
epics::pvData::Event waitForConnect;
epics::pvData::Event waitForPutGet;
- EasyGetDataPtr easyGetData;
- EasyPutDataPtr easyPutData;
+ PvaClientGetDataPtr pvaClientGetData;
+ PvaClientPutDataPtr pvaClientPutData;
std::string messagePrefix;
bool isDestroyed;
@@ -1408,53 +1408,53 @@ private :
friend class ChannelPutGetRequesterImpl;
};
-class ChannelMonitorRequester; // private to EasyMonitor
+class ChannelMonitorRequester; // private to PvaClientMonitor
/**
* @brief Optional client callback.
*
*/
-class epicsShareClass EasyMonitorRequester
+class epicsShareClass PvaClientMonitorRequester
{
public:
- POINTER_DEFINITIONS(EasyMonitorRequester);
+ POINTER_DEFINITIONS(PvaClientMonitorRequester);
/**
* @brief destructor
*/
- virtual ~EasyMonitorRequester(){}
+ virtual ~PvaClientMonitorRequester(){}
/**
* @brief A monitor event has occurred.
- * @param monitor The EasyMonitor that received the event.
+ * @param monitor The PvaClientMonitor that received the event.
*/
- virtual void event(EasyMonitorPtr monitor) = 0;
+ virtual void event(PvaClientMonitorPtr monitor) = 0;
};
/**
* @brief An easy to use alternative to Monitor.
*
*/
-class epicsShareClass EasyMonitor :
- public std::tr1::enable_shared_from_this
+class epicsShareClass PvaClientMonitor :
+ public std::tr1::enable_shared_from_this
{
public:
- POINTER_DEFINITIONS(EasyMonitor);
+ POINTER_DEFINITIONS(PvaClientMonitor);
/**
- * @brief Create a EasyMonitor.
- * @param &easyPVA Interface to EasyPVA
- * @param easyChannel Interface to EasyChannel
+ * @brief Create a PvaClientMonitor.
+ * @param &pvaClient Interface to PvaClient
+ * @param pvaClientChannel Interface to PvaClientChannel
* @param channel Interface to Channel
* @param pvRequest The request structure.
- * @return The interface to the EasyPVAStructure.
+ * @return The interface to the PvaClientStructure.
*/
- static EasyMonitorPtr create(
- EasyPVAPtr const &easyPVA,
- EasyChannelPtr const & easyChannel,
+ static PvaClientMonitorPtr create(
+ PvaClientPtr const &pvaClient,
+ PvaClientChannelPtr const & pvaClientChannel,
epics::pvAccess::Channel::shared_pointer const & channel,
epics::pvData::PVStructurePtr const &pvRequest
);
/**
* @brief destructor
*/
- ~EasyMonitor();
+ ~PvaClientMonitor();
/**
* @brief destroy an resources used.
*/
@@ -1477,9 +1477,9 @@ public:
epics::pvData::Status waitConnect();
/**
* @brief Set a user callback.
- * @param easyMonitorrRequester The requester which must be implemented by the caller.
+ * @param pvaClientMonitorrRequester The requester which must be implemented by the caller.
*/
- void setRequester(EasyMonitorRequesterPtr const & easyMonitorrRequester);
+ void setRequester(PvaClientMonitorRequesterPtr const & pvaClientMonitorrRequester);
/**
* @brief Start monitoring.
*/
@@ -1490,13 +1490,13 @@ public:
void stop();
/**
* @brief poll for a monitor event.
- * The data will be in EasyData.
+ * The data will be in PvaClientData.
* @return (false,true) means event (did not, did) occur.
*/
bool poll();
/**
* @brief wait for a monitor event.
- * The data will be in EasyData.
+ * The data will be in PvaClientData.
* @param secondsToWait Time to wait for event.
* @return (false,true) means event (did not, did) occur.
*/
@@ -1509,18 +1509,18 @@ public:
* @brief The data in which monitor events are placed.
* @return The interface.
*/
- EasyMonitorDataPtr getData();
+ PvaClientMonitorDataPtr getData();
/**
* @brief get shared pointer to this
*/
- EasyMonitorPtr getPtrSelf()
+ PvaClientMonitorPtr getPtrSelf()
{
return shared_from_this();
}
private:
- EasyMonitor(
- EasyPVAPtr const &easyPVA,
- EasyChannelPtr const & easyChannel,
+ PvaClientMonitor(
+ PvaClientPtr const &pvaClient,
+ PvaClientChannelPtr const & pvaClientChannel,
epics::pvAccess::Channel::shared_pointer const & channel,
epics::pvData::PVStructurePtr const &pvRequest);
std::string getRequesterName();
@@ -1534,22 +1534,22 @@ private:
void checkMonitorState();
enum MonitorConnectState {connectIdle,connectActive,connected,monitorStarted};
- EasyPVA::weak_pointer easyPVA;
- EasyChannel::weak_pointer easyChannel;
+ PvaClient::weak_pointer pvaClient;
+ PvaClientChannel::weak_pointer pvaClientChannel;
epics::pvAccess::Channel::shared_pointer channel;
epics::pvData::PVStructurePtr pvRequest;
epics::pvData::MonitorRequester::shared_pointer monitorRequester;
epics::pvData::Mutex mutex;
epics::pvData::Event waitForConnect;
epics::pvData::Event waitForEvent;
- EasyMonitorDataPtr easyData;
+ PvaClientMonitorDataPtr pvaClientData;
std::string messagePrefix;
bool isDestroyed;
epics::pvData::Status connectStatus;
epics::pvData::MonitorPtr monitor;
epics::pvData::MonitorElementPtr monitorElement;
- EasyMonitorRequester::weak_pointer easyMonitorRequester;
+ PvaClientMonitorRequester::weak_pointer pvaClientMonitorRequester;
MonitorConnectState connectState;
bool userPoll;
@@ -1562,22 +1562,22 @@ private:
*
* @author mrk
*/
-class epicsShareClass EasyMultiChannel :
- public std::tr1::enable_shared_from_this
+class epicsShareClass PvaClientMultiChannel :
+ public std::tr1::enable_shared_from_this
{
public:
- POINTER_DEFINITIONS(EasyMultiChannel);
+ POINTER_DEFINITIONS(PvaClientMultiChannel);
/**
- * @brief Create a EasyMultiChannel.
+ * @brief Create a PvaClientMultiChannel.
* @param channelNames The name. of the channel..
* @param providerName The name of the provider.
- * @return The interface to the EasyPVAStructure.
+ * @return The interface to the PvaClientStructure.
*/
- static EasyMultiChannelPtr create(
- EasyPVAPtr const &easyPVA,
+ static PvaClientMultiChannelPtr create(
+ PvaClientPtr const &pvaClient,
epics::pvData::PVStringArrayPtr const & channelNames,
std::string const & providerName = "pva");
- ~EasyMultiChannel();
+ ~PvaClientMultiChannel();
/**
* @brief Destroy the pvAccess connection.
*/
@@ -1614,37 +1614,37 @@ public:
*/
epics::pvData::PVBooleanArrayPtr getIsConnected();
/**
- * Get the easyChannelArray.
+ * Get the pvaClientChannelArray.
* @return The weak shared pointer.
*/
- EasyChannelArrayWPtr getEasyChannelArray();
+ PvaClientChannelArrayWPtr getPvaClientChannelArray();
/**
- * Get easyPVA.
+ * Get pvaClient.
* @return The weak shared pointer.
*/
- EasyPVA::weak_pointer getEasyPVA();
+ PvaClient::weak_pointer getPvaClient();
/**
* Get the shared pointer to self.
* @return The shared pointer.
*/
- EasyMultiChannelPtr getPtrSelf()
+ PvaClientMultiChannelPtr getPtrSelf()
{
return shared_from_this();
}
private:
- EasyMultiChannel(
- EasyPVAPtr const &pva,
+ PvaClientMultiChannel(
+ PvaClientPtr const &pvaClient,
epics::pvData::PVStringArrayPtr const & channelName,
std::string const & providerName);
- EasyPVA::weak_pointer easyPVA;
+ PvaClient::weak_pointer pvaClient;
epics::pvData::PVStringArrayPtr channelName;
std::string providerName;
size_t numChannel;
epics::pvData::Mutex mutex;
size_t numConnected;
- EasyChannelArrayPtr easyChannelArray;
+ PvaClientChannelArrayPtr pvaClientChannelArray;
epics::pvData::PVBooleanArrayPtr isConnected;
bool isDestroyed;
};
@@ -1652,11 +1652,11 @@ private:
}}
-#endif /* EASYPVA_H */
+#endif /* PVACLIENT_H */
/** @page Overview Documentation
*
- * overview.html
+ * pvaClientOverview.html
*
*/
diff --git a/src/pvaClientChannel.cpp b/src/pvaClientChannel.cpp
new file mode 100644
index 0000000..57a3328
--- /dev/null
+++ b/src/pvaClientChannel.cpp
@@ -0,0 +1,495 @@
+/* pvaClientChannel.cpp */
+/**
+ * Copyright - See the COPYRIGHT that is included with this distribution.
+ * EPICS pvData is distributed subject to a Software License Agreement found
+ * in file LICENSE that is included with this distribution.
+ */
+/**
+ * @author mrk
+ * @date 2015.02
+ */
+#define epicsExportSharedSymbols
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+using std::tr1::static_pointer_cast;
+using namespace epics::pvData;
+using namespace epics::pvAccess;
+using namespace std;
+
+namespace epics { namespace pvaClient {
+
+
+class PvaClientGetCache
+{
+public:
+ PvaClientGetCache(){}
+ ~PvaClientGetCache();
+ void destroy() {
+ pvaClientGetMap.clear();
+ }
+ PvaClientGetPtr getGet(string const & request);
+ void addGet(string const & request,PvaClientGetPtr const & pvaClientGet);
+private:
+ map pvaClientGetMap;
+};
+
+PvaClientGetCache::~PvaClientGetCache()
+{
+ destroy();
+}
+
+PvaClientGetPtr PvaClientGetCache::getGet(string const & request)
+{
+ map::iterator iter = pvaClientGetMap.find(request);
+ if(iter!=pvaClientGetMap.end()) return iter->second;
+ return PvaClientGetPtr();
+}
+
+void PvaClientGetCache::addGet(string const & request,PvaClientGetPtr const & pvaClientGet)
+{
+ pvaClientGetMap.insert(std::pair(
+ request,pvaClientGet));
+}
+
+
+class PvaClientPutCache
+{
+public:
+ PvaClientPutCache(){}
+ ~PvaClientPutCache();
+ void destroy() {
+ pvaClientPutMap.clear();
+ }
+ PvaClientPutPtr getPut(string const & request);
+ void addPut(string const & request,PvaClientPutPtr const & pvaClientPut);
+private:
+ map pvaClientPutMap;
+};
+
+PvaClientPutCache::~PvaClientPutCache()
+{
+ destroy();
+}
+
+PvaClientPutPtr PvaClientPutCache::getPut(string const & request)
+{
+ map::iterator iter = pvaClientPutMap.find(request);
+ if(iter!=pvaClientPutMap.end()) return iter->second;
+ return PvaClientPutPtr();
+}
+
+void PvaClientPutCache::addPut(string const & request,PvaClientPutPtr const & pvaClientPut)
+{
+ pvaClientPutMap.insert(std::pair(
+ request,pvaClientPut));
+}
+
+class ChannelRequesterImpl : public ChannelRequester
+{
+ PvaClientChannel *pvaClientChannel;
+public:
+ ChannelRequesterImpl(PvaClientChannel *pvaClientChannel)
+ : pvaClientChannel(pvaClientChannel) {}
+ void channelCreated(
+ const Status& status,
+ Channel::shared_pointer const & channel)
+ { pvaClientChannel->channelCreated(status,channel); }
+ void channelStateChange(
+ Channel::shared_pointer const & channel,
+ Channel::ConnectionState connectionState)
+ {pvaClientChannel->channelStateChange(channel,connectionState);}
+ tr1::shared_ptr getChannel() {return pvaClientChannel->getChannel();}
+ string getRequesterName()
+ {return pvaClientChannel->getRequesterName();}
+ void message(
+ string const & message,
+ MessageType messageType)
+ { pvaClientChannel->message(message,messageType); }
+ void destroy() {pvaClientChannel->destroy();}
+};
+
+
+PvaClientChannel::PvaClientChannel(
+ PvaClientPtr const &pvaClient,
+ string const & channelName,
+ string const & providerName)
+: pvaClient(pvaClient),
+ channelName(channelName),
+ providerName(providerName),
+ connectState(connectIdle),
+ isDestroyed(false),
+ createRequest(CreateRequest::create()),
+ pvaClientGetCache(new PvaClientGetCache()),
+ pvaClientPutCache(new PvaClientPutCache())
+{}
+
+PvaClientChannel::~PvaClientChannel()
+{
+ destroy();
+}
+
+void PvaClientChannel::channelCreated(const Status& status, Channel::shared_pointer const & channel)
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientChannel was destroyed");
+ if(status.isOK()) {
+ this->channel = channel;
+ return;
+ }
+ cout << "PvaClientChannel::channelCreated status " << status.getMessage() << " why??\n";
+}
+
+void PvaClientChannel::channelStateChange(
+ Channel::shared_pointer const & channel,
+ Channel::ConnectionState connectionState)
+{
+ if(isDestroyed) return;
+ bool waitingForConnect = false;
+ if(connectState==connectActive) waitingForConnect = true;
+ if(connectionState!=Channel::CONNECTED) {
+ string mess(channelName +
+ " connection state " + Channel::ConnectionStateNames[connectionState]);
+ message(mess,errorMessage);
+ channelConnectStatus = Status(Status::STATUSTYPE_ERROR,mess);
+ connectState = notConnected;
+ } else {
+ connectState = connected;
+ }
+ if(waitingForConnect) waitForConnect.signal();
+}
+
+string PvaClientChannel::getRequesterName()
+{
+ PvaClientPtr yyy = pvaClient.lock();
+ if(!yyy) throw std::runtime_error("PvaClient was destroyed");
+ return yyy->getRequesterName();
+}
+
+void PvaClientChannel::message(
+ string const & message,
+ MessageType messageType)
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientChannel was destroyed");
+ PvaClientPtr yyy = pvaClient.lock();
+ if(!yyy) throw std::runtime_error("PvaClient was destroyed");
+ yyy->message(message, messageType);
+}
+
+void PvaClientChannel::destroy()
+{
+ {
+ Lock xx(mutex);
+ if(isDestroyed) return;
+ isDestroyed = true;
+ }
+ if(channel) channel->destroy();
+ channel.reset();
+ pvaClientGetCache.reset();
+ pvaClientPutCache.reset();
+}
+
+string PvaClientChannel::getChannelName()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientChannel was destroyed");
+ return channelName;
+}
+
+Channel::shared_pointer PvaClientChannel::getChannel()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientChannel was destroyed");
+ return channel;
+}
+
+void PvaClientChannel::connect(double timeout)
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientChannel was destroyed");
+ issueConnect();
+ Status status = waitConnect(timeout);
+ if(status.isOK()) return;
+ stringstream ss;
+ ss << "channel " << getChannelName() << " PvaClientChannel::connect " << status.getMessage();
+ throw std::runtime_error(ss.str());
+}
+
+void PvaClientChannel::issueConnect()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientChannel was destroyed");
+ if(connectState!=connectIdle) {
+ throw std::runtime_error("pvaClientChannel already connected");
+ }
+ channelRequester = ChannelRequester::shared_pointer(new ChannelRequesterImpl(this));
+
+ channelConnectStatus = Status(
+ Status::STATUSTYPE_ERROR,
+ getChannelName() + " createChannel failed");
+ connectState = connectActive;
+ ChannelProviderRegistry::shared_pointer reg = getChannelProviderRegistry();
+ ChannelProvider::shared_pointer provider = reg->getProvider(providerName);
+ if(!provider) {
+ throw std::runtime_error(getChannelName() + " provider " + providerName + " not registered");
+ }
+ channel = provider->createChannel(channelName,channelRequester,ChannelProvider::PRIORITY_DEFAULT);
+ if(!channel) {
+ throw std::runtime_error(channelConnectStatus.getMessage());
+ }
+}
+
+Status PvaClientChannel::waitConnect(double timeout)
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientChannel was destroyed");
+ waitForConnect.wait(timeout);
+ if(connectState==connected) return Status::Ok;
+ return Status(Status::STATUSTYPE_ERROR,channelConnectStatus.getMessage());
+}
+
+PvaClientFieldPtr PvaClientChannel::createField()
+{
+ return createField("");
+}
+
+PvaClientFieldPtr PvaClientChannel::createField(string const & subField)
+{
+ throw std::runtime_error("PvaClientChannel::createField not implemented");
+}
+
+PvaClientProcessPtr PvaClientChannel::createProcess()
+{
+ return createProcess("");
+}
+
+PvaClientProcessPtr PvaClientChannel::createProcess(string const & request)
+{
+ PVStructurePtr pvRequest = createRequest->createRequest(request);
+ if(!pvRequest) {
+ stringstream ss;
+ ss << "channel " << getChannelName();
+ ss << " PvaClientChannel::createProcess invalid pvRequest: " + createRequest->getMessage();
+ throw std::runtime_error(ss.str());
+ }
+ return createProcess(pvRequest);
+}
+
+PvaClientProcessPtr PvaClientChannel::createProcess(PVStructurePtr const & pvRequest)
+{
+ if(connectState!=connected) connect(5.0);
+ if(connectState!=connected) throw std::runtime_error("PvaClientChannel::creatProcess not connected");
+ PvaClientPtr yyy = pvaClient.lock();
+ if(!yyy) throw std::runtime_error("PvaClient was destroyed");
+ return PvaClientProcess::create(yyy,getPtrSelf(),channel,pvRequest);
+}
+
+PvaClientGetPtr PvaClientChannel::get() {return get("value,alarm,timeStamp");}
+
+PvaClientGetPtr PvaClientChannel::get(string const & request)
+{
+ PvaClientGetPtr pvaClientGet = pvaClientGetCache->getGet(request);
+ if(pvaClientGet) return pvaClientGet;
+ pvaClientGet = createGet(request);
+ pvaClientGet->connect();
+ pvaClientGetCache->addGet(request,pvaClientGet);
+ return pvaClientGet;
+}
+
+PvaClientGetPtr PvaClientChannel::createGet()
+{
+ return PvaClientChannel::createGet("value,alarm,timeStamp");
+}
+
+PvaClientGetPtr PvaClientChannel::createGet(string const & request)
+{
+ PVStructurePtr pvRequest = createRequest->createRequest(request);
+ if(!pvRequest) {
+ stringstream ss;
+ ss << "channel " << getChannelName();
+ ss << " PvaClientChannel::createGet invalid pvRequest: " + createRequest->getMessage();
+ throw std::runtime_error(ss.str());
+ }
+ return createGet(pvRequest);
+}
+
+PvaClientGetPtr PvaClientChannel::createGet(PVStructurePtr const & pvRequest)
+{
+ if(connectState!=connected) connect(5.0);
+ if(connectState!=connected) throw std::runtime_error("PvaClientChannel::creatGet not connected");
+ PvaClientPtr yyy = pvaClient.lock();
+ if(!yyy) throw std::runtime_error("PvaClient was destroyed");
+ return PvaClientGet::create(yyy,getPtrSelf(),channel,pvRequest);
+}
+
+PvaClientPutPtr PvaClientChannel::put() {return put("value");}
+
+PvaClientPutPtr PvaClientChannel::put(string const & request)
+{
+ PvaClientPutPtr pvaClientPut = pvaClientPutCache->getPut(request);
+ if(pvaClientPut) return pvaClientPut;
+ pvaClientPut = createPut(request);
+ pvaClientPut->connect();
+ pvaClientPut->get();
+ pvaClientPutCache->addPut(request,pvaClientPut);
+ return pvaClientPut;
+}
+
+PvaClientPutPtr PvaClientChannel::createPut()
+{
+ return createPut("value");
+}
+
+PvaClientPutPtr PvaClientChannel::createPut(string const & request)
+{
+ PVStructurePtr pvRequest = createRequest->createRequest(request);
+ if(!pvRequest) {
+ stringstream ss;
+ ss << "channel " << getChannelName();
+ ss << " PvaClientChannel::createPut invalid pvRequest: " + createRequest->getMessage();
+ throw std::runtime_error(ss.str());
+ }
+ return createPut(pvRequest);
+}
+
+PvaClientPutPtr PvaClientChannel::createPut(PVStructurePtr const & pvRequest)
+{
+ if(connectState!=connected) connect(5.0);
+ if(connectState!=connected) throw std::runtime_error("PvaClientChannel::creatPut not connected");
+ PvaClientPtr yyy = pvaClient.lock();
+ if(!yyy) throw std::runtime_error("PvaClient was destroyed");
+ return PvaClientPut::create(yyy,getPtrSelf(),channel,pvRequest);
+}
+
+PvaClientPutGetPtr PvaClientChannel::createPutGet()
+{
+ return createPutGet("putField(argument)getField(result)");
+}
+
+PvaClientPutGetPtr PvaClientChannel::createPutGet(string const & request)
+{
+ PVStructurePtr pvRequest = createRequest->createRequest(request);
+ if(!pvRequest) {
+ stringstream ss;
+ ss << "channel " << getChannelName();
+ ss << " PvaClientChannel::createPutGet invalid pvRequest: " + createRequest->getMessage();
+ throw std::runtime_error(ss.str());
+ }
+ return createPutGet(pvRequest);
+}
+
+PvaClientPutGetPtr PvaClientChannel::createPutGet(PVStructurePtr const & pvRequest)
+{
+ if(connectState!=connected) connect(5.0);
+ if(connectState!=connected) throw std::runtime_error("PvaClientChannel::creatPutGet not connected");
+ PvaClientPtr yyy = pvaClient.lock();
+ if(!yyy) throw std::runtime_error("PvaClient was destroyed");
+ return PvaClientPutGet::create(yyy,getPtrSelf(),channel,pvRequest);
+}
+
+PvaClientRPCPtr PvaClientChannel::createRPC()
+{
+ return createRPC("");
+}
+
+PvaClientRPCPtr PvaClientChannel::createRPC(string const & request)
+{
+ PVStructurePtr pvRequest = createRequest->createRequest(request);
+ if(!pvRequest) {
+ stringstream ss;
+ ss << "channel " << getChannelName();
+ ss << " PvaClientChannel::createRPC invalid pvRequest: " + createRequest->getMessage();
+ throw std::runtime_error(ss.str());
+ }
+ return createRPC(pvRequest);
+}
+
+PvaClientRPCPtr PvaClientChannel::createRPC(PVStructurePtr const & pvRequest)
+{
+ throw std::runtime_error("PvaClientChannel::createRPC not implemented");
+}
+
+PvaClientArrayPtr PvaClientChannel::createArray()
+{
+ return createArray("value");
+}
+
+PvaClientArrayPtr PvaClientChannel::createArray(string const & request)
+{
+ PVStructurePtr pvRequest = createRequest->createRequest(request);
+ if(!pvRequest) {
+ stringstream ss;
+ ss << "channel " << getChannelName();
+ ss << " PvaClientChannel::createArray invalid pvRequest: " + createRequest->getMessage();
+ throw std::runtime_error(ss.str());
+ }
+ return createArray(pvRequest);
+}
+
+PvaClientArrayPtr PvaClientChannel::createArray(PVStructurePtr const & pvRequest)
+{
+ throw std::runtime_error("PvaClientChannel::createArray not implemented");
+}
+
+
+PvaClientMonitorPtr PvaClientChannel::monitor() {return monitor("value,alarm,timeStamp");}
+
+PvaClientMonitorPtr PvaClientChannel::monitor(string const & request)
+{
+ PvaClientMonitorPtr pvaClientMonitor = createMonitor(request);
+ pvaClientMonitor->connect();
+ pvaClientMonitor->start();
+ return pvaClientMonitor;
+}
+
+PvaClientMonitorPtr PvaClientChannel::monitor(PvaClientMonitorRequesterPtr const & pvaClientMonitorRequester)
+{ return monitor("value,alarm,timeStamp",pvaClientMonitorRequester);
+}
+
+PvaClientMonitorPtr PvaClientChannel::monitor(string const & request,
+ PvaClientMonitorRequesterPtr const & pvaClientMonitorRequester)
+{
+ PvaClientMonitorPtr pvaClientMonitor = createMonitor(request);
+ pvaClientMonitor->connect();
+ pvaClientMonitor->setRequester(pvaClientMonitorRequester);
+ pvaClientMonitor->start();
+ return pvaClientMonitor;
+}
+
+PvaClientMonitorPtr PvaClientChannel::createMonitor()
+{
+ return createMonitor("value,alarm,timeStamp");
+}
+
+PvaClientMonitorPtr PvaClientChannel::createMonitor(string const & request)
+{
+ PVStructurePtr pvRequest = createRequest->createRequest(request);
+ if(!pvRequest) {
+ stringstream ss;
+ ss << "channel " << getChannelName();
+ ss << " PvaClientChannel::createMonitor invalid pvRequest: " + createRequest->getMessage();
+ throw std::runtime_error(ss.str());
+ }
+ return createMonitor(pvRequest);
+}
+
+PvaClientMonitorPtr PvaClientChannel::createMonitor(PVStructurePtr const & pvRequest)
+{
+ if(connectState!=connected) connect(5.0);
+ if(connectState!=connected) throw std::runtime_error("PvaClientChannel::createMonitor not connected");
+ PvaClientPtr yyy = pvaClient.lock();
+ if(!yyy) throw std::runtime_error("PvaClient was destroyed");
+ return PvaClientMonitor::create(yyy,getPtrSelf(),channel,pvRequest);
+}
+
+
+PvaClientChannelPtr PvaClientChannel::create(
+ PvaClientPtr const &pvaClient,
+ string const & channelName,
+ string const & providerName)
+{
+ PvaClientChannelPtr channel(new PvaClientChannel(pvaClient,channelName,providerName));
+ return channel;
+}
+
+}}
diff --git a/src/easyGet.cpp b/src/pvaClientGet.cpp
similarity index 53%
rename from src/easyGet.cpp
rename to src/pvaClientGet.cpp
index 55e11aa..bc8653d 100644
--- a/src/easyGet.cpp
+++ b/src/pvaClientGet.cpp
@@ -1,4 +1,4 @@
-/* easyGet.cpp */
+/* pvaClientGet.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -12,46 +12,46 @@
#include
#include
-#include
+#include
using std::tr1::static_pointer_cast;
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace std;
-namespace epics { namespace easyPVA {
+namespace epics { namespace pvaClient {
class ChannelGetRequesterImpl : public ChannelGetRequester
{
- EasyGet * easyGet;
+ PvaClientGet * pvaClientGet;
public:
- ChannelGetRequesterImpl(EasyGet * easyGet)
- : easyGet(easyGet) {}
+ ChannelGetRequesterImpl(PvaClientGet * pvaClientGet)
+ : pvaClientGet(pvaClientGet) {}
string getRequesterName()
- {return easyGet->getRequesterName();}
+ {return pvaClientGet->getRequesterName();}
void message(string const & message,MessageType messageType)
- {easyGet->message(message,messageType);}
+ {pvaClientGet->message(message,messageType);}
void channelGetConnect(
const Status& status,
ChannelGet::shared_pointer const & channelGet,
StructureConstPtr const & structure)
- {easyGet->channelGetConnect(status,channelGet,structure);}
+ {pvaClientGet->channelGetConnect(status,channelGet,structure);}
void getDone(
const Status& status,
ChannelGet::shared_pointer const & channelGet,
PVStructurePtr const & pvStructure,
BitSetPtr const & bitSet)
- {easyGet->getDone(status,channelGet,pvStructure,bitSet);}
+ {pvaClientGet->getDone(status,channelGet,pvStructure,bitSet);}
};
-EasyGet::EasyGet(
- EasyPVAPtr const &pva,
- EasyChannelPtr const & easyChannel,
+PvaClientGet::PvaClientGet(
+ PvaClientPtr const &pvaClient,
+ PvaClientChannelPtr const & pvaClientChannel,
Channel::shared_pointer const & channel,
PVStructurePtr const &pvRequest)
-: easyPVA(pva),
- easyChannel(easyChannel),
+: pvaClient(pvaClient),
+ pvaClientChannel(pvaClientChannel),
channel(channel),
pvRequest(pvRequest),
isDestroyed(false),
@@ -60,67 +60,67 @@ EasyGet::EasyGet(
{
}
-EasyGet::~EasyGet()
+PvaClientGet::~PvaClientGet()
{
destroy();
}
-void EasyGet::checkGetState()
+void PvaClientGet::checkGetState()
{
- if(isDestroyed) throw std::runtime_error("easyGet was destroyed");
+ if(isDestroyed) throw std::runtime_error("pvaClientGet was destroyed");
if(connectState==connectIdle) connect();
if(getState==getIdle) get();
}
// from ChannelGetRequester
-string EasyGet::getRequesterName()
+string PvaClientGet::getRequesterName()
{
- EasyPVAPtr yyy = easyPVA.lock();
- if(!yyy) throw std::runtime_error("easyPVA was destroyed");
+ PvaClientPtr yyy = pvaClient.lock();
+ if(!yyy) throw std::runtime_error("pvaClient was destroyed");
return yyy->getRequesterName();
}
-void EasyGet::message(string const & message,MessageType messageType)
+void PvaClientGet::message(string const & message,MessageType messageType)
{
- if(isDestroyed) throw std::runtime_error("easyGet was destroyed");
- EasyPVAPtr yyy = easyPVA.lock();
- if(!yyy) throw std::runtime_error("easyPVA was destroyed");
+ if(isDestroyed) throw std::runtime_error("pvaClientGet was destroyed");
+ PvaClientPtr yyy = pvaClient.lock();
+ if(!yyy) throw std::runtime_error("pvaClient was destroyed");
yyy->message(message, messageType);
}
-void EasyGet::channelGetConnect(
+void PvaClientGet::channelGetConnect(
const Status& status,
ChannelGet::shared_pointer const & channelGet,
StructureConstPtr const & structure)
{
- if(isDestroyed) throw std::runtime_error("easyGet was destroyed");
+ if(isDestroyed) throw std::runtime_error("pvaClientGet was destroyed");
channelGetConnectStatus = status;
this->channelGet = channelGet;
if(status.isOK()) {
- easyData = EasyGetData::create(structure);
- easyData->setMessagePrefix(channel->getChannelName());
+ pvaClientData = PvaClientGetData::create(structure);
+ pvaClientData->setMessagePrefix(channel->getChannelName());
}
waitForConnect.signal();
}
-void EasyGet::getDone(
+void PvaClientGet::getDone(
const Status& status,
ChannelGet::shared_pointer const & channelGet,
PVStructurePtr const & pvStructure,
BitSetPtr const & bitSet)
{
- if(isDestroyed) throw std::runtime_error("easyGet was destroyed");
+ if(isDestroyed) throw std::runtime_error("pvaClientGet was destroyed");
channelGetStatus = status;
if(status.isOK()) {
- easyData->setData(pvStructure,bitSet);
+ pvaClientData->setData(pvStructure,bitSet);
}
waitForGet.signal();
}
-// from EasyGet
-void EasyGet::destroy()
+// from PvaClientGet
+void PvaClientGet::destroy()
{
{
Lock xx(mutex);
@@ -131,23 +131,23 @@ void EasyGet::destroy()
channelGet.reset();
}
-void EasyGet::connect()
+void PvaClientGet::connect()
{
- if(isDestroyed) throw std::runtime_error("easyGet was destroyed");
+ if(isDestroyed) throw std::runtime_error("pvaClientGet was destroyed");
issueConnect();
Status status = waitConnect();
if(status.isOK()) return;
stringstream ss;
- ss << "channel " << channel->getChannelName() << " EasyGet::connect " << status.getMessage();
+ ss << "channel " << channel->getChannelName() << " PvaClientGet::connect " << status.getMessage();
throw std::runtime_error(ss.str());
}
-void EasyGet::issueConnect()
+void PvaClientGet::issueConnect()
{
- if(isDestroyed) throw std::runtime_error("easyGet was destroyed");
+ if(isDestroyed) throw std::runtime_error("pvaClientGet was destroyed");
if(connectState!=connectIdle) {
stringstream ss;
- ss << "channel " << channel->getChannelName() << " easyGet already connected ";
+ ss << "channel " << channel->getChannelName() << " pvaClientGet already connected ";
throw std::runtime_error(ss.str());
}
getRequester = ChannelGetRequester::shared_pointer(new ChannelGetRequesterImpl(this));
@@ -155,12 +155,12 @@ void EasyGet::issueConnect()
channelGet = channel->createChannelGet(getRequester,pvRequest);
}
-Status EasyGet::waitConnect()
+Status PvaClientGet::waitConnect()
{
- if(isDestroyed) throw std::runtime_error("easyGet was destroyed");
+ if(isDestroyed) throw std::runtime_error("pvaClientGet was destroyed");
if(connectState!=connectActive) {
stringstream ss;
- ss << "channel " << channel->getChannelName() << " easyGet illegal connect state ";
+ ss << "channel " << channel->getChannelName() << " pvaClientGet illegal connect state ";
throw std::runtime_error(ss.str());
}
waitForConnect.wait();
@@ -172,36 +172,36 @@ Status EasyGet::waitConnect()
return Status(Status::STATUSTYPE_ERROR,channelGetConnectStatus.getMessage());
}
-void EasyGet::get()
+void PvaClientGet::get()
{
- if(isDestroyed) throw std::runtime_error("easyGet was destroyed");
+ if(isDestroyed) throw std::runtime_error("pvaClientGet was destroyed");
issueGet();
Status status = waitGet();
if(status.isOK()) return;
stringstream ss;
- ss << "channel " << channel->getChannelName() << " EasyGet::get " << status.getMessage();
+ ss << "channel " << channel->getChannelName() << " PvaClientGet::get " << status.getMessage();
throw std::runtime_error(ss.str());
}
-void EasyGet::issueGet()
+void PvaClientGet::issueGet()
{
- if(isDestroyed) throw std::runtime_error("easyGet was destroyed");
+ if(isDestroyed) throw std::runtime_error("pvaClientGet was destroyed");
if(connectState==connectIdle) connect();
if(getState!=getIdle) {
stringstream ss;
- ss << "channel " << channel->getChannelName() << " EasyGet::issueGet get aleady active ";
+ ss << "channel " << channel->getChannelName() << " PvaClientGet::issueGet get aleady active ";
throw std::runtime_error(ss.str());
}
getState = getActive;
channelGet->get();
}
-Status EasyGet::waitGet()
+Status PvaClientGet::waitGet()
{
- if(isDestroyed) throw std::runtime_error("easyGet was destroyed");
+ if(isDestroyed) throw std::runtime_error("pvaClientGet was destroyed");
if(getState!=getActive){
stringstream ss;
- ss << "channel " << channel->getChannelName() << " EasyGet::waitGet llegal get state";
+ ss << "channel " << channel->getChannelName() << " PvaClientGet::waitGet llegal get state";
throw std::runtime_error(ss.str());
}
waitForGet.wait();
@@ -211,19 +211,19 @@ Status EasyGet::waitGet()
}
return Status(Status::STATUSTYPE_ERROR,channelGetStatus.getMessage());
}
-EasyGetDataPtr EasyGet::getData()
+PvaClientGetDataPtr PvaClientGet::getData()
{
checkGetState();
- return easyData;
+ return pvaClientData;
}
-EasyGetPtr EasyGet::create(
- EasyPVAPtr const &pva,
- EasyChannelPtr const & easyChannel,
+PvaClientGetPtr PvaClientGet::create(
+ PvaClientPtr const &pvaClient,
+ PvaClientChannelPtr const & pvaClientChannel,
Channel::shared_pointer const & channel,
PVStructurePtr const &pvRequest)
{
- EasyGetPtr epv(new EasyGet(pva,easyChannel,channel,pvRequest));
+ PvaClientGetPtr epv(new PvaClientGet(pvaClient,pvaClientChannel,channel,pvRequest));
return epv;
}
diff --git a/src/easyGetData.cpp b/src/pvaClientGetData.cpp
similarity index 64%
rename from src/easyGetData.cpp
rename to src/pvaClientGetData.cpp
index 4c72497..85314d6 100644
--- a/src/easyGetData.cpp
+++ b/src/pvaClientGetData.cpp
@@ -1,4 +1,4 @@
-/* easyGetData.cpp */
+/* pvaClientGetData.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -13,7 +13,7 @@
#include
#include
-#include
+#include
#include
#include
@@ -23,7 +23,7 @@ using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace std;
-namespace epics { namespace easyPVA {
+namespace epics { namespace pvaClient {
typedef std::tr1::shared_ptr PVArrayPtr;
@@ -36,44 +36,46 @@ static string noArray("value is not an array");
static string noScalarArray("value is not a scalarArray");
static string notDoubleArray("value is not a doubleArray");
static string notStringArray("value is not a stringArray");
+static string noAlarm("no alarm");
+static string noTimeStamp("no timeStamp");
-EasyGetDataPtr EasyGetData::create(StructureConstPtr const & structure)
+PvaClientGetDataPtr PvaClientGetData::create(StructureConstPtr const & structure)
{
- EasyGetDataPtr epv(new EasyGetData(structure));
+ PvaClientGetDataPtr epv(new PvaClientGetData(structure));
return epv;
}
-EasyGetData::EasyGetData(StructureConstPtr const & structure)
+PvaClientGetData::PvaClientGetData(StructureConstPtr const & structure)
: structure(structure)
{}
-void EasyGetData::checkValue()
+void PvaClientGetData::checkValue()
{
if(pvValue) return;
throw std::runtime_error(messagePrefix + noValue);
}
-void EasyGetData::setMessagePrefix(std::string const & value)
+void PvaClientGetData::setMessagePrefix(std::string const & value)
{
messagePrefix = value + " ";
}
-StructureConstPtr EasyGetData::getStructure()
+StructureConstPtr PvaClientGetData::getStructure()
{return structure;}
-PVStructurePtr EasyGetData::getPVStructure()
+PVStructurePtr PvaClientGetData::getPVStructure()
{
if(pvStructure) return pvStructure;
throw std::runtime_error(messagePrefix + noStructure);
}
-BitSetPtr EasyGetData::getBitSet()
+BitSetPtr PvaClientGetData::getBitSet()
{
if(bitSet)return bitSet;
throw std::runtime_error(messagePrefix + noStructure);
}
-std::ostream & EasyGetData::showChanged(std::ostream & out)
+std::ostream & PvaClientGetData::showChanged(std::ostream & out)
{
if(!bitSet) throw std::runtime_error(messagePrefix + noStructure);
size_t nextSet = bitSet->nextSetBit(0);
@@ -91,7 +93,7 @@ std::ostream & EasyGetData::showChanged(std::ostream & out)
return out;
}
-void EasyGetData::setData(
+void PvaClientGetData::setData(
PVStructurePtr const & pvStructureFrom,
BitSetPtr const & bitSetFrom)
{
@@ -100,33 +102,33 @@ void EasyGetData::setData(
pvValue = pvStructure->getSubField("value");
}
-bool EasyGetData::hasValue()
+bool PvaClientGetData::hasValue()
{
if(!pvValue) return false;
return true;
}
-bool EasyGetData::isValueScalar()
+bool PvaClientGetData::isValueScalar()
{
if(!pvValue) return false;
if(pvValue->getField()->getType()==scalar) return true;
return false;
}
-bool EasyGetData::isValueScalarArray()
+bool PvaClientGetData::isValueScalarArray()
{
if(!pvValue) return false;
if(pvValue->getField()->getType()==scalarArray) return true;
return false;
}
-PVFieldPtr EasyGetData::getValue()
+PVFieldPtr PvaClientGetData::getValue()
{
checkValue();
return pvValue;
}
-PVScalarPtr EasyGetData::getScalarValue()
+PVScalarPtr PvaClientGetData::getScalarValue()
{
checkValue();
PVScalarPtr pv = pvStructure->getSubField("value");
@@ -136,7 +138,7 @@ PVScalarPtr EasyGetData::getScalarValue()
return pv;
}
-PVArrayPtr EasyGetData::getArrayValue()
+PVArrayPtr PvaClientGetData::getArrayValue()
{
checkValue();
PVArrayPtr pv = pvStructure->getSubField("value");
@@ -146,7 +148,7 @@ PVArrayPtr EasyGetData::getArrayValue()
return pv;
}
-PVScalarArrayPtr EasyGetData::getScalarArrayValue()
+PVScalarArrayPtr PvaClientGetData::getScalarArrayValue()
{
checkValue();
PVScalarArrayPtr pv = pvStructure->getSubField("value");
@@ -156,7 +158,7 @@ PVScalarArrayPtr EasyGetData::getScalarArrayValue()
return pv;
}
-double EasyGetData::getDouble()
+double PvaClientGetData::getDouble()
{
PVScalarPtr pvScalar = getScalarValue();
ScalarType scalarType = pvScalar->getScalar()->getScalarType();
@@ -170,13 +172,13 @@ double EasyGetData::getDouble()
return convert->toDouble(pvScalar);
}
-string EasyGetData::getString()
+string PvaClientGetData::getString()
{
PVScalarPtr pvScalar = getScalarValue();
return convert->toString(pvScalar);
}
-shared_vector EasyGetData::getDoubleArray()
+shared_vector PvaClientGetData::getDoubleArray()
{
checkValue();
PVDoubleArrayPtr pv = pvStructure->getSubField("value");
@@ -186,7 +188,7 @@ shared_vector EasyGetData::getDoubleArray()
return pv->view();
}
-shared_vector EasyGetData::getStringArray()
+shared_vector PvaClientGetData::getStringArray()
{
checkValue();
PVStringArrayPtr pv = pvStructure->getSubField("value");
@@ -194,7 +196,41 @@ shared_vector EasyGetData::getStringArray()
throw std::runtime_error(messagePrefix + notStringArray);
}
return pv->view();
+}
+
+Alarm PvaClientGetData::getAlarm()
+{
+ if(!pvStructure) {
+ throw std::runtime_error(messagePrefix + noAlarm);
+ }
+ PVStructurePtr pvs = pvStructure->getSubField("alarm");
+ if(!pvs) throw std::runtime_error(messagePrefix + noAlarm);
+ pvAlarm.attach(pvs);
+ if(pvAlarm.isAttached()) {
+ Alarm alarm;
+ pvAlarm.get(alarm);
+ pvAlarm.detach();
+ return alarm;
+ }
+ throw std::runtime_error(messagePrefix + noAlarm);
+}
+
+TimeStamp PvaClientGetData::getTimeStamp()
+{
+ if(!pvStructure) {
+ throw std::runtime_error(messagePrefix + noTimeStamp);
+ }
+ PVStructurePtr pvs = pvStructure->getSubField("timeStamp");
+ if(!pvs) throw std::runtime_error(messagePrefix + noTimeStamp);
+ pvTimeStamp.attach(pvs);
+ if(pvTimeStamp.isAttached()) {
+ TimeStamp timeStamp;
+ pvTimeStamp.get(timeStamp);
+ pvTimeStamp.detach();
+ return timeStamp;
+ }
+ throw std::runtime_error(messagePrefix + noTimeStamp);
}
}}
diff --git a/src/pvaClientMonitor.cpp b/src/pvaClientMonitor.cpp
new file mode 100644
index 0000000..0b3be76
--- /dev/null
+++ b/src/pvaClientMonitor.cpp
@@ -0,0 +1,250 @@
+/* pvaClientMonitor.cpp */
+/**
+ * Copyright - See the COPYRIGHT that is included with this distribution.
+ * EPICS pvData is distributed subject to a Software License Agreement found
+ * in file LICENSE that is included with this distribution.
+ */
+/**
+ * @author mrk
+ * @date 2015.03
+ */
+#define epicsExportSharedSymbols
+
+#include
+#include
+#include
+#include
+
+using std::tr1::static_pointer_cast;
+using namespace epics::pvData;
+using namespace epics::pvAccess;
+using namespace std;
+
+namespace epics { namespace pvaClient {
+
+
+class ChannelMonitorRequester : public MonitorRequester
+{
+ PvaClientMonitor * pvaClientMonitor;
+public:
+ ChannelMonitorRequester(PvaClientMonitor * pvaClientMonitor)
+ : pvaClientMonitor(pvaClientMonitor) {}
+ string getRequesterName()
+ {return pvaClientMonitor->getRequesterName();}
+ void message(string const & message,MessageType messageType)
+ {pvaClientMonitor->message(message,messageType);}
+ void monitorConnect(
+ const Status& status,
+ Monitor::shared_pointer const & monitor,
+ StructureConstPtr const & structure)
+ {pvaClientMonitor->monitorConnect(status,monitor,structure);}
+ void monitorEvent(MonitorPtr const & monitor)
+ {
+ pvaClientMonitor->monitorEvent(monitor);
+ }
+ void unlisten(MonitorPtr const & monitor)
+ {pvaClientMonitor->unlisten();}
+};
+
+PvaClientMonitor::PvaClientMonitor(
+ PvaClientPtr const &pvaClient,
+ PvaClientChannelPtr const & pvaClientChannel,
+ Channel::shared_pointer const & channel,
+ PVStructurePtr const &pvRequest)
+: pvaClient(pvaClient),
+ pvaClientChannel(pvaClientChannel),
+ channel(channel),
+ pvRequest(pvRequest),
+ isDestroyed(false),
+ connectState(connectIdle),
+ userPoll(false),
+ userWait(false)
+{
+}
+
+PvaClientMonitor::~PvaClientMonitor()
+{
+ destroy();
+}
+
+void PvaClientMonitor::checkMonitorState()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMonitor was destroyed");
+ if(connectState==connectIdle) connect();
+ if(connectState==connected) start();
+}
+
+// from MonitorRequester
+string PvaClientMonitor::getRequesterName()
+{
+ PvaClientPtr yyy = pvaClient.lock();
+ if(!yyy) throw std::runtime_error("pvaClient was destroyed");
+ return yyy->getRequesterName();
+}
+
+void PvaClientMonitor::message(string const & message,MessageType messageType)
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMonitor was destroyed");
+ PvaClientPtr yyy = pvaClient.lock();
+ if(!yyy) throw std::runtime_error("pvaClient was destroyed");
+ yyy->message(message, messageType);
+}
+
+void PvaClientMonitor::monitorConnect(
+ const Status& status,
+ Monitor::shared_pointer const & monitor,
+ StructureConstPtr const & structure)
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMonitor was destroyed");
+ connectStatus = status;
+ this->monitor = monitor;
+ if(status.isOK()) {
+ pvaClientData = PvaClientMonitorData::create(structure);
+ pvaClientData->setMessagePrefix(channel->getChannelName());
+ }
+ waitForConnect.signal();
+
+}
+
+void PvaClientMonitor::monitorEvent(MonitorPtr const & monitor)
+{
+ PvaClientMonitorRequesterPtr req = pvaClientMonitorRequester.lock();
+ if(req) req->event(getPtrSelf());
+ if(userWait) waitForEvent.signal();
+}
+
+void PvaClientMonitor::unlisten()
+{
+ destroy();
+}
+
+// from PvaClientMonitor
+void PvaClientMonitor::destroy()
+{
+ {
+ Lock xx(mutex);
+ if(isDestroyed) return;
+ isDestroyed = true;
+ }
+ if(monitor) monitor->destroy();
+ monitor.reset();
+}
+
+void PvaClientMonitor::connect()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMonitor was destroyed");
+ issueConnect();
+ Status status = waitConnect();
+ if(status.isOK()) return;
+ stringstream ss;
+ ss << "channel " << channel->getChannelName() << " PvaClientMonitor::connect " << status.getMessage();
+ throw std::runtime_error(ss.str());
+}
+
+void PvaClientMonitor::issueConnect()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMonitor was destroyed");
+ if(connectState!=connectIdle) {
+ stringstream ss;
+ ss << "channel " << channel->getChannelName() << " pvaClientMonitor already connected ";
+ throw std::runtime_error(ss.str());
+ }
+ monitorRequester = ChannelMonitorRequester::shared_pointer(new ChannelMonitorRequester(this));
+ connectState = connectActive;
+ monitor = channel->createMonitor(monitorRequester,pvRequest);
+}
+
+Status PvaClientMonitor::waitConnect()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMonitor was destroyed");
+ if(connectState!=connectActive) {
+ stringstream ss;
+ ss << "channel " << channel->getChannelName() << " pvaClientMonitor illegal connect state ";
+ throw std::runtime_error(ss.str());
+ }
+ waitForConnect.wait();
+ if(connectStatus.isOK()){
+ connectState = connected;
+ return Status::Ok;
+ }
+ connectState = connectIdle;
+ return Status(Status::STATUSTYPE_ERROR,connectStatus.getMessage());
+}
+
+void PvaClientMonitor::setRequester(PvaClientMonitorRequesterPtr const & pvaClientMonitorrRequester)
+{
+ this->pvaClientMonitorRequester = pvaClientMonitorrRequester;
+}
+
+void PvaClientMonitor::start()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMonitor was destroyed");
+ if(connectState==monitorStarted) return;
+ if(connectState==connectIdle) connect();
+ if(connectState!=connected) throw std::runtime_error("PvaClientMonitor::start illegal state");
+ connectState = monitorStarted;
+ monitor->start();
+}
+
+
+void PvaClientMonitor::stop()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMonitor was destroyed");
+ if(connectState!=monitorStarted) return;
+ connectState = connected;
+ monitor->stop();
+}
+
+bool PvaClientMonitor::poll()
+{
+ checkMonitorState();
+ if(connectState!=monitorStarted) throw std::runtime_error("PvaClientMonitor::poll illegal state");
+ if(userPoll) throw std::runtime_error("PvaClientMonitor::poll did not release last");
+ monitorElement = monitor->poll();
+ if(!monitorElement) return false;
+ userPoll = true;
+ pvaClientData->setData(monitorElement);
+ return true;
+}
+
+bool PvaClientMonitor::waitEvent(double secondsToWait)
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMonitor was destroyed");
+ if(connectState!=monitorStarted) throw std::runtime_error("PvaClientMonitor::poll illegal state");
+ if(poll()) return true;
+ userWait = true;
+ if(secondsToWait==0.0) {
+ waitForEvent.wait();
+ } else {
+ waitForEvent.wait(secondsToWait);
+ }
+ userWait = false;
+ return poll();
+}
+
+void PvaClientMonitor::releaseEvent()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMonitor was destroyed");
+ if(connectState!=monitorStarted) throw std::runtime_error("PvaClientMonitor::poll illegal state");
+ if(!userPoll) throw std::runtime_error("PvaClientMonitor::releaseEvent did not call poll");
+ userPoll = false;
+ monitor->release(monitorElement);
+}
+
+PvaClientMonitorDataPtr PvaClientMonitor::getData()
+{
+ checkMonitorState();
+ return pvaClientData;
+}
+
+PvaClientMonitorPtr PvaClientMonitor::create(
+ PvaClientPtr const &pvaClient,
+ PvaClientChannelPtr const & pvaClientChannel,
+ Channel::shared_pointer const & channel,
+ PVStructurePtr const &pvRequest)
+{
+ PvaClientMonitorPtr epv(new PvaClientMonitor(pvaClient,pvaClientChannel,channel,pvRequest));
+ return epv;
+}
+
+}}
diff --git a/src/easyMonitorData.cpp b/src/pvaClientMonitorData.cpp
similarity index 76%
rename from src/easyMonitorData.cpp
rename to src/pvaClientMonitorData.cpp
index 7f5d9f0..768ffad 100644
--- a/src/easyMonitorData.cpp
+++ b/src/pvaClientMonitorData.cpp
@@ -1,4 +1,4 @@
-/* easyMonitorData.cpp */
+/* pvaClientMonitorData.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -13,7 +13,7 @@
#include
#include
-#include
+#include
#include
#include
@@ -23,7 +23,7 @@ using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace std;
-namespace epics { namespace easyPVA {
+namespace epics { namespace pvaClient {
typedef std::tr1::shared_ptr PVArrayPtr;
@@ -39,50 +39,50 @@ static string noScalarArray("value is not a scalarArray");
static string notDoubleArray("value is not a doubleArray");
static string notStringArray("value is not a stringArray");
-EasyMonitorDataPtr EasyMonitorData::create(StructureConstPtr const & structure)
+PvaClientMonitorDataPtr PvaClientMonitorData::create(StructureConstPtr const & structure)
{
- EasyMonitorDataPtr epv(new EasyMonitorData(structure));
+ PvaClientMonitorDataPtr epv(new PvaClientMonitorData(structure));
return epv;
}
-EasyMonitorData::EasyMonitorData(StructureConstPtr const & structure)
+PvaClientMonitorData::PvaClientMonitorData(StructureConstPtr const & structure)
: structure(structure)
{}
-void EasyMonitorData::checkValue()
+void PvaClientMonitorData::checkValue()
{
if(pvValue) return;
throw std::runtime_error(messagePrefix + noValue);
}
-void EasyMonitorData::setMessagePrefix(std::string const & value)
+void PvaClientMonitorData::setMessagePrefix(std::string const & value)
{
messagePrefix = value + " ";
}
-StructureConstPtr EasyMonitorData::getStructure()
+StructureConstPtr PvaClientMonitorData::getStructure()
{return structure;}
-PVStructurePtr EasyMonitorData::getPVStructure()
+PVStructurePtr PvaClientMonitorData::getPVStructure()
{
if(pvStructure) return pvStructure;
throw std::runtime_error(messagePrefix + noStructure);
}
-BitSetPtr EasyMonitorData::getChangedBitSet()
+BitSetPtr PvaClientMonitorData::getChangedBitSet()
{
if(!changedBitSet) throw std::runtime_error(messagePrefix + noStructure);
return changedBitSet;
}
-BitSetPtr EasyMonitorData::getOverrunBitSet()
+BitSetPtr PvaClientMonitorData::getOverrunBitSet()
{
if(!overrunBitSet) throw std::runtime_error(messagePrefix + noStructure);
return overrunBitSet;
}
-std::ostream & EasyMonitorData::showChanged(std::ostream & out)
+std::ostream & PvaClientMonitorData::showChanged(std::ostream & out)
{
if(!changedBitSet) throw std::runtime_error(messagePrefix + noStructure);
size_t nextSet = changedBitSet->nextSetBit(0);
@@ -100,7 +100,7 @@ std::ostream & EasyMonitorData::showChanged(std::ostream & out)
return out;
}
-std::ostream & EasyMonitorData::showOverrun(std::ostream & out)
+std::ostream & PvaClientMonitorData::showOverrun(std::ostream & out)
{
if(!overrunBitSet) throw std::runtime_error(messagePrefix + noStructure);
size_t nextSet = overrunBitSet->nextSetBit(0);
@@ -118,7 +118,7 @@ std::ostream & EasyMonitorData::showOverrun(std::ostream & out)
return out;
}
-void EasyMonitorData::setData(MonitorElementPtr const & monitorElement)
+void PvaClientMonitorData::setData(MonitorElementPtr const & monitorElement)
{
pvStructure = monitorElement->pvStructurePtr;
changedBitSet = monitorElement->changedBitSet;
@@ -126,33 +126,33 @@ void EasyMonitorData::setData(MonitorElementPtr const & monitorElement)
pvValue = pvStructure->getSubField("value");
}
-bool EasyMonitorData::hasValue()
+bool PvaClientMonitorData::hasValue()
{
if(!pvValue) return false;
return true;
}
-bool EasyMonitorData::isValueScalar()
+bool PvaClientMonitorData::isValueScalar()
{
if(!pvValue) return false;
if(pvValue->getField()->getType()==scalar) return true;
return false;
}
-bool EasyMonitorData::isValueScalarArray()
+bool PvaClientMonitorData::isValueScalarArray()
{
if(!pvValue) return false;
if(pvValue->getField()->getType()==scalarArray) return true;
return false;
}
-PVFieldPtr EasyMonitorData::getValue()
+PVFieldPtr PvaClientMonitorData::getValue()
{
checkValue();
return pvValue;
}
-PVScalarPtr EasyMonitorData::getScalarValue()
+PVScalarPtr PvaClientMonitorData::getScalarValue()
{
checkValue();
PVScalarPtr pv = pvStructure->getSubField("value");
@@ -162,7 +162,7 @@ PVScalarPtr EasyMonitorData::getScalarValue()
return pv;
}
-PVArrayPtr EasyMonitorData::getArrayValue()
+PVArrayPtr PvaClientMonitorData::getArrayValue()
{
checkValue();
PVArrayPtr pv = pvStructure->getSubField("value");
@@ -172,7 +172,7 @@ PVArrayPtr EasyMonitorData::getArrayValue()
return pv;
}
-PVScalarArrayPtr EasyMonitorData::getScalarArrayValue()
+PVScalarArrayPtr PvaClientMonitorData::getScalarArrayValue()
{
checkValue();
PVScalarArrayPtr pv = pvStructure->getSubField("value");
@@ -182,7 +182,7 @@ PVScalarArrayPtr EasyMonitorData::getScalarArrayValue()
return pv;
}
-double EasyMonitorData::getDouble()
+double PvaClientMonitorData::getDouble()
{
PVScalarPtr pvScalar = getScalarValue();
ScalarType scalarType = pvScalar->getScalar()->getScalarType();
@@ -196,13 +196,13 @@ double EasyMonitorData::getDouble()
return convert->toDouble(pvScalar);
}
-string EasyMonitorData::getString()
+string PvaClientMonitorData::getString()
{
PVScalarPtr pvScalar = getScalarValue();
return convert->toString(pvScalar);
}
-shared_vector EasyMonitorData::getDoubleArray()
+shared_vector PvaClientMonitorData::getDoubleArray()
{
checkValue();
PVDoubleArrayPtr pv = pvStructure->getSubField("value");
@@ -212,7 +212,7 @@ shared_vector EasyMonitorData::getDoubleArray()
return pv->view();
}
-shared_vector EasyMonitorData::getStringArray()
+shared_vector PvaClientMonitorData::getStringArray()
{
checkValue();
PVStringArrayPtr pv = pvStructure->getSubField("value");
diff --git a/src/pvaClientMultiChannel.cpp b/src/pvaClientMultiChannel.cpp
new file mode 100644
index 0000000..579a308
--- /dev/null
+++ b/src/pvaClientMultiChannel.cpp
@@ -0,0 +1,165 @@
+/* pvaClientMultiChannel.cpp */
+/**
+ * Copyright - See the COPYRIGHT that is included with this distribution.
+ * EPICS pvData is distributed subject to a Software License Agreement found
+ * in file LICENSE that is included with this distribution.
+ */
+/**
+ * @author mrk
+ * @date 2015.02
+ */
+#define epicsExportSharedSymbols
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+using std::tr1::static_pointer_cast;
+using namespace epics::pvData;
+using namespace epics::pvAccess;
+using namespace std;
+
+namespace epics { namespace pvaClient {
+
+
+
+PvaClientMultiChannel::PvaClientMultiChannel(
+ PvaClientPtr const &pvaClient,
+ PVStringArrayPtr const & channelName,
+ string const & providerName)
+: pvaClient(pvaClient),
+ channelName(channelName),
+ providerName(providerName),
+ numChannel(channelName->getLength()),
+ isConnected(getPVDataCreate()->createPVScalarArray()),
+ isDestroyed(false)
+{
+}
+
+PvaClientMultiChannel::~PvaClientMultiChannel()
+{
+ destroy();
+}
+
+void PvaClientMultiChannel::destroy()
+{
+ {
+ Lock xx(mutex);
+ if(isDestroyed) return;
+ isDestroyed = true;
+ }
+ pvaClientChannelArray.reset();
+}
+
+PVStringArrayPtr PvaClientMultiChannel::getChannelNames()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMultiChannel was destroyed");
+ return channelName;
+}
+
+Status PvaClientMultiChannel::connect(double timeout,size_t maxNotConnected)
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMultiChannel was destroyed");
+ if(pvaClientChannelArray) throw std::runtime_error("pvaClientMultiChannel already connected");
+ PvaClientPtr pvaClient = this->pvaClient.lock();
+ if(!pvaClient) return Status(Status::STATUSTYPE_ERROR,"pvaClient is gone");
+ shared_vector pvaClientChannel(numChannel,PvaClientChannelPtr());
+ PVStringArray::const_svector channelNames = channelName->view();
+ shared_vector isConnected(numChannel,false);
+ for(size_t i=0; i< numChannel; ++i) {
+ pvaClientChannel[i] = pvaClient->createChannel(channelNames[i],providerName);
+ pvaClientChannel[i]->issueConnect();
+ }
+ Status returnStatus = Status::Ok;
+ Status status = Status::Ok;
+ size_t numBad = 0;
+ for(size_t i=0; i< numChannel; ++i) {
+ if(numBad==0) {
+ status = pvaClientChannel[i]->waitConnect(timeout);
+ } else {
+ status = pvaClientChannel[i]->waitConnect(.001);
+ }
+ if(status.isOK()) {
+ ++numConnected;
+ isConnected[i] = true;
+ continue;
+ }
+ if(returnStatus.isOK()) returnStatus = status;
+ ++numBad;
+ if(numBad>maxNotConnected) break;
+ }
+ pvaClientChannelArray = PvaClientChannelArrayPtr(new PvaClientChannelArray(freeze(pvaClientChannel)));
+ this->isConnected->replace(freeze(isConnected));
+ return numBad>maxNotConnected ? returnStatus : Status::Ok;
+}
+
+
+bool PvaClientMultiChannel::allConnected()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMultiChannel was destroyed");
+ if(!pvaClientChannelArray) throw std::runtime_error("pvaClientMultiChannel not connected");
+ if(numConnected==numChannel) return true;
+ return (numConnected==numChannel) ? true : false;
+}
+
+bool PvaClientMultiChannel::connectionChange()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMultiChannel was destroyed");
+ if(!pvaClientChannelArray) throw std::runtime_error("pvaClientMultiChannel not connected");
+ if(numConnected==numChannel) return true;
+ PVBooleanArray::const_svector isConnected = this->isConnected->view();
+ shared_vector channels = *pvaClientChannelArray.get();
+ for(size_t i=0; igetChannel();
+ Channel::ConnectionState stateNow = channel->getConnectionState();
+ bool connectedNow = stateNow==Channel::CONNECTED ? true : false;
+ if(connectedNow!=isConnected[i]) return true;
+ }
+ return false;
+}
+
+PVBooleanArrayPtr PvaClientMultiChannel::getIsConnected()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMultiChannel was destroyed");
+ if(!pvaClientChannelArray) throw std::runtime_error("pvaClientMultiChannel not connected");
+ if(!connectionChange()) return isConnected;
+ shared_vector isConnected(numChannel,false);
+ shared_vector channels = *pvaClientChannelArray.get();
+ for(size_t i=0; igetChannel();
+ Channel::ConnectionState stateNow = channel->getConnectionState();
+ if(stateNow==Channel::CONNECTED) isConnected[i] = true;
+ }
+ this->isConnected->replace(freeze(isConnected));
+ return this->isConnected;
+}
+
+PvaClientChannelArrayWPtr PvaClientMultiChannel::getPvaClientChannelArray()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMultiChannel was destroyed");
+ if(!pvaClientChannelArray) throw std::runtime_error("pvaClientMultiChannel not connected");
+ return pvaClientChannelArray;
+}
+
+PvaClient::weak_pointer PvaClientMultiChannel::getPvaClient()
+{
+ if(isDestroyed) throw std::runtime_error("pvaClientMultiChannel was destroyed");
+ return pvaClient;
+}
+
+PvaClientMultiChannelPtr PvaClientMultiChannel::create(
+ PvaClientPtr const &pvaClient,
+ PVStringArrayPtr const & channelNames,
+ string const & providerName)
+{
+ PvaClientMultiChannelPtr channel(new PvaClientMultiChannel(pvaClient,channelNames,providerName));
+ return channel;
+}
+
+}}
diff --git a/src/pvaClientMultiDouble.cpp b/src/pvaClientMultiDouble.cpp
new file mode 100644
index 0000000..6843797
--- /dev/null
+++ b/src/pvaClientMultiDouble.cpp
@@ -0,0 +1,139 @@
+/* pvaClientMultiDouble.cpp */
+/**
+ * Copyright - See the COPYRIGHT that is included with this distribution.
+ * EPICS pvData is distributed subject to a Software License Agreement found
+ * in file LICENSE that is included with this distribution.
+ */
+/**
+ * @author mrk
+ * @date 2015.03
+ */
+
+#define epicsExportSharedSymbols
+#include
+
+using std::tr1::static_pointer_cast;
+using namespace epics::pvData;
+using namespace epics::pvAccess;
+using namespace std;
+
+namespace epics { namespace pvaClient {
+
+PvaClientMultiDoublePtr PvaClientMultiDouble::create(
+ PvaClientPtr const & pvaClient,
+ PVStringArrayPtr const & channelName,
+ double timeout,
+ std::string const & providerName)
+{
+ PvaClientMultiChannelPtr pvaClientMultiChannel(
+ PvaClientMultiChannel::create(pvaClient,channelName,providerName));
+ Status status = pvaClientMultiChannel->connect(timeout,0);
+ if(!status.isOK()) throw std::runtime_error(status.getMessage());
+ return PvaClientMultiDoublePtr(new PvaClientMultiDouble(pvaClientMultiChannel));
+}
+
+PvaClientMultiDouble::PvaClientMultiDouble(PvaClientMultiChannelPtr const &pvaClientMultiChannel)
+:
+ pvaClientMultiChannel(pvaClientMultiChannel)
+{}
+
+PvaClientMultiDouble::~PvaClientMultiDouble()
+{
+}
+
+void PvaClientMultiDouble::createGet()
+{
+ PvaClientChannelArrayPtr pvaClientChannelArray = pvaClientMultiChannel->getPvaClientChannelArray().lock();
+ if(!pvaClientChannelArray) throw std::runtime_error("pvaClientChannelArray is gone");
+ shared_vector pvaClientChannels = *pvaClientChannelArray;
+ size_t numChannel = pvaClientChannels.size();
+ pvaClientGet = std::vector(numChannel,PvaClientGetPtr());
+ bool allOK = true;
+ string message;
+ for(size_t i=0; icreateGet("value");
+ pvaClientGet[i]->issueConnect();
+ }
+ for(size_t i=0; iwaitConnect();
+ if(!status.isOK()) {
+ message = "connect status " + status.getMessage();
+ allOK = false;
+ break;
+ }
+ }
+ if(!allOK) throw std::runtime_error(message);
+}
+
+void PvaClientMultiDouble::createPut()
+{
+ PvaClientChannelArrayPtr pvaClientChannelArray = pvaClientMultiChannel->getPvaClientChannelArray().lock();
+ if(!pvaClientChannelArray) throw std::runtime_error("pvaClientChannelArray is gone");
+ shared_vector pvaClientChannels = *pvaClientChannelArray;
+ size_t numChannel = pvaClientChannels.size();
+ pvaClientPut = std::vector(numChannel,PvaClientPutPtr());
+ bool allOK = true;
+ string message;
+ for(size_t i=0; icreatePut("value");
+ pvaClientPut[i]->issueConnect();
+ }
+ for(size_t i=0; iwaitConnect();
+ if(!status.isOK()) {
+ message = "connect status " + status.getMessage();
+ allOK = false;
+ break;
+ }
+ }
+ if(!allOK) throw std::runtime_error(message);
+}
+
+epics::pvData::shared_vector PvaClientMultiDouble::get()
+{
+ if(pvaClientGet.empty()) createGet();
+ shared_vector channelNames = pvaClientMultiChannel->getChannelNames()->view();
+ size_t numChannel = channelNames.size();
+ epics::pvData::shared_vector data(channelNames.size());
+ for(size_t i=0; iissueGet();
+ }
+ for(size_t i=0; iwaitGet();
+ if(!status.isOK()) {
+ string message = channelNames[i] + " " + status.getMessage();
+ throw std::runtime_error(message);
+ }
+ data[i] = pvaClientGet[i]->getData()->getDouble();
+ }
+ return data;
+}
+
+void PvaClientMultiDouble::put(shared_vector const &value)
+{
+ if(pvaClientPut.empty()) createPut();
+ shared_vector channelNames = pvaClientMultiChannel->getChannelNames()->view();
+ size_t numChannel = channelNames.size();
+ for(size_t i=0; igetData()->putDouble(value[i]);
+ pvaClientPut[i]->issuePut();
+ }
+ for(size_t i=0; iwaitPut();
+ if(!status.isOK()) {
+ string message = channelNames[i] + " " + status.getMessage();
+ throw std::runtime_error(message);
+ }
+ }
+}
+
+
+}}
diff --git a/src/easyMultiDouble.h b/src/pvaClientMultiDouble.h
similarity index 58%
rename from src/easyMultiDouble.h
rename to src/pvaClientMultiDouble.h
index f2f05e9..028f923 100644
--- a/src/easyMultiDouble.h
+++ b/src/pvaClientMultiDouble.h
@@ -1,4 +1,4 @@
-/* easyMultiDouble.h */
+/* pvaClientMultiDouble.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -8,20 +8,20 @@
* @author mrk
* @date 2015.02
*/
-#ifndef EASYMULTIDOUBLE_H
-#define EASYMULTIDOUBLE_H
+#ifndef PVACLIENTMULTIDOUBLE_H
+#define PVACLIENTMULTIDOUBLE_H
#ifdef epicsExportSharedSymbols
-# define easyPVAEpicsExportSharedSymbols
+# define pvaClientEpicsExportSharedSymbols
# undef epicsExportSharedSymbols
#endif
-#include
+#include
-namespace epics { namespace easyPVA {
+namespace epics { namespace pvaClient {
-class EasyMultiDouble;
-typedef std::tr1::shared_ptr EasyMultiDoublePtr;
+class PvaClientMultiDouble;
+typedef std::tr1::shared_ptr PvaClientMultiDoublePtr;
/**
* @brief Support for multiple channels where each channel has a value field that is a scalar double.
@@ -29,27 +29,27 @@ typedef std::tr1::shared_ptr EasyMultiDoublePtr;
*
* @author mrk
*/
-class epicsShareClass EasyMultiDouble
+class epicsShareClass PvaClientMultiDouble
{
public:
- POINTER_DEFINITIONS(EasyMultiDouble);
+ POINTER_DEFINITIONS(PvaClientMultiDouble);
/**
- * @brief Create a EasyMultiDouble.
- * @param &easyPVA Interface to EasyPVA
+ * @brief Create a PvaClientMultiDouble.
+ * @param &pvaClient Interface to PvaClient
* @param channelName PVStringArray of channelNames.
* @param timeout The timeout in seconds for connecting.
* @param providerName The name of the channelProvider for each channel.
- * @return The interface to EasyMultiDouble.
+ * @return The interface to PvaClientMultiDouble.
*/
- static EasyMultiDoublePtr create(
- EasyPVAPtr const & easyPVA,
+ static PvaClientMultiDoublePtr create(
+ PvaClientPtr const & pvaClient,
epics::pvData::PVStringArrayPtr const & channelName,
double timeout = 5.0,
std::string const & providerName = "pva");
/**
* @brief destructor
*/
- ~EasyMultiDouble();
+ ~PvaClientMultiDouble();
/**
* @brief destroy any resources used.
*/
@@ -64,18 +64,18 @@ public:
* @param value The data.
*/
void put(epics::pvData::shared_vector const &value);
- EasyMultiChannelPtr getEasyMultiChannel();
+ PvaClientMultiChannelPtr getPvaClientMultiChannel();
private:
- EasyMultiDouble(
- EasyMultiChannelPtr const & channelName);
+ PvaClientMultiDouble(
+ PvaClientMultiChannelPtr const & channelName);
void createGet();
void createPut();
- EasyMultiChannelPtr easyMultiChannel;
- std::vector easyGet;
- std::vector easyPut;
+ PvaClientMultiChannelPtr pvaClientMultiChannel;
+ std::vector pvaClientGet;
+ std::vector