Skip to content

Commit

Permalink
Merge pull request #46 from mrkraimer/master
Browse files Browse the repository at this point in the history
Changes because of enhancements to pvDatabaseCPP and pvaClientCPP
  • Loading branch information
mrkraimer authored Apr 13, 2019
2 parents de8423f + d255887 commit 0b8ccc6
Show file tree
Hide file tree
Showing 39 changed files with 1,601 additions and 6 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ EMBEDDED_TOPS += $(TOP)/helloPutGet
EMBEDDED_TOPS += $(TOP)/helloRPC
EMBEDDED_TOPS += $(TOP)/pvDatabaseRPC
EMBEDDED_TOPS += $(TOP)/arrayPerformance
EMBEDDED_TOPS += $(TOP)/testClient

DIRS := configure

Expand Down
9 changes: 9 additions & 0 deletions documentation/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
EPICS 7.0.2.2 April 2019
====================

Changes include examples and tests that for changes to **pvaClientCPP** and **pvDatabaseCPP**.
This means that this release is not compatible with previous versions of **EPICS 7**.

* helloRPC now uses NTURI for communication between client and server.
* testClient is new. See testClient/scripts/README.md


GITHUB Main
===========
Expand Down
4 changes: 4 additions & 0 deletions exampleClient/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ PROD_HOST += examplePvaClientNTMulti
examplePvaClientNTMulti_SRCS += examplePvaClientNTMulti.cpp
examplePvaClientNTMulti_LIBS += $(EPICS_BASE_PVA_CORE_LIBS)

PROD_HOST += examplePvaClientNTMultiGet
examplePvaClientNTMultiGet_SRCS += examplePvaClientNTMultiGet.cpp
examplePvaClientNTMultiGet_LIBS += $(EPICS_BASE_PVA_CORE_LIBS)


PROD_HOST += helloWorldRPC
helloWorldRPC_SRCS += helloWorldRPC.cpp
Expand Down
4 changes: 4 additions & 0 deletions exampleClient/src/examplePvaClientGet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ static void exampleDouble(PvaClientPtr const &pva,string const & channelName,str
{
cout << "__exampleDouble__ channelName " << channelName << " providerName " << providerName << endl;
double value;
cout << "shortest way\n";
value = pva->channel(channelName,providerName)->getDouble();
cout << "short way\n";
value = pva->channel(channelName,providerName,2.0)->get()->getData()->getDouble();
cout << "as double " << value << endl;
Expand Down Expand Up @@ -50,6 +52,8 @@ static void exampleDoubleArray(PvaClientPtr const &pva,string const & channelNam
<< " providerName "
<< providerName << endl;
shared_vector<const double> value;
cout << "shortest way\n";
value = pva->channel(channelName,providerName)->getDoubleArray();
cout << "short way\n";
value = pva->channel(channelName,providerName,2.0)->get()->getData()->getDoubleArray();
cout << "as doubleArray " << value << endl;
Expand Down
76 changes: 76 additions & 0 deletions exampleClient/src/examplePvaClientNTMultiGet.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/

/**
* @author mrk
*/

/* Author: Marty Kraimer */

#include <iostream>

#include <pv/pvaClientMultiChannel.h>
#include <pv/convert.h>

using std::tr1::static_pointer_cast;
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace epics::pvaClient;


static void example(
PvaClientPtr const &pva,
string provider,
shared_vector<const string> const &channelNames)
{
cout << "_example provider " << provider << " channels " << channelNames << "_\n";
size_t num = channelNames.size();
PvaClientMultiChannelPtr multiChannel(
PvaClientMultiChannel::create(pva,channelNames,provider));
Status status = multiChannel->connect();
if(!status.isSuccess()) {
cout << "Did not connect: ";
shared_vector<epics::pvData::boolean> isConnected = multiChannel->getIsConnected();
for(size_t i=0; i<num; ++i) {
if(!isConnected[i]) cout << channelNames[i] << " ";
}
cout << endl;
return;
}
PvaClientNTMultiGetPtr multiGet(multiChannel->createNTGet());
multiGet->get();
PvaClientNTMultiDataPtr multiData = multiGet->getData();
PVStructurePtr pvStructure = multiData->getNTMultiChannel()->getPVStructure();
PVUnionArrayPtr pvUnionArray = static_pointer_cast<PVUnionArray>(pvStructure->getSubField("value"));
shared_vector<const PVUnionPtr> values = pvUnionArray->view();
for(size_t ind=0; ind < values.size(); ++ind)
{
PVUnionPtr pvUnion = values[ind];
PVFieldPtr pvField = pvUnion->get();
cout << channelNames[ind] << " = " << pvField << "\n";
}
}

int main(int argc,char *argv[])
{
cout << "_____examplePvaClientNTMultiGet starting_______\n";
try {
PvaClientPtr pva = PvaClient::get("pva ca");
size_t num = 4;
shared_vector<string> channelNames(num);
channelNames[0] = "PVRdouble";
channelNames[1] = "PVRstring";
channelNames[2] = "PVRdoubleArray";
channelNames[3] = "PVRstringArray";
shared_vector<const string> names(freeze(channelNames));
example(pva,"pva",names);
cout << "_____examplePvaClientNTMultiGet done_______\n";
} catch (std::exception& e) {
cout << "exception " << e.what() << endl;
return 1;
}
return 0;
}
14 changes: 11 additions & 3 deletions exampleClient/src/examplePvaClientPut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ static ConvertPtr convert = getConvert();
static void exampleDouble(PvaClientPtr const &pva,string const & channelName,string const & providerName)
{
cout << "__exampleDouble__ channelName " << channelName << " providerName " << providerName << endl;
cout << "shortest way\n";
pva->channel(channelName,providerName)->putDouble(1.0);
cout << "longer way\n";
PvaClientChannelPtr channel = pva->channel(channelName,providerName,2.0);
PvaClientPutPtr put = channel->put();
PvaClientPutDataPtr putData = put->getData();
Expand All @@ -48,14 +51,19 @@ static void exampleDouble(PvaClientPtr const &pva,string const & channelName,str
static void exampleDoubleArray(PvaClientPtr const &pva,string const & channelName,string const & providerName)
{
cout << "__exampleDoubleArray__ channelName " << channelName << " providerName " << providerName << endl;
cout << "shortest way\n";
size_t num = 5;
shared_vector<double> data(num,0);
for(size_t i=0; i<num; ++i) data[i] = i;
pva->channel(channelName,providerName)->putDoubleArray(freeze(data));
cout << "longer way\n";
data = shared_vector<double>(num,0);
for(size_t i=0; i<num; ++i) data[i] = .1*i;
PvaClientChannelPtr channel = pva->channel(channelName,providerName,2.0);
PvaClientPutPtr put = channel->put();
PvaClientPutDataPtr putData = put->getData();
PvaClientMonitorPtr monitor = pva->channel(channelName,providerName,2.0)->monitor("value");
PvaClientMonitorDataPtr monitorData = monitor->getData();
size_t num = 5;
shared_vector<double> data(num,0);
for(size_t i=0; i<num; ++i) data[i] = .1*i;
putData->putDoubleArray(freeze(data)); put->put();
channel->get("field(value)")->getData()->showChanged(cout) << endl;
data = shared_vector<double>(num,0);
Expand Down
3 changes: 2 additions & 1 deletion test/pvaClientTestGetData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ static void testDoubleArray()
}
try {
shared_vector<const string> value = pvaData->getStringArray();
testPass("getStringArray");
} catch (std::exception& e) {
testPass("getStringArray exception '%s'", e.what());
testFail("getStringArray exception '%s'", e.what());
}
}

Expand Down
3 changes: 2 additions & 1 deletion test/pvaClientTestMonitorData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ static void testDoubleArray()
}
try {
shared_vector<const string> value = pvaData->getStringArray();
testPass("getStringArray");
} catch (std::exception& e) {
testPass("getStringArray exception '%s'", e.what());
testFail("getStringArray exception '%s'", e.what());
}
}

Expand Down
3 changes: 2 additions & 1 deletion test/pvaClientTestPutData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,9 @@ static void testDoubleArray()
}
try {
shared_vector<const string> value = pvaData->getStringArray();
testPass("getStringArray");
} catch (std::exception& e) {
testPass("getStringArray exception '%s'", e.what());
testFail("getStringArray exception '%s'", e.what());
}

try {
Expand Down
13 changes: 13 additions & 0 deletions testClient/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Makefile at top of application tree

TOP = .
include $(TOP)/configure/CONFIG

DIRS += configure

DIRS += src
src_DEPEND_DIRS = configure

include $(TOP)/configure/RULES_TOP


29 changes: 29 additions & 0 deletions testClient/configure/CONFIG
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# CONFIG - Load build configuration data
#
# Do not make changes to this file!

# Allow user to override where the build rules come from
RULES = $(EPICS_BASE)

# RELEASE files point to other application tops
include $(TOP)/configure/RELEASE
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH).Common
ifdef T_A
-include $(TOP)/configure/RELEASE.Common.$(T_A)
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH).$(T_A)
endif

CONFIG = $(RULES)/configure
include $(CONFIG)/CONFIG

# Override the Base definition:
INSTALL_LOCATION = $(TOP)

# CONFIG_SITE files contain other build configuration settings
include $(TOP)/configure/CONFIG_SITE
-include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).Common
ifdef T_A
-include $(TOP)/configure/CONFIG_SITE.Common.$(T_A)
-include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A)
endif

37 changes: 37 additions & 0 deletions testClient/configure/CONFIG_SITE
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# CONFIG_SITE

# Make any application-specific changes to the EPICS build
# configuration variables in this file.
#
# Host/target specific settings can be specified in files named
# CONFIG_SITE.$(EPICS_HOST_ARCH).Common
# CONFIG_SITE.Common.$(T_A)
# CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A)

# CHECK_RELEASE controls the consistency checking of the support
# applications pointed to by the RELEASE* files.
# Normally CHECK_RELEASE should be set to YES.
# Set CHECK_RELEASE to NO to disable checking completely.
# Set CHECK_RELEASE to WARN to perform consistency checking but
# continue building anyway if conflicts are found.
CHECK_RELEASE = YES

# Set this when you only want to compile this application
# for a subset of the cross-compiled target architectures
# that Base is built for.
#CROSS_COMPILER_TARGET_ARCHS =

# To install files into a location other than $(TOP) define
# INSTALL_LOCATION here.
#INSTALL_LOCATION=</path/name/to/install/top>

# Set this when your IOC and the host use different paths
# to access the application. This will be needed to boot
# from a Microsoft FTP server or with some NFS mounts.
# You must rebuild in the iocBoot directory for this to
# take effect.
#IOCS_APPL_TOP = </IOC/path/to/application/top>

-include $(TOP)/../../CONFIG_SITE.local
-include $(TOP)/../CONFIG_SITE.local
-include $(TOP)/configure/CONFIG_SITE.local
8 changes: 8 additions & 0 deletions testClient/configure/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
TOP=..

include $(TOP)/configure/CONFIG

TARGETS = $(CONFIG_TARGETS)
CONFIGS += $(subst ../,,$(wildcard $(CONFIG_INSTALLS)))

include $(TOP)/configure/RULES
25 changes: 25 additions & 0 deletions testClient/configure/RELEASE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# RELEASE - Location of external support modules
#
# IF YOU CHANGE this file or any file it includes you must
# do a "gnumake rebuild" in the application's top level directory.
#
# The build process does not check dependencies against files
# that are outside this application, thus you should also do a
# "gnumake rebuild" in the top level directory after EPICS_BASE
# or any other external module pointed to below is rebuilt.
#
# Host- or target-specific settings can be given in files named
# RELEASE.$(EPICS_HOST_ARCH).Common
# RELEASE.Common.$(T_A)
# RELEASE.$(EPICS_HOST_ARCH).$(T_A)

# EPICS V4 Developers: Do not edit the locations in this file!
#
# To create a file RELEASE.local in this directory
# copy ExampleRELEASE.local to RELEASE.local
# edit RELEASE.local
# rebuild

-include $(TOP)/../../RELEASE.local
-include $(TOP)/../configure/RELEASE.local
-include $(TOP)/configure/RELEASE.local
6 changes: 6 additions & 0 deletions testClient/configure/RULES
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# RULES

include $(CONFIG)/RULES

# Library should be rebuilt because LIBOBJS may have changed.
$(LIBNAME): ../Makefile
2 changes: 2 additions & 0 deletions testClient/configure/RULES.ioc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#RULES.ioc
include $(CONFIG)/RULES.ioc
2 changes: 2 additions & 0 deletions testClient/configure/RULES_DIRS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#RULES_DIRS
include $(CONFIG)/RULES_DIRS
3 changes: 3 additions & 0 deletions testClient/configure/RULES_TOP
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#RULES_TOP
include $(CONFIG)/RULES_TOP

23 changes: 23 additions & 0 deletions testClient/scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# exampleCPP/testClient/scripts

This contains tests for pvaClient methods:
**getDouble**, **putDouble**, **getString**, **putString**,
**getDoubleArray**, **putDoubleArray**, **getStringArray**, and **putStringArray**.

Before the test can be run the following database must be started:

mrk> pwd
/home/epicsv4/masterCPP/exampleCPP/database/iocBoot/exampleDatabase
mrk> ../../bin/linux-x86_64/exampleDatabase st.cmd

To run the tests do the following in this directory:

./testAll &> temp
diff temp testSuccess
rm temp

You should not see any differences.




3 changes: 3 additions & 0 deletions testClient/scripts/setEnv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
export TESTCLIENT=../bin/linux-x86_64/

18 changes: 18 additions & 0 deletions testClient/scripts/testAll
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
source ./setEnv
echo ___testPutDouble___
./testPutDouble
echo ___testGetDouble___
./testGetDouble
echo ___testPutString___
./testPutString
echo ___testGetString___
./testGetString
echo ___testPutDoubleArray___
./testPutDoubleArray
echo ___testGetDoubleArray___
./testGetDoubleArray
echo ___testPutStringArray___
./testPutStringArray
echo ___testGetStringArray___
./testGetStringArray
Loading

0 comments on commit 0b8ccc6

Please sign in to comment.