standardPVField now complete

This commit is contained in:
Marty Kraimer
2010-10-27 13:26:29 -04:00
parent 4e5e4ea782
commit 55b44e953d
8 changed files with 269 additions and 143 deletions

View File

@@ -455,7 +455,7 @@ namespace epics { namespace pvData {
void PVStructure::toString(StringBuilder buf,int indentLevel)
{
*buf += "structure ";
toStringPvt(buf,0);
toStringPvt(buf,indentLevel);
}
void PVStructure::serialize(

View File

@@ -143,11 +143,14 @@ namespace epics { namespace pvData {
};
BaseStructure::BaseStructure (String fieldName,
int numberFields, FieldConstPtrArray fields)
int numberFields, FieldConstPtrArray infields)
: BaseField(fieldName,structure),
numberFields(numberFields),
fields(fields)
fields(new FieldConstPtr[numberFields])
{
for(int i=0; i<numberFields; i++) {
fields[i] = infields[i];
}
for(int i=0; i<numberFields; i++) {
String name = fields[i]->getFieldName();
// look for duplicates
@@ -165,11 +168,13 @@ namespace epics { namespace pvData {
}
}
BaseStructure::~BaseStructure() {
if(debugLevel==highDebug) printf("~BaseStructure %s\n",BaseField::getFieldName().c_str());
if(debugLevel==highDebug)
printf("~BaseStructure %s\n",BaseField::getFieldName().c_str());
for(int i=0; i<numberFields; i++) {
FieldConstPtr pfield = fields[i];
pfield->decReferenceCount();
}
delete[] fields;
}
FieldConstPtr BaseStructure::getField(String fieldName) const {

View File

@@ -13,184 +13,233 @@ namespace epics { namespace pvData {
static String notImplemented("not implemented");
static FieldCreate* fieldCreate = 0;
static PVDataCreate* pvDataCreate = 0;
static StandardField *standardField = 0;
static StandardPVField *standardPVField = 0;
StandardPVField::StandardPVField(){}
StandardPVField::~StandardPVField(){}
PVScalar * StandardPVField::scalar(String fieldName,ScalarType type)
PVScalar * StandardPVField::scalar(PVStructure *parent,
String fieldName,ScalarType type)
{
throw std::logic_error(notImplemented);
ScalarConstPtr field = standardField->scalar(fieldName,type);
return pvDataCreate->createPVScalar(parent,field);
}
PVStructure * StandardPVField::scalar(String fieldName,ScalarType type,String properties)
PVStructure * StandardPVField::scalar(PVStructure *parent,
String fieldName,ScalarType type,String properties)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->scalar(fieldName,type,properties);
return pvDataCreate->createPVStructure(parent,field);
}
PVScalarArray * StandardPVField::scalarArray(String fieldName,ScalarType elementType)
PVScalarArray * StandardPVField::scalarArray(PVStructure *parent,
String fieldName,ScalarType elementType)
{
throw std::logic_error(notImplemented);
ScalarArrayConstPtr field = standardField->scalarArray(
fieldName,elementType);
return pvDataCreate->createPVScalarArray(parent,field);
}
PVStructure * StandardPVField::scalarArray(String fieldName,ScalarType elementType, String properties)
PVStructure * StandardPVField::scalarArray(PVStructure *parent,
String fieldName,ScalarType elementType, String properties)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->scalarArray(
fieldName,elementType,properties);
return pvDataCreate->createPVStructure(parent,field);
}
PVStructureArray * StandardPVField::structureArray(String fieldName,StructureConstPtr structure)
PVStructureArray * StandardPVField::structureArray(PVStructure *parent,
String fieldName,StructureConstPtr structure)
{
throw std::logic_error(notImplemented);
StructureArrayConstPtr field = standardField->structureArray(
fieldName,structure);
return pvDataCreate->createPVStructureArray(parent,field);
}
PVStructure * StandardPVField::structureArray(String fieldName,StructureConstPtr structure,String properties)
PVStructure * StandardPVField::structureArray(PVStructure *parent,
String fieldName,StructureConstPtr structure,String properties)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->structureArray(
fieldName,structure,properties);
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure *StandardPVField::structure(String fieldName,PVStructure *pvStructure)
PVStructure * StandardPVField::enumerated(PVStructure *parent,
String fieldName,StringArray choices)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->enumerated(
fieldName,choices);
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure *StandardPVField::structure(String fieldName,PVStructure *pvStructure,String properties)
PVStructure * StandardPVField::enumerated(PVStructure *parent,
String fieldName,StringArray choices, String properties)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->enumerated(
fieldName,choices,properties);
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::enumerated(String fieldName,StringArray choices)
PVScalar * StandardPVField::scalarValue(PVStructure *parent,
ScalarType scalarType)
{
throw std::logic_error(notImplemented);
ScalarConstPtr field = standardField->scalarValue(scalarType);
return pvDataCreate->createPVScalar(parent,field);
}
PVStructure * StandardPVField::enumerated(String fieldName,StringArray choices, String properties)
PVStructure * StandardPVField::scalarValue(PVStructure *parent,
ScalarType type,String properties)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->scalarValue(type,properties);
return pvDataCreate->createPVStructure(parent,field);
}
PVScalar * StandardPVField::scalarValue(ScalarType scalarType)
PVScalarArray * StandardPVField::scalarArrayValue(PVStructure *parent,
ScalarType elementType)
{
ScalarConstPtr scalar = fieldCreate->createScalar(
String("value"),scalarType);
return getPVDataCreate()->createPVScalar(0,scalar);
}
PVStructure * StandardPVField::scalarValue(ScalarType type,String properties)
{
throw std::logic_error(notImplemented);
}
PVScalarArray * StandardPVField::scalarArrayValue(ScalarType elementType)
{
ScalarArrayConstPtr scalarArray = fieldCreate->createScalarArray(
String("value"),elementType);
ScalarArrayConstPtr scalarArray =
standardField->scalarArrayValue(elementType);
return pvDataCreate->createPVScalarArray(0,scalarArray);
}
PVStructure * StandardPVField::scalarArrayValue(ScalarType elementType, String properties)
PVStructure * StandardPVField::scalarArrayValue(PVStructure *parent,
ScalarType elementType, String properties)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->scalarArrayValue(
elementType,properties);
return pvDataCreate->createPVStructure(parent,field);
}
PVStructureArray * StandardPVField::structureArrayValue(StructureConstPtr structure)
PVStructureArray * StandardPVField::structureArrayValue(PVStructure *parent,
StructureConstPtr structure)
{
throw std::logic_error(notImplemented);
StructureArrayConstPtr field = standardField->structureArrayValue(
structure);
return pvDataCreate->createPVStructureArray(parent,field);
}
PVStructure * StandardPVField::structureArrayValue(StructureConstPtr structure,String properties)
PVStructure * StandardPVField::structureArrayValue(PVStructure *parent,
StructureConstPtr structure,String properties)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->structureArrayValue(
structure,properties);
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure *StandardPVField::structureValue(PVStructure *pvStructure)
PVStructure * StandardPVField::enumeratedValue(PVStructure *parent,
StringArray choices)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->enumeratedValue( choices);
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure *StandardPVField::structureValue(PVStructure *pvStructure,String properties)
PVStructure * StandardPVField::enumeratedValue(PVStructure *parent,
StringArray choices, String properties)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->enumeratedValue(
choices,properties);
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::enumeratedValue(StringArray choices)
PVStructure * StandardPVField::alarm(PVStructure *parent)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->alarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::enumeratedValue(StringArray choices, String properties)
PVStructure * StandardPVField::timeStamp(PVStructure *parent)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->timeStamp();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::alarm()
PVStructure * StandardPVField::display(PVStructure *parent)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->display();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::timeStamp()
PVStructure * StandardPVField::control(PVStructure *parent)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->control();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::display()
PVStructure * StandardPVField::booleanAlarm(PVStructure *parent)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->booleanAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::control()
PVStructure * StandardPVField::byteAlarm(PVStructure *parent)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->byteAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::booleanAlarm()
PVStructure * StandardPVField::shortAlarm(PVStructure *parent)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->shortAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::byteAlarm()
PVStructure * StandardPVField::intAlarm(PVStructure *parent)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->intAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::shortAlarm()
PVStructure * StandardPVField::longAlarm(PVStructure *parent)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->longAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::intAlarm()
PVStructure * StandardPVField::floatAlarm(PVStructure *parent)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->floatAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::longAlarm()
PVStructure * StandardPVField::doubleAlarm(PVStructure *parent)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->doubleAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::floatAlarm()
PVStructure * StandardPVField::enumeratedAlarm(PVStructure *parent)
{
throw std::logic_error(notImplemented);
StructureConstPtr field = standardField->enumeratedAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::doubleAlarm()
PVStructure * StandardPVField::powerSupply(PVStructure *parent)
{
throw std::logic_error(notImplemented);
}
PVStructure * StandardPVField::enumeratedAlarm()
{
throw std::logic_error(notImplemented);
}
PVStructure * StandardPVField::powerSupply()
{
throw std::logic_error(notImplemented);
StructureConstPtr alarmField = standardField->alarm();
StructureConstPtr timeStampField = standardField->timeStamp();
StructureConstPtr voltageField = standardField->scalar(
String("voltage"),pvDouble,String("alarm"));
StructureConstPtr powerField = standardField->scalar(
String("power"),pvDouble,String("alarm"));
StructureConstPtr currentField = standardField->scalar(
String("current"),pvDouble,String("alarm"));
FieldConstPtr fields[3];
fields[0] = voltageField;
fields[1] = powerField;
fields[2] = currentField;
StructureConstPtr valueField = standardField->structureValue( 3,fields);
fields[0] = alarmField;
fields[1] = timeStampField;
fields[2] = valueField;
StructureConstPtr structureField = standardField->structureValue(3,fields);
return pvDataCreate->createPVStructure(parent,structureField);
}
static StandardPVField* instance = 0;
class StandardPVFieldExt : public StandardPVField {
@@ -202,12 +251,13 @@ StandardPVField * getStandardPVField() {
static Mutex mutex = Mutex();
Lock xx(&mutex);
if(instance==0) {
instance = new StandardPVFieldExt();
if(standardPVField==0) {
fieldCreate = getFieldCreate();
pvDataCreate = getPVDataCreate();
standardField = getStandardField();
standardPVField = new StandardPVFieldExt();
}
return instance;
return standardPVField;
}
}}

View File

@@ -12,39 +12,47 @@ namespace epics { namespace pvData {
public:
StandardPVField();
~StandardPVField();
PVScalar * scalar(String fieldName,ScalarType type);
PVStructure * scalar(String fieldName,ScalarType type,String properties);
PVScalarArray * scalarArray(String fieldName,ScalarType elementType);
PVStructure * scalarArray(String fieldName,ScalarType elementType, String properties);
PVStructureArray * structureArray(String fieldName,StructureConstPtr structure);
PVStructure * structureArray(String fieldName,StructureConstPtr structure,String properties);
PVStructure *structure(String fieldName,PVStructure *pvStructure);
PVStructure *structure(String fieldName,PVStructure *pvStructure,String properties);
PVStructure * enumerated(String fieldName,StringArray choices);
PVStructure * enumerated(String fieldName,StringArray choices, String properties);
PVScalar * scalarValue(ScalarType type);
PVStructure * scalarValue(ScalarType type,String properties);
PVScalarArray * scalarArrayValue(ScalarType elementType);
PVStructure * scalarArrayValue(ScalarType elementType, String properties);
PVStructureArray * structureArrayValue(StructureConstPtr structure);
PVStructure * structureArrayValue(StructureConstPtr structure,String properties);
PVStructure *structureValue(PVStructure *pvStructure);
PVStructure *structureValue(PVStructure *pvStructure,String properties);
PVStructure * enumeratedValue(StringArray choices);
PVStructure * enumeratedValue(StringArray choices, String properties);
PVStructure * alarm();
PVStructure * timeStamp();
PVStructure * display();
PVStructure * control();
PVStructure * booleanAlarm();
PVStructure * byteAlarm();
PVStructure * shortAlarm();
PVStructure * intAlarm();
PVStructure * longAlarm();
PVStructure * floatAlarm();
PVStructure * doubleAlarm();
PVStructure * enumeratedAlarm();
PVStructure * powerSupply();
PVScalar * scalar(PVStructure *parent,String fieldName,ScalarType type);
PVStructure * scalar(PVStructure *parent,
String fieldName,ScalarType type,String properties);
PVScalarArray * scalarArray(PVStructure *parent,
String fieldName,ScalarType elementType);
PVStructure * scalarArray(PVStructure *parent,
String fieldName,ScalarType elementType, String properties);
PVStructureArray * structureArray(PVStructure *parent,
String fieldName,StructureConstPtr structure);
PVStructure * structureArray(PVStructure *parent,
String fieldName,StructureConstPtr structure,String properties);
PVStructure * enumerated(PVStructure *parent,
String fieldName,StringArray choices);
PVStructure * enumerated(PVStructure *parent,
String fieldName,StringArray choices, String properties);
PVScalar * scalarValue(PVStructure *parent,ScalarType type);
PVStructure * scalarValue(PVStructure *parent,
ScalarType type,String properties);
PVScalarArray * scalarArrayValue(PVStructure *parent,ScalarType elementType);
PVStructure * scalarArrayValue(PVStructure *parent,
ScalarType elementType, String properties);
PVStructureArray * structureArrayValue(PVStructure *parent,
StructureConstPtr structure);
PVStructure * structureArrayValue(PVStructure *parent,
StructureConstPtr structure,String properties);
PVStructure * enumeratedValue(PVStructure *parent,StringArray choices);
PVStructure * enumeratedValue(PVStructure *parent,
StringArray choices, String properties);
PVStructure * alarm(PVStructure *parent);
PVStructure * timeStamp(PVStructure *parent);
PVStructure * display(PVStructure *parent);
PVStructure * control(PVStructure *parent);
PVStructure * booleanAlarm(PVStructure *parent);
PVStructure * byteAlarm(PVStructure *parent);
PVStructure * shortAlarm(PVStructure *parent);
PVStructure * intAlarm(PVStructure *parent);
PVStructure * longAlarm(PVStructure *parent);
PVStructure * floatAlarm(PVStructure *parent);
PVStructure * doubleAlarm(PVStructure *parent);
PVStructure * enumeratedAlarm(PVStructure *parent);
PVStructure * powerSupply(PVStructure *parent);
};
extern StandardPVField * getStandardPVField();

View File

@@ -6,6 +6,10 @@ PROD_HOST += testIntrospect
testIntrospect_SRCS += testIntrospect.cpp
testIntrospect_LIBS += pvFactory
PROD_HOST += testSimple
testSimple_SRCS += testSimple.cpp
testSimple_LIBS += pvFactory
include $(TOP)/configure/RULES
#----------------------------------------
# ADD RULES AFTER THIS LINE

View File

@@ -0,0 +1,59 @@
/* testSimpleStructure.cpp */
/* Author: Marty Kraimer Date: 2010.09 */
#include <cstddef>
#include <cstdlib>
#include <cstddef>
#include <string>
#include <cstdio>
#include "requester.h"
#include "pvIntrospect.h"
#include "pvData.h"
#include "standardField.h"
#include "standardPVField.h"
using namespace epics::pvData;
static FieldCreate * fieldCreate = 0;
static PVDataCreate * pvDataCrete = 0;
static StandardField *standardField = 0;
static StandardPVField *standardPVField = 0;
static String buffer("");
void testSimpleStructure(FILE * fd) {
fprintf(fd,"\ntestSimpleStructure\n");
String properties("alarm,timeStamp,display,control,valueAlarm");
PVStructure *ptop = standardPVField->scalar(
0,String(""),pvDouble,properties);
buffer.clear();
ptop->toString(&buffer);
fprintf(fd,"%s\n",buffer.c_str());
}
void testPowerSupply(FILE * fd) {
fprintf(fd,"\ntestPowerSupply\n");
PVStructure *ptop = standardPVField->powerSupply(0);
buffer.clear();
ptop->toString(&buffer);
fprintf(fd,"%s\n",buffer.c_str());
}
int main(int argc,char *argv[])
{
char *fileName = 0;
if(argc>1) fileName = argv[1];
FILE * fd = stdout;
if(fileName!=0 && fileName[0]!=0) {
fd = fopen(fileName,"w+");
}
fieldCreate = getFieldCreate();
pvDataCrete = getPVDataCreate();
standardField = getStandardField();
standardPVField = getStandardPVField();
testSimpleStructure(fd);
testPowerSupply(fd);
return(0);
}

View File

@@ -22,7 +22,7 @@ static String buffer("");
void testBoolean() {
printf("\ntestBoolean\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(pvBoolean);
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvBoolean);
PVBoolean *pvValue = (PVBoolean *)pvScalar;
bool value = true;
pvValue->put(value);
@@ -58,7 +58,7 @@ void testBoolean() {
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
PVScalar *other = getStandardPVField()->scalarValue(pvDouble);
PVScalar *other = getStandardPVField()->scalarValue(0,pvDouble);
bool isEqual = pvScalar==other;
printf("expect false isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
@@ -66,7 +66,7 @@ void testBoolean() {
void testByte() {
printf("\ntestByte\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(pvByte);
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvByte);
PVByte *pvValue = (PVByte *)pvScalar;
epicsInt8 value = 2;
pvValue->put(value);
@@ -98,7 +98,7 @@ void testByte() {
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
PVScalar *other = getStandardPVField()->scalarValue(pvDouble);
PVScalar *other = getStandardPVField()->scalarValue(0,pvDouble);
bool isEqual = pvScalar==other;
printf("expect false isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
@@ -106,7 +106,7 @@ void testByte() {
void testShort() {
printf("\ntestShort\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(pvShort);
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvShort);
PVShort *pvValue = (PVShort *)pvScalar;
epicsInt16 value = 2;
pvValue->put(value);
@@ -138,7 +138,7 @@ void testShort() {
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
PVScalar *other = getStandardPVField()->scalarValue(pvDouble);
PVScalar *other = getStandardPVField()->scalarValue(0,pvDouble);
bool isEqual = pvScalar==other;
printf("expect false isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
@@ -146,7 +146,7 @@ void testShort() {
void testInt() {
printf("\ntestInt\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(pvInt);
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvInt);
PVInt *pvValue = (PVInt *)pvScalar;
epicsInt32 value = 2;
pvValue->put(value);
@@ -178,7 +178,7 @@ void testInt() {
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
PVScalar *other = getStandardPVField()->scalarValue(pvDouble);
PVScalar *other = getStandardPVField()->scalarValue(0,pvDouble);
bool isEqual = pvScalar==other;
printf("expect false isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
@@ -186,7 +186,7 @@ void testInt() {
void testLong() {
printf("\ntestLong\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(pvLong);
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvLong);
PVLong *pvValue = (PVLong *)pvScalar;
epicsInt64 value = 2;
pvValue->put(value);
@@ -218,7 +218,7 @@ void testLong() {
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
PVScalar *other = getStandardPVField()->scalarValue(pvDouble);
PVScalar *other = getStandardPVField()->scalarValue(0,pvDouble);
bool isEqual = pvScalar==other;
printf("expect false isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
@@ -226,7 +226,7 @@ void testLong() {
void testFloat() {
printf("\ntestFloat\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(pvFloat);
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvFloat);
PVFloat *pvValue = (PVFloat *)pvScalar;
float value = 2;
pvValue->put(value);
@@ -265,7 +265,7 @@ void testFloat() {
void testDouble() {
printf("\ntestDouble\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(pvDouble);
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvDouble);
PVDouble *pvValue = (PVDouble *)pvScalar;
double value = 2;
pvValue->put(value);
@@ -304,7 +304,7 @@ void testDouble() {
void testString() {
printf("\ntestString\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(pvString);
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvString);
PVString *pvValue = (PVString *)pvScalar;
String value = "testString";
pvValue->put(value);

View File

@@ -22,7 +22,7 @@ static String buffer("");
void testBooleanArray() {
printf("\ntestBooleanArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(pvBoolean);
getStandardPVField()->scalarArrayValue(0,pvBoolean);
PVBooleanArray *pvValue = (PVBooleanArray *)pvScalarArray;
int length = 5;
bool *value = new bool[length];
@@ -52,7 +52,7 @@ void testBooleanArray() {
void testByteArray() {
printf("\ntestByteArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(pvByte);
getStandardPVField()->scalarArrayValue(0,pvByte);
PVByteArray *pvValue = (PVByteArray *)pvScalarArray;
int length = 5;
epicsInt8 *value = new epicsInt8[length];
@@ -80,7 +80,7 @@ void testByteArray() {
void testShortArray() {
printf("\ntestShortArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(pvShort);
getStandardPVField()->scalarArrayValue(0,pvShort);
PVShortArray *pvValue = (PVShortArray *)pvScalarArray;
int length = 5;
epicsInt16 *value = new epicsInt16[length];
@@ -108,7 +108,7 @@ void testShortArray() {
void testIntArray() {
printf("\ntestIntArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(pvInt);
getStandardPVField()->scalarArrayValue(0,pvInt);
PVIntArray *pvValue = (PVIntArray *)pvScalarArray;
int length = 5;
epicsInt32 *value = new epicsInt32[length];
@@ -137,7 +137,7 @@ void testIntArray() {
void testLongArray() {
printf("\ntestLongArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(pvLong);
getStandardPVField()->scalarArrayValue(0,pvLong);
PVLongArray *pvValue = (PVLongArray *)pvScalarArray;
int length = 5;
epicsInt64 *value = new epicsInt64[length];
@@ -166,7 +166,7 @@ void testLongArray() {
void testFloatArray() {
printf("\ntestFloatArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(pvFloat);
getStandardPVField()->scalarArrayValue(0,pvFloat);
PVFloatArray *pvValue = (PVFloatArray *)pvScalarArray;
int length = 5;
float *value = new float[length];
@@ -195,7 +195,7 @@ void testFloatArray() {
void testDoubleArray() {
printf("\ntestDoubleArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(pvDouble);
getStandardPVField()->scalarArrayValue(0,pvDouble);
PVDoubleArray *pvValue = (PVDoubleArray *)pvScalarArray;
int length = 5;
double *value = new double[length];
@@ -224,7 +224,7 @@ void testDoubleArray() {
void testStringArray() {
printf("\ntestStringArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(pvString);
getStandardPVField()->scalarArrayValue(0,pvString);
PVStringArray *pvValue = (PVStringArray *)pvScalarArray;
int length = 5;
String *value = new String[length];