rename easyPVACPP to pvaClientCPP; this means repository and all names;

This commit is contained in:
Marty Kraimer
2015-06-17 10:57:57 -04:00
parent 4194195dc5
commit 0d0b6ebac0
42 changed files with 2445 additions and 2403 deletions
+32 -32
View File
@@ -3,54 +3,54 @@
TOP = ..
include $(TOP)/configure/CONFIG
TESTPROD_HOST += testEasyPutData
testEasyPutData_SRCS = testEasyPutData
testHarness_SRCS += testEasyPutData.cpp
TESTS += testEasyPutData
TESTPROD_HOST += pvaClientTestPutData
pvaClientTestPutData_SRCS = pvaClientTestPutData
testHarness_SRCS += pvaClientTestPutData.cpp
TESTS += pvaClientTestPutData
TESTPROD_HOST += testEasyGetData
testEasyGetData_SRCS = testEasyGetData
testHarness_SRCS += testEasyGetData.cpp
TESTS += testEasyGetData
TESTPROD_HOST += pvaClientTestGetData
pvaClientTestGetData_SRCS = pvaClientTestGetData
testHarness_SRCS += pvaClientTestGetData.cpp
TESTS += pvaClientTestGetData
TESTPROD_HOST += testEasyMonitorData
testEasyMonitorData_SRCS = testEasyMonitorData
testHarness_SRCS += testEasyMonitorData.cpp
TESTS += testEasyMonitorData
TESTPROD_HOST += pvaClientTestMonitorData
pvaClientTestMonitorData_SRCS = pvaClientTestMonitorData
testHarness_SRCS += pvaClientTestMonitorData.cpp
TESTS += pvaClientTestMonitorData
TESTPROD_HOST += testEasyPutGetMonitor
testEasyPutGetMonitor_SRCS = testEasyPutGetMonitor
testHarness_SRCS += testEasyPutGetMonitor.cpp
TESTS += testEasyPutGetMonitor
TESTPROD_HOST += pvaClientTestPutGetMonitor
pvaClientTestPutGetMonitor_SRCS = pvaClientTestPutGetMonitor
testHarness_SRCS += pvaClientTestPutGetMonitor.cpp
TESTS += pvaClientTestPutGetMonitor
TESTPROD_HOST += testEasyPutGet
testEasyPutGet_SRCS = testEasyPutGet
testHarness_SRCS += testEasyPutGet.cpp
TESTS += testEasyPutGet
TESTPROD_HOST += pvaClientTestPutGet
pvaClientTestPutGet_SRCS = pvaClientTestPutGet
testHarness_SRCS += pvaClientTestPutGet.cpp
TESTS += pvaClientTestPutGet
TESTPROD_HOST += testEasyMultiDouble
testEasyMultiDouble_SRCS = testEasyMultiDouble
testHarness_SRCS += testEasyMultiDouble.cpp
TESTS += testEasyMultiDouble
TESTPROD_HOST += pvaClientTestMultiDouble
pvaClientTestMultiDouble_SRCS = pvaClientTestMultiDouble
testHarness_SRCS += pvaClientTestMultiDouble.cpp
TESTS += pvaClientTestMultiDouble
TESTPROD_HOST += testEasyNTMultiChannel
testEasyNTMultiChannel_SRCS = testEasyNTMultiChannel
testHarness_SRCS += testEasyNTMultiChannel.cpp
TESTS += testEasyNTMultiChannel
TESTPROD_HOST += pvaClientTestNTMultiChannel
pvaClientTestNTMultiChannel_SRCS = pvaClientTestNTMultiChannel
testHarness_SRCS += pvaClientTestNTMultiChannel.cpp
TESTS += pvaClientTestNTMultiChannel
PROD_LIBS += easyPVA pvAccess pvData nt Com
PROD_LIBS += pvaClient pvAccess pvData nt Com
testHarness_SRCS += easyAllTests.c
testHarness_SRCS += pvaClientAllTests.c
PROD_vxWorks = vxTestHarness
vxTestHarness_SRCS += $(testHarness_SRCS)
TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); easyAllTests
TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); pvaClientAllTests
PROD_RTEMS += rtemsTestHarness
rtemsTestHarness_SRCS += rtemsTestHarness.c rtemsConfig.c
rtemsTestHarness_SRCS += $(testHarness_SRCS)
TESTSPEC_RTEMS = rtemsTestHarness.$(MUNCH_SUFFIX); easyAllTests
TESTSPEC_RTEMS = rtemsTestHarness.$(MUNCH_SUFFIX); pvaClientAllTests
TESTSCRIPTS_HOST += $(TESTS:%=%.t)
-31
View File
@@ -1,31 +0,0 @@
/*
* Run EasyPVA tests as a batch.
*
* Do *not* include performance measurements here, they don't help to
* prove functionality (which is the point of this convenience routine).
*/
#include <stdio.h>
#include <epicsThread.h>
#include <epicsUnitTest.h>
int testEasyGetData(void);
int testEasyPutData(void);
int testEasyMonitorData(void);
int testEasyPutGetMonitor(void);
int testEasyPutGet(void);
int testEasyMultiDouble(void);
int testEasyNTMultiChannel(void);
void easyAllTests(void)
{
testHarness();
runTest(testEasyGetData);
runTest(testEasyPutData);
runTest(testEasyMonitorData);
runTest(testEasyPutMonitor);
runTest(testEasyPut);
runTest(testEasyMultiDouble);
runTest(testEasyNTMultiChannel);
}
+31
View File
@@ -0,0 +1,31 @@
/*
* Run pvaClient tests as a batch.
*
* Do *not* include performance measurements here, they don't help to
* prove functionality (which is the point of this convenience routine).
*/
#include <stdio.h>
#include <epicsThread.h>
#include <epicsUnitTest.h>
int pvaClientTestGetData(void);
int pvaClientTestPutData(void);
int pvaClientTestMonitorData(void);
int pvaClientTestPutGetMonitor(void);
int pvaClientTestPutGet(void);
int pvaClientTestMultiDouble(void);
int pvaClientTestNTMultiChannel(void);
void easyAllTests(void)
{
testHarness();
runTest(pvaClientTestGetData);
runTest(pvaClientTestPutData);
runTest(pvaClientTestMonitorData);
runTest(pvaClientTestPutMonitor);
runTest(pvaClientTestPut);
runTest(pvaClientTestMultiDouble);
runTest(pvaClientTestNTMultiChannel);
}
@@ -1,4 +1,4 @@
/*testEasyGetData.cpp */
/*pvaClientTestGetData.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -15,15 +15,15 @@
#include <epicsUnitTest.h>
#include <testMain.h>
#include <pv/easyPVA.h>
#include <pv/pvaClient.h>
#include <pv/bitSet.h>
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace epics::easyPVA;
using namespace epics::pvaClient;
static EasyPVAPtr easyPVA = EasyPVA::create();
static PvaClientPtr pvaClient = PvaClient::create();
static FieldCreatePtr fieldCreate = getFieldCreate();
static StandardFieldPtr standardField = getStandardField();
static PVDataCreatePtr pvDataCreate = getPVDataCreate();
@@ -39,46 +39,46 @@ void testDouble()
add("value",pvDouble) ->
createStructure();
EasyGetDataPtr easyData = EasyGetData::create(structure);
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(easyData->getStructure());
PvaClientGetDataPtr pvaData = PvaClientGetData::create(structure);
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(pvaData->getStructure());
BitSetPtr bitSet = BitSetPtr(new BitSet(pvStructure->getNumberFields()));
easyData->setData(pvStructure,bitSet);
pvaData->setData(pvStructure,bitSet);
PVDoublePtr pvDouble = pvStructure->getSubField<PVDouble>("value");
size_t valueOffset = pvDouble->getFieldOffset();
BitSetPtr change = easyData->getBitSet();
BitSetPtr change = pvaData->getBitSet();
pvDouble->put(5.0);
change->set(pvDouble->getFieldOffset());
testOk(change->cardinality()==1,"num set bits 1");
testOk(change->get(valueOffset)==true,"value changed");
testOk(easyData->hasValue()==true,"hasValue");
testOk(easyData->isValueScalar()==true,"isValueScalar");
testOk(easyData->isValueScalarArray()==false,"isValueScalarArray");
testOk(pvaData->hasValue()==true,"hasValue");
testOk(pvaData->isValueScalar()==true,"isValueScalar");
testOk(pvaData->isValueScalarArray()==false,"isValueScalarArray");
bool result;
result = false;
if(easyData->getValue()) result = true;
if(pvaData->getValue()) result = true;
testOk(result==true,"getValue");
result = false;
if(easyData->getScalarValue()) result = true;
if(pvaData->getScalarValue()) result = true;
testOk(result==true,"getScalarValue");
try {
easyData->getArrayValue();
pvaData->getArrayValue();
} catch (std::runtime_error e) {
cout << "getArrayValue " << e.what() << endl;
}
try {
easyData->getScalarArrayValue();
pvaData->getScalarArrayValue();
} catch (std::runtime_error e) {
cout << " getScalarArrayValue " << e.what() << endl;
}
cout << "as double " << easyData->getDouble() << endl;
cout << "as string " << easyData->getString() << endl;
cout << "as double " << pvaData->getDouble() << endl;
cout << "as string " << pvaData->getString() << endl;
try {
shared_vector<const double> value = easyData->getDoubleArray();
shared_vector<const double> value = pvaData->getDoubleArray();
} catch (std::runtime_error e) {
cout << " getDoubleArray " << e.what() << endl;
}
try {
shared_vector<const string> value = easyData->getStringArray();
shared_vector<const string> value = pvaData->getStringArray();
} catch (std::runtime_error e) {
cout << " getStringArray " << e.what() << endl;
}
@@ -94,12 +94,12 @@ void testDoubleArray()
addArray("value",pvDouble) ->
createStructure();
EasyGetDataPtr easyData = EasyGetData::create(structure);
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(easyData->getStructure());
PvaClientGetDataPtr pvaData = PvaClientGetData::create(structure);
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(pvaData->getStructure());
BitSetPtr bitSet = BitSetPtr(new BitSet(pvStructure->getNumberFields()));
easyData->setData(pvStructure,bitSet);
PVDoubleArrayPtr pvalue = easyData->getPVStructure()->getSubField<PVDoubleArray>("value");
BitSetPtr change = easyData->getBitSet();
pvaData->setData(pvStructure,bitSet);
PVDoubleArrayPtr pvalue = pvaData->getPVStructure()->getSubField<PVDoubleArray>("value");
BitSetPtr change = pvaData->getBitSet();
size_t valueOffset = pvalue->getFieldOffset();
size_t len = 5;
shared_vector<double> value(len);
@@ -108,45 +108,45 @@ void testDoubleArray()
change->set(valueOffset);
testOk(change->cardinality()==1,"num set bits 1");
testOk(change->get(valueOffset)==true,"value changed");
testOk(easyData->hasValue()==true,"hasValue");
testOk(easyData->isValueScalar()==false,"isValueScalar");
testOk(easyData->isValueScalarArray()==true,"isValueScalarArray");
testOk(pvaData->hasValue()==true,"hasValue");
testOk(pvaData->isValueScalar()==false,"isValueScalar");
testOk(pvaData->isValueScalarArray()==true,"isValueScalarArray");
bool result;
result = false;
if(easyData->getValue()) result = true;
if(pvaData->getValue()) result = true;
testOk(result==true,"getValue");
result = false;
if(easyData->getArrayValue()) result = true;
if(pvaData->getArrayValue()) result = true;
testOk(result==true,"getArrayValue");
result = false;
if(easyData->getScalarArrayValue()) result = true;
if(pvaData->getScalarArrayValue()) result = true;
testOk(result==true,"getScalarValue");
try {
easyData->getScalarValue();
pvaData->getScalarValue();
} catch (std::runtime_error e) {
cout << " getScalarValue " << e.what() << endl;
}
try {
cout << "as double " << easyData->getDouble() << endl;
cout << "as double " << pvaData->getDouble() << endl;
} catch (std::runtime_error e) {
cout << " getDouble " << e.what() << endl;
}
try {
string val = easyData->getString();
string val = pvaData->getString();
} catch (std::runtime_error e) {
cout << " getString " << e.what() << endl;
}
cout << "as doubleArray " << easyData->getDoubleArray() << endl;
cout << "as doubleArray " << pvaData->getDoubleArray() << endl;
try {
shared_vector<const string> value = easyData->getStringArray();
shared_vector<const string> value = pvaData->getStringArray();
} catch (std::runtime_error e) {
cout << " getStringArray " << e.what() << endl;
}
}
MAIN(testEasyGetData)
MAIN(pvaClientTestGetData)
{
cout << "\nstarting testEasyGetData\n";
cout << "\nstarting pvaClientTestGetData\n";
testPlan(15);
testDouble();
testDoubleArray();
@@ -1,4 +1,4 @@
/*testEasyMonitorData.cpp */
/*pvaClientTestMonitorData.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -15,15 +15,15 @@
#include <epicsUnitTest.h>
#include <testMain.h>
#include <pv/easyPVA.h>
#include <pv/pvaClient.h>
#include <pv/bitSet.h>
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace epics::easyPVA;
using namespace epics::pvaClient;
static EasyPVAPtr easyPVA = EasyPVA::create();
static PvaClientPtr pvaClient = PvaClient::create();
static FieldCreatePtr fieldCreate = getFieldCreate();
static StandardFieldPtr standardField = getStandardField();
static PVDataCreatePtr pvDataCreate = getPVDataCreate();
@@ -39,45 +39,45 @@ void testDouble()
add("value",pvDouble) ->
createStructure();
EasyMonitorDataPtr easyData = EasyMonitorData::create(structure);
MonitorElementPtr monitorElement(new MonitorElement(pvDataCreate->createPVStructure(easyData->getStructure())));
easyData->setData(monitorElement);
PVDoublePtr pvDouble = easyData->getPVStructure()->getSubField<PVDouble>("value");
PvaClientMonitorDataPtr pvaData = PvaClientMonitorData::create(structure);
MonitorElementPtr monitorElement(new MonitorElement(pvDataCreate->createPVStructure(pvaData->getStructure())));
pvaData->setData(monitorElement);
PVDoublePtr pvDouble = pvaData->getPVStructure()->getSubField<PVDouble>("value");
size_t valueOffset = pvDouble->getFieldOffset();
BitSetPtr change = easyData->getChangedBitSet();
BitSetPtr change = pvaData->getChangedBitSet();
pvDouble->put(5.0);
change->set(pvDouble->getFieldOffset());
testOk(change->cardinality()==1,"num set bits 1");
testOk(change->get(valueOffset)==true,"value changed");
testOk(easyData->hasValue()==true,"hasValue");
testOk(easyData->isValueScalar()==true,"isValueScalar");
testOk(easyData->isValueScalarArray()==false,"isValueScalarArray");
testOk(pvaData->hasValue()==true,"hasValue");
testOk(pvaData->isValueScalar()==true,"isValueScalar");
testOk(pvaData->isValueScalarArray()==false,"isValueScalarArray");
bool result;
result = false;
if(easyData->getValue()) result = true;
if(pvaData->getValue()) result = true;
testOk(result==true,"getValue");
result = false;
if(easyData->getScalarValue()) result = true;
if(pvaData->getScalarValue()) result = true;
testOk(result==true,"getScalarValue");
try {
easyData->getArrayValue();
pvaData->getArrayValue();
} catch (std::runtime_error e) {
cout << "getArrayValue " << e.what() << endl;
}
try {
easyData->getScalarArrayValue();
pvaData->getScalarArrayValue();
} catch (std::runtime_error e) {
cout << " getScalarArrayValue " << e.what() << endl;
}
cout << "as double " << easyData->getDouble() << endl;
cout << "as string " << easyData->getString() << endl;
cout << "as double " << pvaData->getDouble() << endl;
cout << "as string " << pvaData->getString() << endl;
try {
shared_vector<const double> value = easyData->getDoubleArray();
shared_vector<const double> value = pvaData->getDoubleArray();
} catch (std::runtime_error e) {
cout << " getDoubleArray " << e.what() << endl;
}
try {
shared_vector<const string> value = easyData->getStringArray();
shared_vector<const string> value = pvaData->getStringArray();
} catch (std::runtime_error e) {
cout << " getStringArray " << e.what() << endl;
}
@@ -93,11 +93,11 @@ void testDoubleArray()
addArray("value",pvDouble) ->
createStructure();
EasyMonitorDataPtr easyData = EasyMonitorData::create(structure);
MonitorElementPtr monitorElement(new MonitorElement(pvDataCreate->createPVStructure(easyData->getStructure())));
easyData->setData(monitorElement);
PVDoubleArrayPtr pvalue = easyData->getPVStructure()->getSubField<PVDoubleArray>("value");
BitSetPtr change = easyData->getChangedBitSet();
PvaClientMonitorDataPtr pvaData = PvaClientMonitorData::create(structure);
MonitorElementPtr monitorElement(new MonitorElement(pvDataCreate->createPVStructure(pvaData->getStructure())));
pvaData->setData(monitorElement);
PVDoubleArrayPtr pvalue = pvaData->getPVStructure()->getSubField<PVDoubleArray>("value");
BitSetPtr change = pvaData->getChangedBitSet();
size_t valueOffset = pvalue->getFieldOffset();
size_t len = 5;
shared_vector<double> value(len);
@@ -106,45 +106,45 @@ void testDoubleArray()
change->set(valueOffset);
testOk(change->cardinality()==1,"num set bits 1");
testOk(change->get(valueOffset)==true,"value changed");
testOk(easyData->hasValue()==true,"hasValue");
testOk(easyData->isValueScalar()==false,"isValueScalar");
testOk(easyData->isValueScalarArray()==true,"isValueScalarArray");
testOk(pvaData->hasValue()==true,"hasValue");
testOk(pvaData->isValueScalar()==false,"isValueScalar");
testOk(pvaData->isValueScalarArray()==true,"isValueScalarArray");
bool result;
result = false;
if(easyData->getValue()) result = true;
if(pvaData->getValue()) result = true;
testOk(result==true,"getValue");
result = false;
if(easyData->getArrayValue()) result = true;
if(pvaData->getArrayValue()) result = true;
testOk(result==true,"getArrayValue");
result = false;
if(easyData->getScalarArrayValue()) result = true;
if(pvaData->getScalarArrayValue()) result = true;
testOk(result==true,"getScalarValue");
try {
easyData->getScalarValue();
pvaData->getScalarValue();
} catch (std::runtime_error e) {
cout << " getScalarValue " << e.what() << endl;
}
try {
cout << "as double " << easyData->getDouble() << endl;
cout << "as double " << pvaData->getDouble() << endl;
} catch (std::runtime_error e) {
cout << " getDouble " << e.what() << endl;
}
try {
string val = easyData->getString();
string val = pvaData->getString();
} catch (std::runtime_error e) {
cout << " getString " << e.what() << endl;
}
cout << "as doubleArray " << easyData->getDoubleArray() << endl;
cout << "as doubleArray " << pvaData->getDoubleArray() << endl;
try {
shared_vector<const string> value = easyData->getStringArray();
shared_vector<const string> value = pvaData->getStringArray();
} catch (std::runtime_error e) {
cout << " getStringArray " << e.what() << endl;
}
}
MAIN(testEasyMonitorData)
MAIN(pvaClientTestMonitorData)
{
cout << "\nstarting testEasyMonitorData\n";
cout << "\nstarting pvaClientTestMonitorData\n";
testPlan(15);
testDouble();
testDoubleArray();
@@ -1,4 +1,4 @@
/*testEasyMultiDouble.cpp */
/*pvaClientTestMultiDouble.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -12,22 +12,22 @@
#include <iostream>
#include <pv/easyMultiDouble.h>
#include <pv/pvaClientMultiDouble.h>
#include <epicsUnitTest.h>
#include <testMain.h>
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace epics::easyPVA;
using namespace epics::pvaClient;
static void testGood(EasyPVAPtr const &easyPVA)
static void testGood(PvaClientPtr const &pvaClient)
{
bool isOk = true;
cout << "\nstarting testGood\n";
try {
EasyPVAPtr easyPVA(EasyPVA::create());
PvaClientPtr pvaClient(PvaClient::create());
size_t num = 5;
shared_vector<string> channelNames(num);
channelNames[0] = "exampleDouble01";
@@ -38,7 +38,7 @@ static void testGood(EasyPVAPtr const &easyPVA)
PVStringArrayPtr pvNames =
getPVDataCreate()->createPVScalarArray<PVStringArray>();
pvNames->replace(freeze(channelNames));
EasyMultiDoublePtr multiDouble(EasyMultiDouble::create(easyPVA,pvNames));
PvaClientMultiDoublePtr multiDouble(PvaClientMultiDouble::create(pvaClient,pvNames));
shared_vector<double> data = multiDouble->get();
cout << "initial " << data << endl;
for(size_t i=0; i<num; ++i) data[i] = data[i] + 1.1;
@@ -52,12 +52,12 @@ static void testGood(EasyPVAPtr const &easyPVA)
testOk(isOk==true,"all channels double");
}
static void testGoodMixed(EasyPVAPtr const &easyPVA)
static void testGoodMixed(PvaClientPtr const &pvaClient)
{
bool isOk = true;
cout << "\nstarting testGoodMixed\n";
try {
EasyPVAPtr easyPVA(EasyPVA::create());
PvaClientPtr pvaClient(PvaClient::create());
size_t num = 5;
shared_vector<string> channelNames(num);
channelNames[0] = "exampleByte";
@@ -68,7 +68,7 @@ static void testGoodMixed(EasyPVAPtr const &easyPVA)
PVStringArrayPtr pvNames =
getPVDataCreate()->createPVScalarArray<PVStringArray>();
pvNames->replace(freeze(channelNames));
EasyMultiDoublePtr multiDouble(EasyMultiDouble::create(easyPVA,pvNames));
PvaClientMultiDoublePtr multiDouble(PvaClientMultiDouble::create(pvaClient,pvNames));
shared_vector<double> data = multiDouble->get();
cout << "initial " << data << endl;
for(size_t i=0; i<num; ++i) data[i] = data[i] + 1.1;
@@ -82,12 +82,12 @@ static void testGoodMixed(EasyPVAPtr const &easyPVA)
testOk(isOk==true,"channels mixed type");
}
static void testChannelNotExist(EasyPVAPtr const &easyPVA)
static void testChannelNotExist(PvaClientPtr const &pvaClient)
{
bool isOk = true;
cout << "\nstarting testChannelNotExist\n";
try {
EasyPVAPtr easyPVA(EasyPVA::create());
PvaClientPtr pvaClient(PvaClient::create());
size_t num = 5;
shared_vector<string> channelNames(num);
channelNames[0] = "exampleDouble01";
@@ -98,7 +98,7 @@ static void testChannelNotExist(EasyPVAPtr const &easyPVA)
PVStringArrayPtr pvNames =
getPVDataCreate()->createPVScalarArray<PVStringArray>();
pvNames->replace(freeze(channelNames));
EasyMultiDoublePtr multiDouble(EasyMultiDouble::create(easyPVA,pvNames));
PvaClientMultiDoublePtr multiDouble(PvaClientMultiDouble::create(pvaClient,pvNames));
shared_vector<double> data = multiDouble->get();
cout << "initial " << data << endl;
for(size_t i=0; i<num; ++i) data[i] = data[i] + 1.1;
@@ -112,12 +112,12 @@ static void testChannelNotExist(EasyPVAPtr const &easyPVA)
testOk(isOk==false,"channel not exist");
}
static void testNonNumeric(EasyPVAPtr const &easyPVA)
static void testNonNumeric(PvaClientPtr const &pvaClient)
{
bool isOk = true;
cout << "\nstarting testNonNumeric\n";
try {
EasyPVAPtr easyPVA(EasyPVA::create());
PvaClientPtr pvaClient(PvaClient::create());
size_t num = 5;
shared_vector<string> channelNames(num);
channelNames[0] = "exampleDouble01";
@@ -128,7 +128,7 @@ static void testNonNumeric(EasyPVAPtr const &easyPVA)
PVStringArrayPtr pvNames =
getPVDataCreate()->createPVScalarArray<PVStringArray>();
pvNames->replace(freeze(channelNames));
EasyMultiDoublePtr multiDouble(EasyMultiDouble::create(easyPVA,pvNames));
PvaClientMultiDoublePtr multiDouble(PvaClientMultiDouble::create(pvaClient,pvNames));
shared_vector<double> data = multiDouble->get();
cout << "initial " << data << endl;
for(size_t i=0; i<num; ++i) data[i] = data[i] + 1.1;
@@ -142,15 +142,15 @@ static void testNonNumeric(EasyPVAPtr const &easyPVA)
testOk(isOk==false,"channel not numeric");
}
MAIN(testEasyMultiDouble)
MAIN(pvaClientTestMultiDouble)
{
cout << "\nstarting testEasyMultiDouble\n";
cout << "\nstarting pvaClientTestMultiDouble\n";
testPlan(4);
EasyPVAPtr easyPVA = EasyPVA::create();
testGood(easyPVA);
testGoodMixed(easyPVA);
testChannelNotExist(easyPVA);
testNonNumeric(easyPVA);
PvaClientPtr pvaClient = PvaClient::create();
testGood(pvaClient);
testGoodMixed(pvaClient);
testChannelNotExist(pvaClient);
testNonNumeric(pvaClient);
cout << "done\n";
return 0;
}
@@ -1,4 +1,4 @@
/*testEasyNTMultiChannel.cpp */
/*pvaClientTestNTMultiChannel.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -12,25 +12,25 @@
#include <iostream>
#include <pv/easyNTMultiChannel.h>
#include <pv/pvaClientNTMultiChannel.h>
#include <epicsUnitTest.h>
#include <testMain.h>
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace epics::easyPVA;
using namespace epics::pvaClient;
using namespace epics::nt;
using std::tr1::static_pointer_cast;
static void testGood(EasyPVAPtr const &easyPVA)
static void testGood(PvaClientPtr const &pvaClient)
{
PVDataCreatePtr pvDataCreate(getPVDataCreate());
bool isOk = true;
cout << "\nstarting testGood\n";
try {
EasyPVAPtr easyPVA(EasyPVA::create());
PvaClientPtr pvaClient(PvaClient::create());
size_t num = 5;
shared_vector<string> channelNames(num);
channelNames[0] = "exampleDouble";
@@ -51,9 +51,9 @@ static void testGood(EasyPVAPtr const &easyPVA)
addNanoseconds() ->
addUserTag() ->
createStructure();
EasyNTMultiChannelPtr easy = EasyNTMultiChannel::create(
easyPVA,pvNames,structure);
NTMultiChannelPtr nt = easy->get();
PvaClientNTMultiChannelPtr multi = PvaClientNTMultiChannel::create(
pvaClient,pvNames,structure);
NTMultiChannelPtr nt = multi->get();
for(size_t numtimes=0; numtimes<3; ++numtimes) {
PVUnionArrayPtr pvValue = nt->getPVStructure()->
getSubField<PVUnionArray>("value");
@@ -109,8 +109,8 @@ static void testGood(EasyPVAPtr const &easyPVA)
}
}
pvValue->replace(freeze(valueVector));
easy->put(nt);
nt = easy->get();
multi->put(nt);
nt = multi->get();
}
cout << "final\n" << nt->getPVStructure() << endl;
} catch (std::runtime_error e) {
@@ -121,12 +121,12 @@ static void testGood(EasyPVAPtr const &easyPVA)
}
MAIN(testEasyNTMultiChannel)
MAIN(pvaClientTestNTMultiChannel)
{
cout << "\nstarting testEasyNTMultiChannel\n";
cout << "\nstarting pvaClientTestNTMultiChannel\n";
testPlan(1);
EasyPVAPtr easyPVA = EasyPVA::create();
testGood(easyPVA);
PvaClientPtr pvaClient = PvaClient::create();
testGood(pvaClient);
cout << "done\n";
return 0;
}
@@ -1,4 +1,4 @@
/*testEasyPutData.cpp */
/*pvaClientTestPutData.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -15,15 +15,15 @@
#include <epicsUnitTest.h>
#include <testMain.h>
#include <pv/easyPVA.h>
#include <pv/pvaClient.h>
#include <pv/bitSet.h>
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace epics::easyPVA;
using namespace epics::pvaClient;
static EasyPVAPtr easyPVA = EasyPVA::create();
static PvaClientPtr pvaClient = PvaClient::create();
static FieldCreatePtr fieldCreate = getFieldCreate();
static StandardFieldPtr standardField = getStandardField();
static PVDataCreatePtr pvDataCreate = getPVDataCreate();
@@ -49,9 +49,9 @@ static void testPostPut()
endNested()->
createStructure();
EasyPutDataPtr easyData = EasyPutData::create(structure);
PVStructurePtr pvStructure = easyData->getPVStructure();
BitSetPtr change = easyData->getBitSet();
PvaClientPutDataPtr pvaData = PvaClientPutData::create(structure);
PVStructurePtr pvStructure = pvaData->getPVStructure();
BitSetPtr change = pvaData->getBitSet();
PVDoublePtr powerValue = pvStructure->getSubField<PVDouble>("power.value");
PVDoublePtr voltageValue = pvStructure->getSubField<PVDouble>("voltage.value");
PVDoublePtr currentValue = pvStructure->getSubField<PVDouble>("current.value");
@@ -63,7 +63,7 @@ static void testPostPut()
voltageValue->put(2.0);
currentValue->put(.5);
cout << "changed\n";
cout << easyData->showChanged(cout) << endl;
cout << pvaData->showChanged(cout) << endl;
testOk(change->cardinality()==3,"num set bits 3");
testOk(change->get(powerOffset)==true,"power changed");
testOk(change->get(voltageOffset)==true,"voltage changed");
@@ -80,52 +80,52 @@ void testDouble()
add("value",pvDouble) ->
createStructure();
EasyPutDataPtr easyData = EasyPutData::create(structure);
PVDoublePtr pvDouble = easyData->getPVStructure()->getSubField<PVDouble>("value");
PvaClientPutDataPtr pvaData = PvaClientPutData::create(structure);
PVDoublePtr pvDouble = pvaData->getPVStructure()->getSubField<PVDouble>("value");
pvDouble->put(5.0);
BitSetPtr change = easyData->getBitSet();
BitSetPtr change = pvaData->getBitSet();
size_t valueOffset = pvDouble->getFieldOffset();
testOk(change->cardinality()==1,"num set bits 1");
testOk(change->get(valueOffset)==true,"value changed");
testOk(easyData->hasValue()==true,"hasValue");
testOk(easyData->isValueScalar()==true,"isValueScalar");
testOk(easyData->isValueScalarArray()==false,"isValueScalarArray");
testOk(pvaData->hasValue()==true,"hasValue");
testOk(pvaData->isValueScalar()==true,"isValueScalar");
testOk(pvaData->isValueScalarArray()==false,"isValueScalarArray");
bool result;
result = false;
if(easyData->getValue()) result = true;
if(pvaData->getValue()) result = true;
testOk(result==true,"getValue");
result = false;
if(easyData->getScalarValue()) result = true;
if(pvaData->getScalarValue()) result = true;
testOk(result==true,"getScalarValue");
try {
easyData->getArrayValue();
pvaData->getArrayValue();
} catch (std::runtime_error e) {
cout << "getArrayValue " << e.what() << endl;
}
try {
easyData->getScalarArrayValue();
pvaData->getScalarArrayValue();
} catch (std::runtime_error e) {
cout << " getScalarArrayValue " << e.what() << endl;
}
cout << "as double " << easyData->getDouble() << endl;
cout << "as string " << easyData->getString() << endl;
cout << "as double " << pvaData->getDouble() << endl;
cout << "as string " << pvaData->getString() << endl;
try {
shared_vector<const double> value = easyData->getDoubleArray();
shared_vector<const double> value = pvaData->getDoubleArray();
} catch (std::runtime_error e) {
cout << " getDoubleArray " << e.what() << endl;
}
try {
shared_vector<const string> value = easyData->getStringArray();
shared_vector<const string> value = pvaData->getStringArray();
} catch (std::runtime_error e) {
cout << " getStringArray " << e.what() << endl;
}
easyData->putDouble(5.0);
easyData->putString("1e5");
pvaData->putDouble(5.0);
pvaData->putString("1e5");
try {
size_t len = 2;
shared_vector<double> val(len);
for(size_t i=0; i<len; ++i) val[i] = (i+1)*10.0;
easyData->putDoubleArray(freeze(val));
pvaData->putDoubleArray(freeze(val));
} catch (std::runtime_error e) {
cout << " putDoubleArray " << e.what() << endl;
}
@@ -133,7 +133,7 @@ void testDouble()
size_t len = 2;
shared_vector<string> val(len);
val[0] = "one"; val[1] = "two";
easyData->putStringArray(freeze(val));
pvaData->putStringArray(freeze(val));
} catch (std::runtime_error e) {
cout << " putStringArray " << e.what() << endl;
}
@@ -149,78 +149,78 @@ void testDoubleArray()
addArray("value",pvDouble) ->
createStructure();
EasyPutDataPtr easyData = EasyPutData::create(structure);
PVDoubleArrayPtr pvalue = easyData->getPVStructure()->getSubField<PVDoubleArray>("value");
PvaClientPutDataPtr pvaData = PvaClientPutData::create(structure);
PVDoubleArrayPtr pvalue = pvaData->getPVStructure()->getSubField<PVDoubleArray>("value");
size_t len = 5;
shared_vector<double> value(len);
for(size_t i=0; i<len; ++i) value[i] = i*10.0;
pvalue->replace(freeze(value));
BitSetPtr change = easyData->getBitSet();
BitSetPtr change = pvaData->getBitSet();
size_t valueOffset = pvalue->getFieldOffset();
testOk(change->cardinality()==1,"num set bits 1");
testOk(change->get(valueOffset)==true,"value changed");
testOk(easyData->hasValue()==true,"hasValue");
testOk(easyData->isValueScalar()==false,"isValueScalar");
testOk(easyData->isValueScalarArray()==true,"isValueScalarArray");
testOk(pvaData->hasValue()==true,"hasValue");
testOk(pvaData->isValueScalar()==false,"isValueScalar");
testOk(pvaData->isValueScalarArray()==true,"isValueScalarArray");
bool result;
result = false;
if(easyData->getValue()) result = true;
if(pvaData->getValue()) result = true;
testOk(result==true,"getValue");
result = false;
if(easyData->getArrayValue()) result = true;
if(pvaData->getArrayValue()) result = true;
testOk(result==true,"getArrayValue");
result = false;
if(easyData->getScalarArrayValue()) result = true;
if(pvaData->getScalarArrayValue()) result = true;
testOk(result==true,"getScalarValue");
try {
easyData->getScalarValue();
pvaData->getScalarValue();
} catch (std::runtime_error e) {
cout << " getScalarValue " << e.what() << endl;
}
try {
cout << "as double " << easyData->getDouble() << endl;
cout << "as double " << pvaData->getDouble() << endl;
} catch (std::runtime_error e) {
cout << " getDouble " << e.what() << endl;
}
try {
string val = easyData->getString();
string val = pvaData->getString();
} catch (std::runtime_error e) {
cout << " getString " << e.what() << endl;
}
cout << "as doubleArray " << easyData->getDoubleArray() << endl;
cout << "as doubleArray " << pvaData->getDoubleArray() << endl;
try {
shared_vector<const string> value = easyData->getStringArray();
shared_vector<const string> value = pvaData->getStringArray();
} catch (std::runtime_error e) {
cout << " getStringArray " << e.what() << endl;
}
try {
easyData->putDouble(5.0);
pvaData->putDouble(5.0);
} catch (std::runtime_error e) {
cout << " putDouble " << e.what() << endl;
}
try {
easyData->putString("1e5");
pvaData->putString("1e5");
} catch (std::runtime_error e) {
cout << " putString " << e.what() << endl;
}
value = shared_vector<double>(len);
for(size_t i=0; i<len; ++i) value[i] = (i+1)* 2;
easyData->putDoubleArray(freeze(value));
cout << "as doubleArray " << easyData->getDoubleArray() << endl;
pvaData->putDoubleArray(freeze(value));
cout << "as doubleArray " << pvaData->getDoubleArray() << endl;
try {
size_t len = 2;
shared_vector<string> val(len);
val[0] = "one"; val[1] = "two";
easyData->putStringArray(freeze(val));
pvaData->putStringArray(freeze(val));
cout << "as stringArray " << val << endl;
} catch (std::runtime_error e) {
cout << " putStringArray " << e.what() << endl;
}
}
MAIN(testEasyPutData)
MAIN(pvaClientTestPutData)
{
cout << "\nstarting testEasyPutData\n";
cout << "\nstarting pvaClientTestPutData\n";
testPlan(19);
testPostPut();
testDouble();
@@ -1,4 +1,4 @@
/*exampleEasyPutGet.cpp */
/*pvaClientTestPutGet.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -12,26 +12,30 @@
#include <iostream>
#include <pv/easyPVA.h>
#include <pv/pvaClient.h>
#include <epicsUnitTest.h>
#include <testMain.h>
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 &pvaClient)
{
cout << "\nstarting channelPutGet example\n";
try {
EasyChannelPtr easyChannel = easyPVA->createChannel("examplePowerSupply");
easyChannel->connect(2.0);
cout << "calling createChannel\n";
PvaClientChannelPtr pvaChannel = pvaClient->createChannel("examplePowerSupply");
cout << "calling connect\n";
pvaChannel->connect(2.0);
testOk(true==true,"connected");
EasyPutGetPtr putGet = easyChannel->createPutGet(
cout << "calling createPutGet\n";
PvaClientPutGetPtr putGet = pvaChannel->createPutGet(
"putField(power.value,voltage.value)getField()");
EasyPutDataPtr putData = putGet->getPutData();
cout << "calling getPutData\n";
PvaClientPutDataPtr putData = putGet->getPutData();
testOk(true==true,"put connected");
PVStructurePtr pvStructure = putData->getPVStructure();
PVDoublePtr power = pvStructure->getSubField<PVDouble>("power.value");
@@ -39,7 +43,7 @@ static void example(EasyPVAPtr const &easyPVA)
power->put(5.0);
voltage->put(5.0);
putGet->putGet();
EasyGetDataPtr getData = putGet->getGetData();
PvaClientGetDataPtr getData = putGet->getGetData();
pvStructure = getData->getPVStructure();
BitSetPtr bitSet = getData->getBitSet();
cout << "changed " << getData->showChanged(cout) << endl;
@@ -55,12 +59,12 @@ static void example(EasyPVAPtr const &easyPVA)
}
MAIN(testEasyPutGet)
MAIN(pvaClientTestPutGet)
{
cout << "\nstarting testEasyPutGet\n";
cout << "\nstarting pvaClientTestPutGet\n";
testPlan(2);
EasyPVAPtr easyPVA = EasyPVA::create();
example(easyPVA);
PvaClientPtr pvaClient = PvaClient::create();
example(pvaClient);
cout << "done\n";
return 0;
}
@@ -1,4 +1,4 @@
/*testEasyPutGetMonitor.cpp */
/*pvaClientTestPutGetMonitor.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@@ -12,52 +12,52 @@
#include <iostream>
#include <pv/easyPVA.h>
#include <pv/pvaClient.h>
#include <epicsUnitTest.h>
#include <testMain.h>
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace epics::easyPVA;
using namespace epics::pvaClient;
class MyMonitor : public EasyMonitorRequester
class MyMonitor : public PvaClientMonitorRequester
{
public:
MyMonitor() {}
virtual ~MyMonitor() {}
virtual void event(EasyMonitorPtr monitor)
virtual void event(PvaClientMonitorPtr monitor)
{
while(true) {
if(!monitor->poll()) return;
EasyMonitorDataPtr easyData = monitor->getData();
PvaClientMonitorDataPtr pvaData = monitor->getData();
cout << "changed\n";
easyData->showChanged(cout);
pvaData->showChanged(cout);
cout << "overrun\n";
easyData->showOverrun(cout);
pvaData->showOverrun(cout);
monitor->releaseEvent();
}
}
};
static void exampleDouble(EasyPVAPtr const &easyPVA)
static void exampleDouble(PvaClientPtr const &pvaClient)
{
cout << "\nstarting exampleDouble\n";
try {
cout << "long way\n";
EasyChannelPtr easyChannel = easyPVA->createChannel("exampleDouble");
easyChannel->connect(2.0);
PvaClientChannelPtr pvaChannel = pvaClient->createChannel("exampleDouble");
pvaChannel->connect(2.0);
testOk(true==true,"connected");
EasyPutPtr put = easyChannel->createPut();
EasyPutDataPtr putData = put->getData();
PvaClientPutPtr put = pvaChannel->createPut();
PvaClientPutDataPtr putData = put->getData();
testOk(true==true,"put connected");
EasyGetPtr get = easyChannel->createGet();
EasyGetDataPtr getData = get->getData();
PvaClientGetPtr get = pvaChannel->createGet();
PvaClientGetDataPtr getData = get->getData();
testOk(true==true,"get connected");
EasyMonitorRequesterPtr requester(new MyMonitor());
EasyMonitorPtr monitor = easyChannel->monitor(requester);
PvaClientMonitorRequesterPtr requester(new MyMonitor());
PvaClientMonitorPtr monitor = pvaChannel->monitor(requester);
testOk(true==true,"monitor connected");
double out;
double in;
@@ -69,7 +69,7 @@ static void exampleDouble(EasyPVAPtr const &easyPVA)
in = getData->getDouble();
cout << "out " << out << " in " << in << endl;
}
EasyProcessPtr process = easyChannel->createProcess();
PvaClientProcessPtr process = pvaChannel->createProcess();
process->connect();
process->process();
} catch (std::runtime_error e) {
@@ -78,12 +78,12 @@ static void exampleDouble(EasyPVAPtr const &easyPVA)
}
MAIN(testEasyPutGetMonitor)
MAIN(pvaClientTestPutGetMonitor)
{
cout << "\nstarting testEasyPutGetMonitor\n";
cout << "\nstarting pvaClientTestPutGetMonitor\n";
testPlan(4);
EasyPVAPtr easyPVA = EasyPVA::create();
exampleDouble(easyPVA);
PvaClientPtr pvaClient = PvaClient::create();
exampleDouble(pvaClient);
cout << "done\n";
return 0;
}