remove examples (moved to exampleCPP) ; test is now a regresion test (make runtests)
This commit is contained in:
@ -1,11 +1,28 @@
|
||||
#Makefile at top of application tree
|
||||
TOP = .
|
||||
# Makefile for the pvData tests
|
||||
|
||||
TOP = ..
|
||||
include $(TOP)/configure/CONFIG
|
||||
DIRS += configure
|
||||
|
||||
DIRS += src
|
||||
src_DEPEND_DIRS = configure
|
||||
PVDATABASE_TEST = $(TOP)/test
|
||||
|
||||
include $(TOP)/configure/RULES_TOP
|
||||
PROD_LIBS += pvDatabase pvAccess pvData Com
|
||||
|
||||
include $(PVDATABASE_TEST)/src/Makefile
|
||||
|
||||
# The testHarness runs all the test programs in a known working order.
|
||||
testHarness_SRCS += pvDatabaseAllTests.c
|
||||
|
||||
PROD_vxWorks = vxTestHarness
|
||||
vxTestHarness_SRCS += $(testHarness_SRCS)
|
||||
TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); pvDatabaseAllTests
|
||||
|
||||
PROD_RTEMS += rtemsTestHarness
|
||||
rtemsTestHarness_SRCS += rtemsTestHarness.c rtemsConfig.c
|
||||
rtemsTestHarness_SRCS += $(testHarness_SRCS)
|
||||
TESTSPEC_RTEMS = rtemsTestHarness.$(MUNCH_SUFFIX); pvDatabaseAllTests
|
||||
|
||||
TESTSCRIPTS_HOST += $(TESTS:%=%.t)
|
||||
|
||||
include $(TOP)/configure/RULES
|
||||
|
||||
|
||||
|
@ -1,29 +0,0 @@
|
||||
# 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
|
||||
|
@ -1,39 +0,0 @@
|
||||
# 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 = vxWorks-68040
|
||||
|
||||
# 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>
|
||||
|
||||
INSTALL_INCLUDE = $(INSTALL_LOCATION)/include/pv
|
||||
USR_INCLUDES += -I $(INSTALL_LOCATION)/include
|
||||
|
||||
-include $(TOP)/../../CONFIG_SITE.local
|
||||
-include $(TOP)/../configure/CONFIG_SITE.local
|
@ -1,8 +0,0 @@
|
||||
TOP=..
|
||||
|
||||
include $(TOP)/configure/CONFIG
|
||||
|
||||
TARGETS = $(CONFIG_TARGETS)
|
||||
CONFIGS += $(subst ../,,$(wildcard $(CONFIG_INSTALLS)))
|
||||
|
||||
include $(TOP)/configure/RULES
|
@ -1,40 +0,0 @@
|
||||
# pvDatabaseCPP/test RELEASE - Location of external support modules
|
||||
#
|
||||
# IF YOU CHANGE this file or any file it includes you must
|
||||
# subsequently do a "gnumake rebuild" in the application's
|
||||
# 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!
|
||||
#
|
||||
# Create a file RELEASE.local pointing to your places
|
||||
# for the dependencies, e.g.
|
||||
# PVACCESS = /path/to/epics/pvAccessCPP
|
||||
# PVDATA = /path/to/epics/pvDataCPP
|
||||
# PVCOMMON = /path/to/epics/pvCommonCPP
|
||||
# EPICS_BASE = /path/to/epics/base
|
||||
|
||||
# If these tests are built in a directory under pvDatabaseCPP,
|
||||
# use the following definitions:
|
||||
|
||||
PVDATABASE = $(TOP)/..
|
||||
-include $(TOP)/../../RELEASE.local
|
||||
-include $(TOP)/../configure/RELEASE.local
|
||||
|
||||
# If you copied these tests from pvDatabaseCPP to be built as a
|
||||
# standalone TOP, define
|
||||
# PVDATABASE = /path/to/epics/pvDatabaseCPP
|
||||
# in the appropriate RELEASE[.local],
|
||||
# and use the following definitions instead:
|
||||
|
||||
#-include $(TOP)/../RELEASE.local
|
||||
#-include $(TOP)/configure/RELEASE.local
|
@ -1,6 +0,0 @@
|
||||
# RULES
|
||||
|
||||
include $(CONFIG)/RULES
|
||||
|
||||
# Library should be rebuilt because LIBOBJS may have changed.
|
||||
$(LIBNAME): ../Makefile
|
@ -1,2 +0,0 @@
|
||||
#RULES.ioc
|
||||
include $(CONFIG)/RULES.ioc
|
@ -1,2 +0,0 @@
|
||||
#RULES_DIRS
|
||||
include $(CONFIG)/RULES_DIRS
|
@ -1,3 +0,0 @@
|
||||
#RULES_TOP
|
||||
include $(CONFIG)/RULES_TOP
|
||||
|
@ -1,37 +1,21 @@
|
||||
TOP=..
|
||||
|
||||
include $(TOP)/configure/CONFIG
|
||||
# This is a Makefile fragment, see ../Makefile
|
||||
|
||||
DBD += powerSupplyRegister.dbd
|
||||
SRC_DIRS += $(PVDATABASE_TEST)/src
|
||||
|
||||
INC += powerSupply.h
|
||||
|
||||
LIBRARY_IOC += powerSupply
|
||||
powerSupply_SRCS += powerSupply.cpp
|
||||
powerSupply_SRCS += powerSupplyRegister.cpp
|
||||
powerSupply_LIBS += pvDatabase
|
||||
powerSupply_LIBS += pvAccess
|
||||
powerSupply_LIBS += pvData
|
||||
powerSupply_LIBS += Com
|
||||
powerSupply_LIBS += $(EPICS_BASE_IOC_LIBS)
|
||||
|
||||
|
||||
PROD_HOST += testPVCopy
|
||||
testPVCopy_SRCS += powerSupply.cpp
|
||||
TESTPROD_HOST += testPVCopy
|
||||
testPVCopy_SRCS += testPVCopy.cpp
|
||||
testPVCopy_LIBS += pvDatabase pvAccess pvData Com
|
||||
testHarness_SRCS += testPVCopy.cpp
|
||||
TESTS += testPVCopy
|
||||
|
||||
PROD_HOST += testPVRecord
|
||||
testPVRecord_SRCS += powerSupply.cpp
|
||||
TESTPROD_HOST += testPVRecord
|
||||
testPVRecord_SRCS += testPVRecord.cpp
|
||||
testPVRecord_LIBS += pvDatabase pvAccess pvData Com
|
||||
testHarness_SRCS += testPVRecord.cpp
|
||||
TESTS += testPVRecord
|
||||
|
||||
PROD_HOST += testExampleRecord
|
||||
testExampleRecord_SRCS += powerSupply.cpp
|
||||
TESTPROD_HOST += testExampleRecord
|
||||
testExampleRecord_SRCS += testExampleRecord.cpp
|
||||
testExampleRecord_LIBS += pvDatabase pvAccess pvData Com
|
||||
testHarness_SRCS += testExampleRecord.cpp
|
||||
TESTS += testExampleRecord
|
||||
|
||||
include $(TOP)/configure/RULES
|
||||
#----------------------------------------
|
||||
# ADD RULES AFTER THIS LINE
|
||||
|
||||
|
@ -1,162 +0,0 @@
|
||||
/* powerSupply.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 2013.04.02
|
||||
*/
|
||||
|
||||
#include <pv/standardField.h>
|
||||
#include <pv/standardPVField.h>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include "powerSupply.h"
|
||||
|
||||
using namespace epics::pvData;
|
||||
using std::string;
|
||||
using std::cout;
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
|
||||
namespace epics { namespace pvDatabase {
|
||||
|
||||
PVStructurePtr createPowerSupply()
|
||||
{
|
||||
FieldCreatePtr fieldCreate = getFieldCreate();
|
||||
StandardFieldPtr standardField = getStandardField();
|
||||
PVDataCreatePtr pvDataCreate = getPVDataCreate();
|
||||
|
||||
return pvDataCreate->createPVStructure(
|
||||
fieldCreate->createFieldBuilder()->
|
||||
add("alarm",standardField->alarm()) ->
|
||||
add("timeStamp",standardField->timeStamp()) ->
|
||||
addNestedStructure("power") ->
|
||||
add("value",pvDouble) ->
|
||||
add("alarm",standardField->alarm()) ->
|
||||
endNested()->
|
||||
addNestedStructure("voltage") ->
|
||||
add("value",pvDouble) ->
|
||||
add("alarm",standardField->alarm()) ->
|
||||
endNested()->
|
||||
addNestedStructure("current") ->
|
||||
add("value",pvDouble) ->
|
||||
add("alarm",standardField->alarm()) ->
|
||||
endNested()->
|
||||
createStructure());
|
||||
}
|
||||
|
||||
PowerSupplyPtr PowerSupply::create(
|
||||
string const & recordName,
|
||||
PVStructurePtr const & pvStructure)
|
||||
{
|
||||
PowerSupplyPtr pvRecord(
|
||||
new PowerSupply(recordName,pvStructure));
|
||||
if(!pvRecord->init()) pvRecord.reset();
|
||||
return pvRecord;
|
||||
}
|
||||
|
||||
PowerSupply::PowerSupply(
|
||||
string const & recordName,
|
||||
PVStructurePtr const & pvStructure)
|
||||
: PVRecord(recordName,pvStructure)
|
||||
{
|
||||
}
|
||||
|
||||
PowerSupply::~PowerSupply()
|
||||
{
|
||||
}
|
||||
|
||||
void PowerSupply::destroy()
|
||||
{
|
||||
PVRecord::destroy();
|
||||
}
|
||||
|
||||
bool PowerSupply::init()
|
||||
{
|
||||
initPVRecord();
|
||||
PVStructurePtr pvStructure = getPVStructure();
|
||||
PVFieldPtr pvField;
|
||||
bool result;
|
||||
pvField = pvStructure->getSubField("timeStamp");
|
||||
if(!pvField) {
|
||||
cerr << "no timeStamp" << endl;
|
||||
return false;
|
||||
}
|
||||
result = pvTimeStamp.attach(pvField);
|
||||
if(!result) {
|
||||
cerr << "no timeStamp" << endl;
|
||||
return false;
|
||||
}
|
||||
pvField = pvStructure->getSubField("alarm");
|
||||
if(!pvField) {
|
||||
cerr << "no alarm" << endl;
|
||||
return false;
|
||||
}
|
||||
result = pvAlarm.attach(pvField);
|
||||
if(!result) {
|
||||
cerr << "no alarm" << endl;
|
||||
return false;
|
||||
}
|
||||
pvCurrent = pvStructure->getSubField<PVDouble>("current.value");
|
||||
if(!pvCurrent) {
|
||||
cerr << "no current\n";
|
||||
return false;
|
||||
}
|
||||
pvVoltage = pvStructure->getSubField<PVDouble>("voltage.value");
|
||||
if(!pvVoltage) {
|
||||
cerr << "no current\n";
|
||||
return false;
|
||||
}
|
||||
pvPower = pvStructure->getSubField<PVDouble>("power.value");
|
||||
if(!pvPower) {
|
||||
cerr << "no powert\n";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void PowerSupply::process()
|
||||
{
|
||||
timeStamp.getCurrent();
|
||||
pvTimeStamp.set(timeStamp);
|
||||
double voltage = pvVoltage->get();
|
||||
double power = pvPower->get();
|
||||
if(voltage<1e-3 && voltage>-1e-3) {
|
||||
alarm.setMessage("bad voltage");
|
||||
alarm.setSeverity(majorAlarm);
|
||||
pvAlarm.set(alarm);
|
||||
return;
|
||||
}
|
||||
double current = power/voltage;
|
||||
pvCurrent->put(current);
|
||||
alarm.setMessage("");
|
||||
alarm.setSeverity(noAlarm);
|
||||
pvAlarm.set(alarm);
|
||||
}
|
||||
|
||||
void PowerSupply::put(double power,double voltage)
|
||||
{
|
||||
pvPower->put(power);
|
||||
pvVoltage->put(voltage);
|
||||
}
|
||||
|
||||
double PowerSupply::getPower()
|
||||
{
|
||||
return pvPower->get();
|
||||
}
|
||||
|
||||
double PowerSupply::getVoltage()
|
||||
{
|
||||
return pvVoltage->get();
|
||||
}
|
||||
|
||||
double PowerSupply::getCurrent()
|
||||
{
|
||||
return pvCurrent->get();
|
||||
}
|
||||
|
||||
|
||||
}}
|
@ -30,11 +30,10 @@
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
//epicsShareExtern epics::pvData::PVStructurePtr createPowerSupply();
|
||||
|
||||
namespace epics { namespace pvDatabase {
|
||||
|
||||
epicsShareExtern epics::pvData::PVStructurePtr createPowerSupply();
|
||||
|
||||
class PowerSupply;
|
||||
typedef std::tr1::shared_ptr<PowerSupply> PowerSupplyPtr;
|
||||
|
||||
@ -66,6 +65,141 @@ private:
|
||||
epics::pvData::TimeStamp timeStamp;
|
||||
};
|
||||
|
||||
epics::pvData::PVStructurePtr createPowerSupply()
|
||||
{
|
||||
epics::pvData::FieldCreatePtr fieldCreate = epics::pvData::getFieldCreate();
|
||||
epics::pvData::StandardFieldPtr standardField = epics::pvData::getStandardField();
|
||||
epics::pvData::PVDataCreatePtr pvDataCreate = epics::pvData::getPVDataCreate();
|
||||
|
||||
return pvDataCreate->createPVStructure(
|
||||
fieldCreate->createFieldBuilder()->
|
||||
add("alarm",standardField->alarm()) ->
|
||||
add("timeStamp",standardField->timeStamp()) ->
|
||||
addNestedStructure("power") ->
|
||||
add("value",epics::pvData::pvDouble) ->
|
||||
add("alarm",standardField->alarm()) ->
|
||||
endNested()->
|
||||
addNestedStructure("voltage") ->
|
||||
add("value",epics::pvData::pvDouble) ->
|
||||
add("alarm",standardField->alarm()) ->
|
||||
endNested()->
|
||||
addNestedStructure("current") ->
|
||||
add("value",epics::pvData::pvDouble) ->
|
||||
add("alarm",standardField->alarm()) ->
|
||||
endNested()->
|
||||
createStructure());
|
||||
}
|
||||
|
||||
PowerSupplyPtr PowerSupply::create(
|
||||
std::string const & recordName,
|
||||
epics::pvData::PVStructurePtr const & pvStructure)
|
||||
{
|
||||
PowerSupplyPtr pvRecord(
|
||||
new PowerSupply(recordName,pvStructure));
|
||||
if(!pvRecord->init()) pvRecord.reset();
|
||||
return pvRecord;
|
||||
}
|
||||
|
||||
PowerSupply::PowerSupply(
|
||||
std::string const & recordName,
|
||||
epics::pvData::PVStructurePtr const & pvStructure)
|
||||
: PVRecord(recordName,pvStructure)
|
||||
{
|
||||
}
|
||||
|
||||
PowerSupply::~PowerSupply()
|
||||
{
|
||||
}
|
||||
|
||||
void PowerSupply::destroy()
|
||||
{
|
||||
PVRecord::destroy();
|
||||
}
|
||||
|
||||
bool PowerSupply::init()
|
||||
{
|
||||
initPVRecord();
|
||||
epics::pvData::PVStructurePtr pvStructure = getPVStructure();
|
||||
epics::pvData::PVFieldPtr pvField;
|
||||
bool result;
|
||||
pvField = pvStructure->getSubField("timeStamp");
|
||||
if(!pvField) {
|
||||
std::cerr << "no timeStamp" << std::endl;
|
||||
return false;
|
||||
}
|
||||
result = pvTimeStamp.attach(pvField);
|
||||
if(!result) {
|
||||
std::cerr << "no timeStamp" << std::endl;
|
||||
return false;
|
||||
}
|
||||
pvField = pvStructure->getSubField("alarm");
|
||||
if(!pvField) {
|
||||
std::cerr << "no alarm" << std::endl;
|
||||
return false;
|
||||
}
|
||||
result = pvAlarm.attach(pvField);
|
||||
if(!result) {
|
||||
std::cerr << "no alarm" << std::endl;
|
||||
return false;
|
||||
}
|
||||
pvCurrent = pvStructure->getSubField<epics::pvData::PVDouble>("current.value");
|
||||
if(!pvCurrent) {
|
||||
std::cerr << "no current\n";
|
||||
return false;
|
||||
}
|
||||
pvVoltage = pvStructure->getSubField<epics::pvData::PVDouble>("voltage.value");
|
||||
if(!pvVoltage) {
|
||||
std::cerr << "no current\n";
|
||||
return false;
|
||||
}
|
||||
pvPower = pvStructure->getSubField<epics::pvData::PVDouble>("power.value");
|
||||
if(!pvPower) {
|
||||
std::cerr << "no powert\n";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void PowerSupply::process()
|
||||
{
|
||||
timeStamp.getCurrent();
|
||||
pvTimeStamp.set(timeStamp);
|
||||
double voltage = pvVoltage->get();
|
||||
double power = pvPower->get();
|
||||
if(voltage<1e-3 && voltage>-1e-3) {
|
||||
alarm.setMessage("bad voltage");
|
||||
alarm.setSeverity(epics::pvData::majorAlarm);
|
||||
pvAlarm.set(alarm);
|
||||
return;
|
||||
}
|
||||
double current = power/voltage;
|
||||
pvCurrent->put(current);
|
||||
alarm.setMessage("");
|
||||
alarm.setSeverity(epics::pvData::noAlarm);
|
||||
pvAlarm.set(alarm);
|
||||
}
|
||||
|
||||
void PowerSupply::put(double power,double voltage)
|
||||
{
|
||||
pvPower->put(power);
|
||||
pvVoltage->put(voltage);
|
||||
}
|
||||
|
||||
double PowerSupply::getPower()
|
||||
{
|
||||
return pvPower->get();
|
||||
}
|
||||
|
||||
double PowerSupply::getVoltage()
|
||||
{
|
||||
return pvVoltage->get();
|
||||
}
|
||||
|
||||
double PowerSupply::getCurrent()
|
||||
{
|
||||
return pvCurrent->get();
|
||||
}
|
||||
|
||||
|
||||
}}
|
||||
|
||||
|
@ -1,72 +0,0 @@
|
||||
/*powerSupplyRegister.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 2013.07.24
|
||||
*/
|
||||
|
||||
|
||||
/* Author: Marty Kraimer */
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
|
||||
#include <cantProceed.h>
|
||||
#include <epicsStdio.h>
|
||||
#include <epicsMutex.h>
|
||||
#include <epicsEvent.h>
|
||||
#include <epicsThread.h>
|
||||
#include <iocsh.h>
|
||||
|
||||
#include <pv/pvIntrospect.h>
|
||||
#include <pv/pvData.h>
|
||||
#include <pv/pvAccess.h>
|
||||
#include <pv/pvDatabase.h>
|
||||
|
||||
#include <epicsExport.h>
|
||||
#include <pv/powerSupply.h>
|
||||
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::pvDatabase;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
|
||||
static const iocshArg testArg0 = { "recordName", iocshArgString };
|
||||
static const iocshArg *testArgs[] = {
|
||||
&testArg0};
|
||||
|
||||
static const iocshFuncDef powerSupplyFuncDef = {
|
||||
"powerSupplyCreateRecord", 1, testArgs};
|
||||
static void powerSupplyCallFunc(const iocshArgBuf *args)
|
||||
{
|
||||
char *recordName = args[0].sval;
|
||||
PVStructurePtr pv = createPowerSupply();
|
||||
|
||||
PowerSupplyPtr record = PowerSupply::create(recordName,pv);
|
||||
bool result = PVDatabase::getMaster()->addRecord(record);
|
||||
if(!result) cout << "recordname" << " not added" << endl;
|
||||
}
|
||||
|
||||
static void powerSupplyRegister(void)
|
||||
{
|
||||
static int firstTime = 1;
|
||||
if (firstTime) {
|
||||
firstTime = 0;
|
||||
iocshRegister(&powerSupplyFuncDef, powerSupplyCallFunc);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
epicsExportRegistrar(powerSupplyRegister);
|
||||
}
|
@ -1 +0,0 @@
|
||||
registrar("powerSupplyRegister")
|
@ -10,6 +10,9 @@
|
||||
|
||||
/* Author: Marty Kraimer */
|
||||
|
||||
#include <epicsUnitTest.h>
|
||||
#include <testMain.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <cstddef>
|
||||
@ -37,7 +40,7 @@ using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::pvDatabase;
|
||||
|
||||
|
||||
static bool debug = false;
|
||||
|
||||
|
||||
void test()
|
||||
@ -57,7 +60,7 @@ void test()
|
||||
pvRecord->process();
|
||||
pvRecord->unlock();
|
||||
}
|
||||
cout << "processed exampleDouble " << endl;
|
||||
if(debug) {cout << "processed exampleDouble " << endl; }
|
||||
pvRecord->destroy();
|
||||
pvRecord.reset();
|
||||
recordName = "powerSupplyExample";
|
||||
@ -65,8 +68,9 @@ void test()
|
||||
PowerSupplyPtr psr;
|
||||
pvStructure = createPowerSupply();
|
||||
psr = PowerSupply::create("powerSupply",pvStructure);
|
||||
if(psr.get()==NULL) {
|
||||
cout << "PowerSupplyRecordTest::create failed" << endl;
|
||||
testOk1(psr.get()!=0);
|
||||
if(!psr) {
|
||||
if(debug) {cout << "PowerSupplyRecordTest::create failed" << endl;}
|
||||
return;
|
||||
}
|
||||
pvStructure.reset();
|
||||
@ -78,17 +82,24 @@ void test()
|
||||
current = psr->getCurrent();
|
||||
psr->unlock();
|
||||
}
|
||||
cout << "initial ";
|
||||
cout << " voltage " << voltage ;
|
||||
cout << " power " << power;
|
||||
cout << " current " << current;
|
||||
cout << endl;
|
||||
if(debug ) {
|
||||
cout << "initial ";
|
||||
cout << " voltage " << voltage ;
|
||||
cout << " power " << power;
|
||||
cout << " current " << current;
|
||||
cout << endl;
|
||||
}
|
||||
testOk1(psr->getVoltage()==0.0);
|
||||
testOk1(psr->getPower()==0.0);
|
||||
testOk1(psr->getCurrent()==0.0);
|
||||
voltage = 1.0;
|
||||
power = 1.0;
|
||||
cout << "before put ";
|
||||
cout << " voltage " << voltage ;
|
||||
cout << " power " << power;
|
||||
cout << endl;
|
||||
if(debug) {
|
||||
cout << "before put ";
|
||||
cout << " voltage " << voltage ;
|
||||
cout << " power " << power;
|
||||
cout << endl;
|
||||
}
|
||||
{
|
||||
psr->lock();
|
||||
psr->put(power,voltage);
|
||||
@ -97,21 +108,27 @@ void test()
|
||||
}
|
||||
{
|
||||
psr->lock();
|
||||
cout << "after put ";
|
||||
cout << " voltage " << psr->getVoltage() ;
|
||||
cout << " power " << psr->getPower();
|
||||
cout << " current " << psr->getCurrent();
|
||||
cout << endl;
|
||||
if(debug) {
|
||||
cout << "after put ";
|
||||
cout << " voltage " << psr->getVoltage() ;
|
||||
cout << " power " << psr->getPower();
|
||||
cout << " current " << psr->getCurrent();
|
||||
cout << endl;
|
||||
}
|
||||
psr->unlock();
|
||||
}
|
||||
testOk1(psr->getVoltage()==1.0);
|
||||
testOk1(psr->getPower()==1.0);
|
||||
testOk1(psr->getCurrent()==1.0);
|
||||
PVDatabasePtr pvDatabase = PVDatabase::getMaster();
|
||||
pvDatabase->addRecord(psr);
|
||||
psr.reset();
|
||||
pvDatabase->destroy();
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
MAIN(testExampleRecord)
|
||||
{
|
||||
testPlan(7);
|
||||
test();
|
||||
return 0;
|
||||
}
|
||||
|
@ -9,6 +9,8 @@
|
||||
*/
|
||||
|
||||
/* Author: Marty Kraimer */
|
||||
#include <epicsUnitTest.h>
|
||||
#include <testMain.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
@ -36,6 +38,7 @@ using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::pvDatabase;
|
||||
|
||||
static bool debug = false;
|
||||
|
||||
class MyRequester;
|
||||
typedef std::tr1::shared_ptr<MyRequester> MyRequesterPtr;
|
||||
@ -89,58 +92,79 @@ static void testPVScalar(
|
||||
size_t offset;
|
||||
ConvertPtr convert = getConvert();
|
||||
|
||||
cout << endl;
|
||||
if(debug) cout << endl;
|
||||
pvStructureRecord = pvRecord->getPVRecordStructure()->getPVStructure();
|
||||
pvField = pvStructureRecord->getSubField(valueNameRecord);
|
||||
pvValueRecord = static_pointer_cast<PVScalar>(pvField);
|
||||
convert->fromDouble(pvValueRecord,.04);
|
||||
StructureConstPtr structure = pvCopy->getStructure();
|
||||
cout << "structure from copy" << endl << *structure << endl;
|
||||
if(debug) cout << "structure from copy" << endl << *structure << endl;
|
||||
pvStructureCopy = pvCopy->createPVStructure();
|
||||
pvField = pvStructureCopy->getSubField(valueNameCopy);
|
||||
pvValueCopy = static_pointer_cast<PVScalar>(pvField);
|
||||
bitSet = BitSetPtr(new BitSet(pvStructureCopy->getNumberFields()));
|
||||
pvCopy->initCopy(pvStructureCopy, bitSet);
|
||||
cout << "after initCopy pvValueCopy " << convert->toDouble(pvValueCopy);
|
||||
cout << endl;
|
||||
if(debug) {
|
||||
cout << "after initCopy pvValueCopy " << convert->toDouble(pvValueCopy);
|
||||
cout << endl;
|
||||
}
|
||||
convert->fromDouble(pvValueRecord,.06);
|
||||
testOk1(convert->toDouble(pvValueCopy)==.04);
|
||||
pvCopy->updateCopySetBitSet(pvStructureCopy,bitSet);
|
||||
cout << "after put(.06) pvValueCopy " << convert->toDouble(pvValueCopy);
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
testOk1(convert->toDouble(pvValueCopy)==.06);
|
||||
testOk1(bitSet->get(pvValueCopy->getFieldOffset()));
|
||||
if(debug) {
|
||||
cout << "after put(.06) pvValueCopy " << convert->toDouble(pvValueCopy);
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
}
|
||||
offset = pvCopy->getCopyOffset(pvValueRecord);
|
||||
cout << "getCopyOffset() " << offset;
|
||||
cout << " pvValueCopy->getOffset() " << pvValueCopy->getFieldOffset();
|
||||
cout << " pvValueRecord->getOffset() " << pvValueRecord->getFieldOffset();
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
if(debug) {
|
||||
cout << "getCopyOffset() " << offset;
|
||||
cout << " pvValueCopy->getOffset() " << pvValueCopy->getFieldOffset();
|
||||
cout << " pvValueRecord->getOffset() " << pvValueRecord->getFieldOffset();
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
}
|
||||
bitSet->clear();
|
||||
convert->fromDouble(pvValueRecord,1.0);
|
||||
cout << "before updateCopyFromBitSet";
|
||||
cout << " recordValue " << convert->toDouble(pvValueRecord);
|
||||
cout << " copyValue " << convert->toDouble(pvValueCopy);
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
if(debug) {
|
||||
cout << "before updateCopyFromBitSet";
|
||||
cout << " recordValue " << convert->toDouble(pvValueRecord);
|
||||
cout << " copyValue " << convert->toDouble(pvValueCopy);
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
}
|
||||
bitSet->set(0);
|
||||
testOk1(convert->toDouble(pvValueCopy)==0.06);
|
||||
pvCopy->updateCopyFromBitSet(pvStructureCopy,bitSet);
|
||||
cout << "after updateCopyFromBitSet";
|
||||
cout << " recordValue " << convert->toDouble(pvValueRecord);
|
||||
cout << " copyValue " << convert->toDouble(pvValueCopy);
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
testOk1(convert->toDouble(pvValueCopy)==1.0);
|
||||
if(debug) {
|
||||
cout << "after updateCopyFromBitSet";
|
||||
cout << " recordValue " << convert->toDouble(pvValueRecord);
|
||||
cout << " copyValue " << convert->toDouble(pvValueCopy);
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
}
|
||||
convert->fromDouble(pvValueCopy,2.0);
|
||||
bitSet->set(0);
|
||||
cout << "before updateMaster";
|
||||
cout << " recordValue " << convert->toDouble(pvValueRecord);
|
||||
cout << " copyValue " << convert->toDouble(pvValueCopy);
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
if(debug) {
|
||||
cout << "before updateMaster";
|
||||
cout << " recordValue " << convert->toDouble(pvValueRecord);
|
||||
cout << " copyValue " << convert->toDouble(pvValueCopy);
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
}
|
||||
testOk1(convert->toDouble(pvValueRecord)==1.0);
|
||||
pvCopy->updateMaster(pvStructureCopy,bitSet);
|
||||
cout << "after updateMaster";
|
||||
cout << " recordValue " << convert->toDouble(pvValueRecord);
|
||||
cout << " copyValue " << convert->toDouble(pvValueCopy);
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
testOk1(convert->toDouble(pvValueRecord)==2.0);
|
||||
if(debug) {
|
||||
cout << "after updateMaster";
|
||||
cout << " recordValue " << convert->toDouble(pvValueRecord);
|
||||
cout << " copyValue " << convert->toDouble(pvValueCopy);
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
|
||||
static void testPVScalarArray(
|
||||
@ -157,72 +181,100 @@ static void testPVScalarArray(
|
||||
size_t offset;
|
||||
size_t n = 5;
|
||||
shared_vector<double> values(n);
|
||||
cout << endl;
|
||||
shared_vector<const double> cvalues;
|
||||
|
||||
if(debug) {cout << endl;}
|
||||
pvStructureRecord = pvRecord->getPVRecordStructure()->getPVStructure();
|
||||
pvValueRecord = pvStructureRecord->getSubField<PVScalarArray>(valueNameRecord);
|
||||
for(size_t i=0; i<n; i++) values[i] = i;
|
||||
const shared_vector<const double> xxx(freeze(values));
|
||||
pvValueRecord->putFrom(xxx);
|
||||
StructureConstPtr structure = pvCopy->getStructure();
|
||||
cout << "structure from copy" << endl << *structure << endl;
|
||||
if(debug) { cout << "structure from copy" << endl << *structure << endl;}
|
||||
pvStructureCopy = pvCopy->createPVStructure();
|
||||
pvValueCopy = pvStructureCopy->getSubField<PVScalarArray>(valueNameCopy);
|
||||
bitSet = BitSetPtr(new BitSet(pvStructureCopy->getNumberFields()));
|
||||
pvCopy->initCopy(pvStructureCopy, bitSet);
|
||||
cout << "after initCopy pvValueCopy " << *pvValueCopy << endl;
|
||||
cout << endl;
|
||||
if(debug) {
|
||||
cout << "after initCopy pvValueCopy " << *pvValueCopy << endl;
|
||||
cout << endl;
|
||||
}
|
||||
values.resize(n);
|
||||
for(size_t i=0; i<n; i++) values[i] = i + .06;
|
||||
const shared_vector<const double> yyy(freeze(values));
|
||||
pvValueRecord->putFrom(yyy);
|
||||
pvValueCopy->getAs(cvalues);
|
||||
testOk1(cvalues[0]==0.0);
|
||||
pvCopy->updateCopySetBitSet(pvStructureCopy,bitSet);
|
||||
cout << "after put(i+ .06) pvValueCopy " << *pvValueCopy << endl;
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
pvValueCopy->getAs(cvalues);
|
||||
testOk1(cvalues[0]==0.06);
|
||||
if(debug) {
|
||||
cout << "after put(i+ .06) pvValueCopy " << *pvValueCopy << endl;
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
}
|
||||
offset = pvCopy->getCopyOffset(pvValueRecord);
|
||||
cout << "getCopyOffset() " << offset;
|
||||
cout << " pvValueCopy->getOffset() " << pvValueCopy->getFieldOffset();
|
||||
cout << " pvValueRecord->getOffset() " << pvValueRecord->getFieldOffset();
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
if(debug) {
|
||||
cout << "getCopyOffset() " << offset;
|
||||
cout << " pvValueCopy->getOffset() " << pvValueCopy->getFieldOffset();
|
||||
cout << " pvValueRecord->getOffset() " << pvValueRecord->getFieldOffset();
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
}
|
||||
bitSet->clear();
|
||||
values.resize(n);
|
||||
for(size_t i=0; i<n; i++) values[i] = i + 1.0;
|
||||
const shared_vector<const double> zzz(freeze(values));
|
||||
pvValueRecord->putFrom(zzz);
|
||||
cout << "before updateCopyFromBitSet";
|
||||
cout << " recordValue " << *pvValueRecord << endl;
|
||||
cout << " copyValue " << *pvValueCopy << endl;
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
if(debug) {
|
||||
cout << "before updateCopyFromBitSet";
|
||||
cout << " recordValue " << *pvValueRecord << endl;
|
||||
cout << " copyValue " << *pvValueCopy << endl;
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
}
|
||||
bitSet->set(0);
|
||||
pvValueCopy->getAs(cvalues);
|
||||
testOk1(cvalues[0]==0.06);
|
||||
pvCopy->updateCopyFromBitSet(pvStructureCopy,bitSet);
|
||||
cout << "after updateCopyFromBitSet";
|
||||
cout << " recordValue " << *pvValueRecord << endl;
|
||||
cout << " copyValue " << *pvValueCopy << endl;
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
pvValueCopy->getAs(cvalues);
|
||||
testOk1(cvalues[0]==1.0);
|
||||
if(debug) {
|
||||
cout << "after updateCopyFromBitSet";
|
||||
cout << " recordValue " << *pvValueRecord << endl;
|
||||
cout << " copyValue " << *pvValueCopy << endl;
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
}
|
||||
values.resize(n);
|
||||
for(size_t i=0; i<n; i++) values[i] = i + 2.0;
|
||||
const shared_vector<const double> ttt(freeze(values));
|
||||
pvValueRecord->putFrom(ttt);
|
||||
bitSet->set(0);
|
||||
cout << "before updateMaster";
|
||||
cout << " recordValue " << *pvValueRecord << endl;
|
||||
cout << " copyValue " << *pvValueCopy << endl;
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
if(debug) {
|
||||
cout << "before updateMaster";
|
||||
cout << " recordValue " << *pvValueRecord << endl;
|
||||
cout << " copyValue " << *pvValueCopy << endl;
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
}
|
||||
pvValueRecord->getAs(cvalues);
|
||||
testOk1(cvalues[0]==2.0);
|
||||
pvCopy->updateMaster(pvStructureCopy,bitSet);
|
||||
cout << "after updateMaster";
|
||||
cout << " recordValue " << *pvValueRecord << endl;
|
||||
cout << " copyValue " << *pvValueRecord << endl;
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
pvValueRecord->getAs(cvalues);
|
||||
testOk1(cvalues[0]==1.0);
|
||||
if(debug) {
|
||||
cout << "after updateMaster";
|
||||
cout << " recordValue " << *pvValueRecord << endl;
|
||||
cout << " copyValue " << *pvValueRecord << endl;
|
||||
cout << " bitSet " << *bitSet;
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
|
||||
static void scalarTest()
|
||||
{
|
||||
cout << endl << endl << "****scalarTest****" << endl;
|
||||
if(debug) {cout << endl << endl << "****scalarTest****" << endl;}
|
||||
RequesterPtr requester(new MyRequester("exampleTest"));
|
||||
PVRecordPtr pvRecord;
|
||||
string request;
|
||||
@ -236,21 +288,27 @@ static void scalarTest()
|
||||
valueNameRecord = request = "value";
|
||||
CreateRequest::shared_pointer createRequest = CreateRequest::create();
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
|
||||
if(debug) {
|
||||
cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
|
||||
}
|
||||
pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
|
||||
valueNameCopy = "value";
|
||||
testPVScalar(valueNameRecord,valueNameCopy,pvRecord,pvCopy);
|
||||
request = "";
|
||||
valueNameRecord = "value";
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
|
||||
if(debug) {
|
||||
cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
|
||||
}
|
||||
pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
|
||||
valueNameCopy = "value";
|
||||
testPVScalar(valueNameRecord,valueNameCopy,pvRecord,pvCopy);
|
||||
request = "alarm,timeStamp,value";
|
||||
valueNameRecord = "value";
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
|
||||
if(debug) {
|
||||
cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
|
||||
}
|
||||
pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
|
||||
valueNameCopy = "value";
|
||||
testPVScalar(valueNameRecord,valueNameCopy,pvRecord,pvCopy);
|
||||
@ -259,7 +317,7 @@ static void scalarTest()
|
||||
|
||||
static void arrayTest()
|
||||
{
|
||||
cout << endl << endl << "****arrayTest****" << endl;
|
||||
if(debug) {cout << endl << endl << "****arrayTest****" << endl;}
|
||||
RequesterPtr requester(new MyRequester("exampleTest"));
|
||||
PVRecordPtr pvRecord;
|
||||
string request;
|
||||
@ -273,21 +331,21 @@ static void arrayTest()
|
||||
pvRecord = createScalarArray("doubleArrayRecord",pvDouble,"alarm,timeStamp");
|
||||
valueNameRecord = request = "value";
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
|
||||
if(debug) {cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;}
|
||||
pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
|
||||
valueNameCopy = "value";
|
||||
testPVScalarArray(valueNameRecord,valueNameCopy,pvRecord,pvCopy);
|
||||
request = "";
|
||||
valueNameRecord = "value";
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
|
||||
if(debug) {cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;}
|
||||
pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
|
||||
valueNameCopy = "value";
|
||||
testPVScalarArray(valueNameRecord,valueNameCopy,pvRecord,pvCopy);
|
||||
request = "alarm,timeStamp,value";
|
||||
valueNameRecord = "value";
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
|
||||
if(debug) {cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;}
|
||||
pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
|
||||
valueNameCopy = "value";
|
||||
testPVScalarArray(valueNameRecord,valueNameCopy,pvRecord,pvCopy);
|
||||
@ -296,7 +354,7 @@ static void arrayTest()
|
||||
|
||||
static void powerSupplyTest()
|
||||
{
|
||||
cout << endl << endl << "****powerSupplyTest****" << endl;
|
||||
if(debug) {cout << endl << endl << "****powerSupplyTest****" << endl;}
|
||||
RequesterPtr requester(new MyRequester("exampleTest"));
|
||||
PowerSupplyPtr pvRecord;
|
||||
string request;
|
||||
@ -311,36 +369,37 @@ static void powerSupplyTest()
|
||||
pvRecord = PowerSupply::create("powerSupply",pv);
|
||||
valueNameRecord = request = "power.value";
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
|
||||
if(debug) {cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;}
|
||||
pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
|
||||
valueNameCopy = "power.value";
|
||||
testPVScalar(valueNameRecord,valueNameCopy,pvRecord,pvCopy);
|
||||
request = "";
|
||||
valueNameRecord = "power.value";
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
|
||||
if(debug) {cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;}
|
||||
pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
|
||||
valueNameCopy = "power.value";
|
||||
testPVScalar(valueNameRecord,valueNameCopy,pvRecord,pvCopy);
|
||||
request = "alarm,timeStamp,voltage.value,power.value,current.value";
|
||||
valueNameRecord = "power.value";
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
|
||||
if(debug) {cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;}
|
||||
pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
|
||||
valueNameCopy = "power.value";
|
||||
testPVScalar(valueNameRecord,valueNameCopy,pvRecord,pvCopy);
|
||||
request = "alarm,timeStamp,voltage{value,alarm},power{value,alarm,display},current.value";
|
||||
valueNameRecord = "power.value";
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
|
||||
if(debug) {cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;}
|
||||
pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
|
||||
valueNameCopy = "power.value";
|
||||
testPVScalar(valueNameRecord,valueNameCopy,pvRecord,pvCopy);
|
||||
pvRecord->destroy();
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
MAIN(testPVCopy)
|
||||
{
|
||||
testPlan(67);
|
||||
scalarTest();
|
||||
arrayTest();
|
||||
powerSupplyTest();
|
||||
|
@ -9,6 +9,8 @@
|
||||
*/
|
||||
|
||||
/* Author: Marty Kraimer */
|
||||
#include <epicsUnitTest.h>
|
||||
#include <testMain.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
@ -36,6 +38,8 @@ using namespace epics::pvData;
|
||||
using namespace epics::pvDatabase;
|
||||
using std::string;
|
||||
|
||||
static bool debug = false;
|
||||
|
||||
static PVRecordPtr createScalar(
|
||||
string const & recordName,
|
||||
ScalarType scalarType,
|
||||
@ -58,31 +62,44 @@ static PVRecordPtr createScalarArray(
|
||||
|
||||
static void scalarTest()
|
||||
{
|
||||
cout << endl << endl << "****scalarTest****" << endl;
|
||||
if(debug) {cout << endl << endl << "****scalarTest****" << endl; }
|
||||
PVRecordPtr pvRecord;
|
||||
pvRecord = createScalar("doubleRecord",pvDouble,"alarm,timeStamp.display");
|
||||
testOk1(pvRecord.get()!=0);
|
||||
if(pvRecord && debug) {
|
||||
cout << pvRecord << endl;
|
||||
}
|
||||
pvRecord->destroy();
|
||||
}
|
||||
|
||||
static void arrayTest()
|
||||
{
|
||||
cout << endl << endl << "****arrayTest****" << endl;
|
||||
if(debug) {cout << endl << endl << "****arrayTest****" << endl; }
|
||||
PVRecordPtr pvRecord;
|
||||
pvRecord = createScalarArray("doubleArrayRecord",pvDouble,"alarm,timeStamp");
|
||||
testOk1(pvRecord.get()!=0);
|
||||
if(pvRecord && debug) {
|
||||
cout << pvRecord << endl;
|
||||
}
|
||||
pvRecord->destroy();
|
||||
}
|
||||
|
||||
static void powerSupplyTest()
|
||||
{
|
||||
cout << endl << endl << "****powerSupplyTest****" << endl;
|
||||
if(debug) {cout << endl << endl << "****powerSupplyTest****" << endl; }
|
||||
PVRecordPtr pvRecord;
|
||||
PVStructurePtr pv = createPowerSupply();
|
||||
pvRecord = PowerSupply::create("powerSupply",pv);
|
||||
testOk1(pvRecord.get()!=0);
|
||||
if(pvRecord && debug) {
|
||||
cout << pvRecord << endl;
|
||||
}
|
||||
pvRecord->destroy();
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
MAIN(testPVRecord)
|
||||
{
|
||||
testPlan(3);
|
||||
scalarTest();
|
||||
arrayTest();
|
||||
powerSupplyTest();
|
||||
|
Reference in New Issue
Block a user