a complete set of tests for PVData now exists

This commit is contained in:
Marty Kraimer
2010-11-04 09:38:53 -04:00
parent 7f03a52200
commit 4f871aae05
55 changed files with 8326 additions and 1127 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1
View File
@@ -223,6 +223,7 @@ void PVField::toString(StringBuilder buf) {toString(buf,0);}
void PVField::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
if(pImpl->pvAuxInfo==0) return;
pImpl->pvAuxInfo->toString(buf,indentLevel);
}
-10
View File
@@ -25,8 +25,6 @@ namespace epics { namespace pvData {
SerializableControl *pflusher);
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -56,14 +54,6 @@ namespace epics { namespace pvData {
value = pbuffer->getBoolean();
}
void BasePVBoolean::toString(StringBuilder buf) {toString(buf,0);}
void BasePVBoolean::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVBoolean::operator==(PVField& pvField)
{
return getConvert()->equals(this, &pvField);
-14
View File
@@ -33,8 +33,6 @@ namespace epics { namespace pvData {
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -175,18 +173,6 @@ namespace epics { namespace pvData {
}
}
void BasePVBooleanArray::toString(StringBuilder buf)
{
toString(buf,1);
}
void BasePVBooleanArray::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVBooleanArray::operator==(PVField& pv)
{
return getConvert()->equals(this, &pv);
-10
View File
@@ -25,8 +25,6 @@ namespace epics { namespace pvData {
SerializableControl *pflusher) ;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -55,14 +53,6 @@ namespace epics { namespace pvData {
value = pbuffer->getByte();
}
void BasePVByte::toString(StringBuilder buf) {toString(buf,0);}
void BasePVByte::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVByte::operator==(PVField& pvField)
{
return getConvert()->equals(this, &pvField);
-14
View File
@@ -33,8 +33,6 @@ namespace epics { namespace pvData {
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -175,18 +173,6 @@ namespace epics { namespace pvData {
}
}
void BasePVByteArray::toString(StringBuilder buf)
{
toString(buf,1);
}
void BasePVByteArray::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVByteArray::operator==(PVField& pv)
{
return getConvert()->equals(this, &pv);
-10
View File
@@ -25,8 +25,6 @@ namespace epics { namespace pvData {
SerializableControl *pflusher) ;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -55,14 +53,6 @@ namespace epics { namespace pvData {
value = pbuffer->getDouble();
}
void BasePVDouble::toString(StringBuilder buf) {toString(buf,0);}
void BasePVDouble::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVDouble::operator==(PVField& pvField)
{
return getConvert()->equals(this, &pvField);
-14
View File
@@ -33,8 +33,6 @@ namespace epics { namespace pvData {
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -178,18 +176,6 @@ namespace epics { namespace pvData {
}
}
void BasePVDoubleArray::toString(StringBuilder buf)
{
toString(buf,1);
}
void BasePVDoubleArray::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVDoubleArray::operator==(PVField& pv)
{
return getConvert()->equals(this, &pv);
-10
View File
@@ -25,8 +25,6 @@ namespace epics { namespace pvData {
SerializableControl *pflusher) ;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -55,14 +53,6 @@ namespace epics { namespace pvData {
value = pbuffer->getFloat();
}
void BasePVFloat::toString(StringBuilder buf) {toString(buf,0);}
void BasePVFloat::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVFloat::operator==(PVField& pvField)
{
return getConvert()->equals(this, &pvField);
-14
View File
@@ -33,8 +33,6 @@ namespace epics { namespace pvData {
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -178,18 +176,6 @@ namespace epics { namespace pvData {
}
}
void BasePVFloatArray::toString(StringBuilder buf)
{
toString(buf,1);
}
void BasePVFloatArray::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVFloatArray::operator==(PVField& pv)
{
return getConvert()->equals(this, &pv);
-10
View File
@@ -25,8 +25,6 @@ namespace epics { namespace pvData {
SerializableControl *pflusher) ;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -55,14 +53,6 @@ namespace epics { namespace pvData {
value = pbuffer->getInt();
}
void BasePVInt::toString(StringBuilder buf) {toString(buf,0);}
void BasePVInt::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVInt::operator==(PVField& pvField)
{
return getConvert()->equals(this, &pvField);
-14
View File
@@ -33,8 +33,6 @@ namespace epics { namespace pvData {
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -178,18 +176,6 @@ namespace epics { namespace pvData {
}
}
void BasePVIntArray::toString(StringBuilder buf)
{
toString(buf,1);
}
void BasePVIntArray::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVIntArray::operator==(PVField& pv)
{
return getConvert()->equals(this, &pv);
-10
View File
@@ -25,8 +25,6 @@ namespace epics { namespace pvData {
SerializableControl *pflusher) ;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -55,14 +53,6 @@ namespace epics { namespace pvData {
value = pbuffer->getLong();
}
void BasePVLong::toString(StringBuilder buf) {toString(buf,0);}
void BasePVLong::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVLong::operator==(PVField& pvField)
{
return getConvert()->equals(this, &pvField);
-14
View File
@@ -33,8 +33,6 @@ namespace epics { namespace pvData {
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -178,18 +176,6 @@ namespace epics { namespace pvData {
}
}
void BasePVLongArray::toString(StringBuilder buf)
{
toString(buf,1);
}
void BasePVLongArray::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVLongArray::operator==(PVField& pv)
{
return getConvert()->equals(this, &pv);
-10
View File
@@ -25,8 +25,6 @@ namespace epics { namespace pvData {
SerializableControl *pflusher) ;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -55,14 +53,6 @@ namespace epics { namespace pvData {
value = pbuffer->getShort();
}
void BasePVShort::toString(StringBuilder buf) {toString(buf,0);}
void BasePVShort::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVShort::operator==(PVField& pvField)
{
return getConvert()->equals(this, &pvField);
-14
View File
@@ -33,8 +33,6 @@ namespace epics { namespace pvData {
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -178,18 +176,6 @@ namespace epics { namespace pvData {
}
}
void BasePVShortArray::toString(StringBuilder buf)
{
toString(buf,1);
}
void BasePVShortArray::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVShortArray::operator==(PVField& pv)
{
return getConvert()->equals(this, &pv);
-10
View File
@@ -26,8 +26,6 @@ namespace epics { namespace pvData {
SerializableControl *pflusher) ;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -54,14 +52,6 @@ namespace epics { namespace pvData {
value = SerializeHelper::deserializeString(pbuffer, pflusher);
}
void BasePVString::toString(StringBuilder buf) {toString(buf,0);}
void BasePVString::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVString::operator==(PVField& pvField)
{
return getConvert()->equals(this, &pvField);
-14
View File
@@ -31,8 +31,6 @@ namespace epics { namespace pvData {
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual bool operator==(PVField& pv) ;
virtual bool operator!=(PVField& pv) ;
private:
@@ -158,18 +156,6 @@ namespace epics { namespace pvData {
SerializeHelper::serializeString(value[i], pbuffer, pflusher);
}
void BasePVStringArray::toString(StringBuilder buf)
{
toString(buf,1);
}
void BasePVStringArray::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
bool BasePVStringArray::operator==(PVField& pv)
{
return getConvert()->equals(this, &pv);
-35
View File
@@ -423,41 +423,6 @@ namespace epics { namespace pvData {
return true;
}
void PVStructure::toStringPvt(StringBuilder builder,int indentLevel) {
Convert *convert = getConvert();
PVField::toString(builder,indentLevel);
if(pImpl->extendsStructureName.length()>0) {
*builder += " extends ";
*builder += pImpl->extendsStructureName;
}
convert->newLine(builder,indentLevel);
*builder += "{";
int nFields = pImpl->numberFields;
PVFieldPtrArray pvFields = pImpl->pvFields;
for(int i=0; i < nFields; i++) {
PVField *pvField = pvFields[i];
convert->newLine(builder,indentLevel + 1);
FieldConstPtr field = pvField->getField();
*builder += field->getFieldName() + " = ";
pvField->toString(builder,indentLevel+1);
}
convert->newLine(builder,indentLevel);
*builder += "}";
}
void PVStructure::toString(StringBuilder buf)
{
*buf += "structure ";
*buf += getField()->getFieldName();
toStringPvt(buf,0);
}
void PVStructure::toString(StringBuilder buf,int indentLevel)
{
*buf += "structure ";
toStringPvt(buf,indentLevel);
}
void PVStructure::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) {
for(int i = 0; i<pImpl->numberFields; i++)
+9 -11
View File
@@ -29,8 +29,6 @@ namespace epics { namespace pvData {
StructureArrayData *data);
virtual int put(int offset,int length,
PVStructurePtrArray from, int fromOffset);
virtual void toString(StringBuilder buf) ;
virtual void toString(StringBuilder buf,int indentLevel) ;
virtual bool operator==(PVField &pv);
virtual bool operator!=(PVField &pv);
virtual void shareData( PVStructurePtrArray value,int capacity,int length);
@@ -53,11 +51,18 @@ namespace epics { namespace pvData {
structureArray(structureArray),
structureArrayData(new StructureArrayData()),
value(new PVStructurePtr[0])
{}
{
structureArray->incReferenceCount();
}
BasePVStructureArray::~BasePVStructureArray()
{
structureArray->decReferenceCount();
delete structureArrayData;
int length = getLength();
for(int i=0; i<length; i++) {
if(value[i]!=0) delete value[i];
}
delete[] value;
}
@@ -115,6 +120,7 @@ namespace epics { namespace pvData {
int newlength = offset + len;
if(newlength>capacity) {
setCapacity(newlength);
capacity = getCapacity();
newlength = capacity;
len = newlength - offset;
if(len<=0) return 0;
@@ -147,14 +153,6 @@ namespace epics { namespace pvData {
setLength(length);
}
void BasePVStructureArray::toString(StringBuilder buf) {toString(buf,0);}
void BasePVStructureArray::toString(StringBuilder buf,int indentLevel)
{
getConvert()->getString(buf,this,indentLevel);
PVField::toString(buf,indentLevel);
}
void BasePVStructureArray::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) {
serialize(pbuffer, pflusher, 0, getLength());
+32 -20
View File
@@ -126,7 +126,7 @@ void Convert::fromString(PVScalar *pvScalar, String from)
bool value =
((from.compare("true")==0) ? true : false);
pv->put(value);
break;
return;
}
case pvByte : {
PVByte *pv = (PVByte*)pvScalar;
@@ -134,7 +134,7 @@ void Convert::fromString(PVScalar *pvScalar, String from)
sscanf(from.c_str(),"%d",&ival);
int8 value = ival;
pv->put(value);
break;
return;
}
case pvShort : {
PVShort *pv = (PVShort*)pvScalar;
@@ -142,7 +142,7 @@ void Convert::fromString(PVScalar *pvScalar, String from)
sscanf(from.c_str(),"%d",&ival);
int16 value = ival;
pv->put(value);
break;
return;
}
case pvInt : {
PVInt *pv = (PVInt*)pvScalar;
@@ -150,7 +150,7 @@ void Convert::fromString(PVScalar *pvScalar, String from)
sscanf(from.c_str(),"%d",&ival);
int32 value = ival;
pv->put(value);
break;
return;
}
case pvLong : {
PVLong *pv = (PVLong*)pvScalar;
@@ -158,26 +158,26 @@ void Convert::fromString(PVScalar *pvScalar, String from)
sscanf(from.c_str(),"%lld",&ival);
int64 value = ival;
pv->put(value);
break;
return;
}
case pvFloat : {
PVFloat *pv = (PVFloat*)pvScalar;
float value;
sscanf(from.c_str(),"%f",&value);
pv->put(value);
break;
return;
}
case pvDouble : {
PVDouble*pv = (PVDouble*)pvScalar;
double value;
sscanf(from.c_str(),"%lf",&value);
pv->put(value);
break;
return;
}
case pvString: {
PVString *value = (PVString*)pvScalar;
value->put(from);
break;
return;
}
}
String message("Convert::fromString unknown scalarType ");
@@ -3056,7 +3056,13 @@ void convertToString(StringBuilder buffer,PVField * pv,int indentLevel)
return convertStructureArray(buffer,(PVStructureArray*)pv,indentLevel);
}
PVScalar *pvScalar = (PVScalar*)pv;
switch(pvScalar->getScalar()->getScalarType()) {
ScalarConstPtr pscalar = pvScalar->getScalar();
ScalarType scalarType = pscalar->getScalarType();
ScalarTypeFunc::toString(buffer,scalarType);
*buffer += " ";
*buffer += pscalar->getFieldName();
*buffer += " ";
switch(scalarType) {
case pvBoolean: {
PVBoolean *data = (PVBoolean*)pv;
bool value = data->get();
@@ -3121,30 +3127,28 @@ void convertToString(StringBuilder buffer,PVField * pv,int indentLevel)
void convertStructure(StringBuilder buffer,PVStructure *data,int indentLevel)
{
convert->newLine(buffer, indentLevel);
*buffer += "structure {";
*buffer += "structure ";
*buffer += data->getField()->getFieldName();
convert->newLine(buffer, indentLevel+1);
PVFieldPtrArray fieldsData = data->getPVFields();
if (fieldsData != 0) {
int length = data->getStructure()->getNumberFields();
for(int i=0; i<length; i++) {
PVField *fieldField = fieldsData[i];
FieldConstPtr fieldnow = fieldField->getField();
convert->newLine(buffer, indentLevel + 1);
int size = fieldnow->getFieldName().length();
char buff[size+2];
sprintf(buff,"%s = ",fieldnow->getFieldName().c_str());
*buffer += buff;
convert->getString(buffer,fieldField,indentLevel + 1);
fieldField->toString(buffer,indentLevel + 1);
if(i<length-1) convert->newLine(buffer, indentLevel+1);
}
}
convert->newLine(buffer, indentLevel);
*buffer += "}";
}
void convertArray(StringBuilder buffer,PVScalarArray * pv,int indentLevel)
{
ScalarArrayConstPtr array = pv->getScalarArray();
ScalarType type = array->getElementType();
ScalarTypeFunc::toString(buffer,type);
*buffer += "Array ";
*buffer += array->getFieldName();
*buffer += " ";
switch(type) {
case pvBoolean: {
PVBooleanArray *pvdata = (PVBooleanArray*)pv;
@@ -3313,9 +3317,17 @@ void convertArray(StringBuilder buffer,PVScalarArray * pv,int indentLevel)
void convertStructureArray(StringBuilder buffer,
PVStructureArray * pvdata,int indentLevel)
{
*buffer += "structureArray ";
*buffer += pvdata->getField()->getFieldName();
*buffer += " ";
StructureArrayData data = StructureArrayData();
int length = pvdata->getLength();
pvdata->get(0, length, &data);
if(length<=0) {
*buffer += " []";
return;
}
convert->newLine(buffer, indentLevel);
*buffer += "[";
for (int i = 0; i < length; i++) {
if (i != 0) {
+1 -1
View File
@@ -59,7 +59,7 @@ PVStructureArray * StandardPVField::structureArray(PVStructure *parent,
return pvDataCreate->createPVStructureArray(parent,field);
}
PVStructure * StandardPVField::structureArray(PVStructure *parent,
PVStructure* StandardPVField::structureArray(PVStructure *parent,
String fieldName,StructureConstPtr structure,String properties)
{
StructureConstPtr field = standardField->structureArray(
+1 -1
View File
@@ -2,7 +2,7 @@ TOP=../..
include $(TOP)/configure/CONFIG
INC += pvTypes.h
INC += pvType.h
INC += noDefaultMethods.h
INC += lock.h
INC += requester.h
+1 -1
View File
@@ -2,7 +2,7 @@
#ifndef BITSET_H
#define BITSET_H
#include <stdexcept>
#include <pvTypes.h>
#include <pvType.h>
//#include "byteBuffer.h"
//#include "serialize.h"
namespace epics { namespace pvData {
+1 -1
View File
@@ -3,7 +3,7 @@
#define BYTEBUFFER_H
#include <string>
#include <pvTypes.h>
#include <pvType.h>
#include <epicsEndian.h>
namespace epics {
@@ -1,6 +1,6 @@
/* pvTypes.h */
#ifndef PVTYPES_H
#define PVTYPES_H
/* pvType.h */
#ifndef PVTYPE_H
#define PVTYPE_H
namespace epics { namespace pvData {
@@ -12,7 +12,7 @@ namespace epics { namespace pvData {
typedef unsigned long long uint64;
}}
#endif /* PVTYPES_H */
#endif /* PVTYPE_H */
+1 -1
View File
@@ -6,7 +6,7 @@
*/
#include <algorithm>
#include <pvTypes.h>
#include <pvType.h>
#include "epicsException.h"
#include "byteBuffer.h"
-25
View File
@@ -101,8 +101,6 @@ namespace epics { namespace pvData {
public:
virtual ~PVScalar();
ScalarConstPtr getScalar() ;
virtual void toString(StringBuilder buf) = 0;
virtual void toString(StringBuilder buf,int indentLevel) = 0;
protected:
PVScalar(PVStructure *parent,ScalarConstPtr scalar);
};
@@ -122,8 +120,6 @@ namespace epics { namespace pvData {
DeserializableControl *pflusher) = 0;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) = 0;
virtual void toString(StringBuilder buf) = 0;
virtual void toString(StringBuilder buf,int indentLevel) = 0;
protected:
PVArray(PVStructure *parent,FieldConstPtr field);
void setCapacityLength(int capacity,int length);
@@ -143,8 +139,6 @@ namespace epics { namespace pvData {
DeserializableControl *pflusher) = 0;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) = 0;
virtual void toString(StringBuilder buf) = 0;
virtual void toString(StringBuilder buf,int indentLevel) = 0;
protected:
PVScalarArray(PVStructure *parent,ScalarArrayConstPtr scalarArray);
private:
@@ -208,8 +202,6 @@ namespace epics { namespace pvData {
String getExtendsStructureName();
bool putExtendsStructureName(
String extendsStructureName);
virtual void toString(StringBuilder buf) ;
virtual void toString(StringBuilder buf,int indentLevel) ;
virtual bool operator==(PVField &pv) ;
virtual bool operator!=(PVField &pv) ;
virtual void serialize(
@@ -225,7 +217,6 @@ namespace epics { namespace pvData {
protected:
PVStructure(PVStructure *parent,StructureConstPtr structure);
private:
void toStringPvt(StringBuilder buf,int indentLevel) ;
class PVStructurePvt * pImpl;
};
@@ -328,8 +319,6 @@ namespace epics { namespace pvData {
class PVBooleanArray : public PVScalarArray {
public:
virtual ~PVBooleanArray();
virtual void toString(StringBuilder buf) = 0 ;
virtual void toString(StringBuilder buf,int indentLevel) = 0 ;
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, BooleanArrayData *data) = 0;
virtual int put(int offset,int length, BooleanArray from, int fromOffset) = 0;
@@ -352,8 +341,6 @@ namespace epics { namespace pvData {
class PVByteArray : public PVScalarArray {
public:
virtual ~PVByteArray();
virtual void toString(StringBuilder buf) = 0 ;
virtual void toString(StringBuilder buf,int indentLevel) = 0;
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, ByteArrayData *data) = 0;
virtual int put(int offset,int length, ByteArray from, int fromOffset) = 0;
@@ -376,8 +363,6 @@ namespace epics { namespace pvData {
class PVShortArray : public PVScalarArray {
public:
virtual ~PVShortArray();
virtual void toString(StringBuilder buf) = 0;
virtual void toString(StringBuilder buf,int indentLevel) = 0;
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, ShortArrayData *data) = 0;
virtual int put(int offset,int length, ShortArray from, int fromOffset) = 0;
@@ -399,8 +384,6 @@ namespace epics { namespace pvData {
class PVIntArray : public PVScalarArray {
public:
virtual ~PVIntArray();
virtual void toString(StringBuilder buf) = 0;
virtual void toString(StringBuilder buf,int indentLevel) = 0;
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, IntArrayData *data) = 0;
virtual int put(int offset,int length, IntArray from, int fromOffset)= 0;
@@ -423,8 +406,6 @@ namespace epics { namespace pvData {
class PVLongArray : public PVScalarArray {
public:
virtual ~PVLongArray();
virtual void toString(StringBuilder buf) = 0;
virtual void toString(StringBuilder buf,int indentLevel) = 0;
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, LongArrayData *data) = 0;
virtual int put(int offset,int length, LongArray from, int fromOffset)= 0;
@@ -447,8 +428,6 @@ namespace epics { namespace pvData {
class PVFloatArray : public PVScalarArray {
public:
virtual ~PVFloatArray();
virtual void toString(StringBuilder buf) = 0;
virtual void toString(StringBuilder buf,int indentLevel) = 0;
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, FloatArrayData *data) = 0;
virtual int put(int offset,int length, FloatArray from, int fromOffset)= 0;
@@ -473,8 +452,6 @@ namespace epics { namespace pvData {
class PVDoubleArray : public PVScalarArray {
public:
virtual ~PVDoubleArray();
virtual void toString(StringBuilder buf) = 0;
virtual void toString(StringBuilder buf,int indentLevel) = 0;
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, DoubleArrayData *data) = 0;
virtual int put(int offset,int length, DoubleArray from, int fromOffset) = 0;
@@ -497,8 +474,6 @@ namespace epics { namespace pvData {
class PVStringArray : public PVScalarArray {
public:
virtual ~PVStringArray();
virtual void toString(StringBuilder buf) = 0;
virtual void toString(StringBuilder buf,int indentLevel) = 0;
virtual void setCapacity(int capacity) = 0;
virtual int get(int offset, int length, StringArrayData *data) = 0;
virtual int put(int offset,int length, StringArray from, int fromOffset)= 0;
+2 -1
View File
@@ -4,7 +4,7 @@
#ifndef PVINTROSPECT_H
#define PVINTROSPECT_H
#include "noDefaultMethods.h"
#include "pvTypes.h"
#include "pvType.h"
namespace epics { namespace pvData {
class Field;
@@ -76,6 +76,7 @@ namespace epics { namespace pvData {
friend class Structure;
friend class PVFieldPvt;
friend class StandardField;
friend class BasePVStructureArray;
};
+1 -1
View File
@@ -21,7 +21,7 @@ namespace epics { namespace pvData {
String fieldName,ScalarType elementType, String properties);
PVStructureArray * structureArray(PVStructure *parent,
String fieldName,StructureConstPtr structure);
PVStructure * structureArray(PVStructure *parent,
PVStructure* structureArray(PVStructure *parent,
String fieldName,StructureConstPtr structure,String properties);
PVStructure * enumerated(PVStructure *parent,
String fieldName,StringArray choices);
+10 -6
View File
@@ -2,17 +2,21 @@ TOP=../..
include $(TOP)/configure/CONFIG
PROD_HOST += testIntTypes
testIntTypes_SRCS += testIntTypes.cpp
testIntTypes_LIBS += pvFactory Com
PROD_HOST += testPVType
testPVType_SRCS += testPVType.cpp
testPVType_LIBS += pvFactory Com
PROD_HOST += testIntrospect
testIntrospect_SRCS += testIntrospect.cpp
testIntrospect_LIBS += pvFactory Com
PROD_HOST += testSimple
testSimple_SRCS += testSimple.cpp
testSimple_LIBS += pvFactory Com
PROD_HOST += testPVData
testPVData_SRCS += testPVData.cpp
testPVData_LIBS += pvFactory Com
PROD_HOST += testPVStructureArray
testPVStructureArray_SRCS += testPVStructureArray.cpp
testPVStructureArray_LIBS += pvFactory Com
include $(TOP)/configure/RULES
#----------------------------------------
+2 -2
View File
@@ -156,8 +156,8 @@ int main(int argc,char *argv[])
finalTotalReferences = Field::getTotalReferenceCount();
assert(initialTotalReferences==finalTotalReferences);
initialTotalReferences = Field::getTotalReferenceCount();
long long totalConstruct = Field::getTotalConstruct();
long long totalDestruct = Field::getTotalDestruct();
int64 totalConstruct = Field::getTotalConstruct();
int64 totalDestruct = Field::getTotalDestruct();
int totalReference = Field::getTotalReferenceCount();
fprintf(fd,"Field: totalConstruct %lli totalDestruct %lli totalReferenceCount %i\n",
totalConstruct,totalDestruct,totalReference);
+283
View File
@@ -0,0 +1,283 @@
/* testPVdata.cpp */
/* Author: Marty Kraimer Date: 2010.11 */
#include <cstddef>
#include <cstdlib>
#include <cstddef>
#include <string>
#include <cstdio>
#include <epicsAssert.h>
#include "requester.h"
#include "pvIntrospect.h"
#include "pvData.h"
#include "convert.h"
#include "standardField.h"
#include "standardPVField.h"
using namespace epics::pvData;
static FieldCreate * fieldCreate = 0;
static PVDataCreate * pvDataCreate = 0;
static StandardField *standardField = 0;
static StandardPVField *standardPVField = 0;
static Convert *convert = 0;
static String builder("");
static String alarmTimeStamp("alarm,timeStamp");
static String alarmTimeStampValueAlarm("alarm,timeStamp,valueAlarm");
static String allProperties("alarm,timeStamp,display,control,valueAlarm");
static void testPVScalarCommon(FILE * fd,String fieldName,ScalarType stype)
{
PVScalar *pvScalar = standardPVField->scalar(0,fieldName,stype);
if(stype==pvBoolean) {
convert->fromString(pvScalar,String("true"));
} else {
convert->fromString(pvScalar,String("10"));
}
builder.clear();
pvScalar->toString(&builder);
fprintf(fd,"%s\n",builder.c_str());
delete pvScalar;
}
static void testPVScalarWithProperties(
FILE * fd,String fieldName,ScalarType stype)
{
PVStructure *pvStructure = 0;
bool hasValueAlarm = false;
bool hasDisplayControl = false;
switch(stype) {
case pvBoolean: {
pvStructure = standardPVField->scalar(
0,fieldName,stype,alarmTimeStampValueAlarm);
hasValueAlarm = true;
PVBoolean *pvField = pvStructure->getBooleanField(String("value"));
pvField->put(true);
break;
}
case pvByte: {
pvStructure = standardPVField->scalar(
0,fieldName,stype,allProperties);
hasValueAlarm = true;
hasDisplayControl = true;
PVByte *pvField = pvStructure->getByteField(String("value"));
pvField->put(127);
break;
}
case pvShort: {
pvStructure = standardPVField->scalar(
0,fieldName,stype,allProperties);
hasValueAlarm = true;
hasDisplayControl = true;
PVShort *pvField = pvStructure->getShortField(String("value"));
pvField->put(32767);
break;
}
case pvInt: {
pvStructure = standardPVField->scalar(
0,fieldName,stype,allProperties);
hasValueAlarm = true;
hasDisplayControl = true;
PVInt *pvField = pvStructure->getIntField(String("value"));
pvField->put((int)0x80000000);
break;
}
case pvLong: {
pvStructure = standardPVField->scalar(
0,fieldName,stype,allProperties);
hasValueAlarm = true;
hasDisplayControl = true;
PVLong *pvField = pvStructure->getLongField(String("value"));
int64 value = 0x80000000;
value <<= 32;
value |= 0xffffffff;
pvField->put(value);
break;
}
case pvFloat: {
pvStructure = standardPVField->scalar(
0,fieldName,stype,allProperties);
hasValueAlarm = true;
hasDisplayControl = true;
PVFloat *pvField = pvStructure->getFloatField(String("value"));
pvField->put(1.123e8);
break;
}
case pvDouble: {
pvStructure = standardPVField->scalar(
0,fieldName,stype,allProperties);
hasValueAlarm = true;
hasDisplayControl = true;
PVDouble *pvField = pvStructure->getDoubleField(String("value"));
pvField->put(1.123e35);
break;
}
case pvString: {
pvStructure = standardPVField->scalar(
0,fieldName,stype,alarmTimeStamp);
PVString *pvField = pvStructure->getStringField(String("value"));
pvField->put(String("this is a string"));
break;
}
}
PVLong *seconds = pvStructure->getLongField(
String("timeStamp.secondsPastEpoch"));
assert(seconds!=0);
seconds->put(123456789);
PVInt *nano = pvStructure->getIntField(String("timeStamp.nanoSeconds"));
assert(nano!=0);
nano->put(1000000);
PVInt *severity = pvStructure->getIntField(String("alarm.severity"));
assert(severity!=0);
severity->put(2);
PVString *message = pvStructure->getStringField(String("alarm.message"));
assert(message!=0);
message->put(String("messageForAlarm"));
if(hasDisplayControl) {
PVString *desc = pvStructure->getStringField(
String("display.description"));
assert(desc!=0);
desc->put(String("this is a description"));
PVString *format = pvStructure->getStringField(
String("display.format"));
assert(format!=0);
format->put(String("f10.2"));
PVString *units = pvStructure->getStringField(
String("display.units"));
assert(units!=0);
units->put(String("SomeUnits"));
PVDouble *limit = pvStructure->getDoubleField(
String("display.limit.low"));
assert(limit!=0);
limit->put(0.0);
limit = pvStructure->getDoubleField(
String("display.limit.high"));
assert(limit!=0);
limit->put(10.0);
limit = pvStructure->getDoubleField(
String("control.limit.low"));
assert(limit!=0);
limit->put(1.0);
limit = pvStructure->getDoubleField(
String("control.limit.high"));
assert(limit!=0);
limit->put(9.0);
PVScalar *pvtemp = (PVScalar *)pvStructure->getSubField(
String("valueAlarm.lowAlarmLimit"));
assert(pvtemp!=0);
convert->fromDouble(pvtemp,1.0);
pvtemp = (PVScalar *)pvStructure->getSubField(
String("valueAlarm.highAlarmLimit"));
assert(pvtemp!=0);
convert->fromDouble(pvtemp,9.0);
severity = pvStructure->getIntField(
String("valueAlarm.lowAlarmSeverity"));
assert(severity!=0);
severity->put(2);
severity = pvStructure->getIntField(
String("valueAlarm.highAlarmSeverity"));
assert(severity!=0);
severity->put(2);
PVBoolean *active = pvStructure->getBooleanField(
String("valueAlarm.active"));
assert(active!=0);
active->put(true);
}
builder.clear();
pvStructure->toString(&builder);
fprintf(fd,"%s\n",builder.c_str());
delete pvStructure;
}
static void testPVScalar(FILE * fd) {
fprintf(fd,"\ntestScalar\n");
testPVScalarCommon(fd,String("boolean"),pvBoolean);
testPVScalarCommon(fd,String("byte"),pvByte);
testPVScalarCommon(fd,String("short"),pvShort);
testPVScalarCommon(fd,String("int"),pvInt);
testPVScalarCommon(fd,String("long"),pvLong);
testPVScalarCommon(fd,String("float"),pvFloat);
testPVScalarCommon(fd,String("double"),pvDouble);
testPVScalarCommon(fd,String("string"),pvString);
testPVScalarWithProperties(fd,String("boolean"),pvBoolean);
testPVScalarWithProperties(fd,String("byte"),pvByte);
testPVScalarWithProperties(fd,String("short"),pvShort);
testPVScalarWithProperties(fd,String("int"),pvInt);
testPVScalarWithProperties(fd,String("long"),pvLong);
testPVScalarWithProperties(fd,String("float"),pvFloat);
testPVScalarWithProperties(fd,String("double"),pvDouble);
testPVScalarWithProperties(fd,String("string"),pvString);
}
static void testScalarArrayCommon(FILE * fd,String fieldName,ScalarType stype)
{
PVStructure *pvStructure = standardPVField->scalarArray(
0,fieldName,stype,alarmTimeStamp);
PVScalarArray *scalarArray = pvStructure->getScalarArrayField(
String("value"),stype);
assert(scalarArray!=0);
if(stype==pvBoolean) {
String values[] = {String("true"),String("false"),String("true")};
convert->fromStringArray(scalarArray, 0,3,values,0);
} else {
String values[] = {String("0"),String("1"),String("2")};
convert->fromStringArray(scalarArray, 0,3,values,0);
}
builder.clear();
pvStructure->toString(&builder);
fprintf(fd,"%s\n",builder.c_str());
delete pvStructure;
}
static void testScalarArray(FILE * fd) {
fprintf(fd,"\ntestScalarArray\n");
testScalarArrayCommon(fd,String("boolean"),pvBoolean);
testScalarArrayCommon(fd,String("byte"),pvByte);
testScalarArrayCommon(fd,String("short"),pvShort);
testScalarArrayCommon(fd,String("int"),pvInt);
testScalarArrayCommon(fd,String("long"),pvLong);
testScalarArrayCommon(fd,String("float"),pvFloat);
testScalarArrayCommon(fd,String("double"),pvDouble);
testScalarArrayCommon(fd,String("string"),pvString);
}
int main(int argc,char *argv[])
{
int initialTotalReferences,finalTotalReferences;
char *fileName = 0;
if(argc>1) fileName = argv[1];
FILE * fd = stdout;
if(fileName!=0 && fileName[0]!=0) {
fd = fopen(fileName,"w+");
}
fieldCreate = getFieldCreate();
pvDataCreate = getPVDataCreate();
standardField = getStandardField();
standardPVField = getStandardPVField();
convert = getConvert();
initialTotalReferences = Field::getTotalReferenceCount();
testPVScalar(fd);
finalTotalReferences = Field::getTotalReferenceCount();
assert(initialTotalReferences==finalTotalReferences);
initialTotalReferences = Field::getTotalReferenceCount();
testScalarArray(fd);
finalTotalReferences = Field::getTotalReferenceCount();
assert(initialTotalReferences==finalTotalReferences);
int64 totalConstruct = Field::getTotalConstruct();
int64 totalDestruct = Field::getTotalDestruct();
int totalReference = Field::getTotalReferenceCount();
fprintf(fd,"Field: totalConstruct %lli totalDestruct %lli totalReferenceCount %i\n",
totalConstruct,totalDestruct,totalReference);
assert(totalConstruct==(totalDestruct+totalReference));
totalConstruct = PVField::getTotalConstruct();
totalDestruct = PVField::getTotalDestruct();
fprintf(fd,"PVField: totalConstruct %lli totalDestruct %lli\n",
totalConstruct,totalDestruct);
assert(totalConstruct==totalDestruct);
return(0);
}
+85
View File
@@ -0,0 +1,85 @@
/* testPVStructureArray.cpp */
/* Author: Marty Kraimer Date: 2010.10 */
#include <cstddef>
#include <cstdlib>
#include <cstddef>
#include <string>
#include <cstdio>
#include <epicsAssert.h>
#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 * pvDataCreate = 0;
static StandardField *standardField = 0;
static StandardPVField *standardPVField = 0;
static String buffer("");
StructureConstPtr getPowerSupplyStructure() {
String properties("alarm");
FieldConstPtr powerSupply[3];
powerSupply[0] = standardField->scalar(
String("voltage"),pvDouble,properties);
powerSupply[1] = standardField->scalar(
String("power"),pvDouble,properties);
powerSupply[2] = standardField->scalar(
String("current"),pvDouble,properties);
StructureConstPtr structure = standardField->structure(
String("powerSupply"),3,powerSupply);
return structure;
}
void testPowerSupplyArray(FILE * fd) {
PVStructure* powerSupplyArrayStruct = standardPVField->structureArray(
0,"powerSupply",getPowerSupplyStructure(),String("alarm,timeStamp"));
PVStructureArray * powerSupplyArray =
powerSupplyArrayStruct->getStructureArrayField(String("value"));
assert(powerSupplyArray!=0);
PVStructure *structureArray[3];
StructureConstPtr structure =
powerSupplyArray->getStructureArray()->getStructure();
structureArray[0] = pvDataCreate->createPVStructure(0,structure);
structureArray[1] = pvDataCreate->createPVStructure(0,structure);
structureArray[2] = pvDataCreate->createPVStructure(0,structure);
powerSupplyArray->put(0,3,structureArray,0);
buffer.clear();
powerSupplyArrayStruct->toString(&buffer);
fprintf(fd,"%s\n",buffer.c_str());
delete powerSupplyArrayStruct;
}
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();
pvDataCreate = getPVDataCreate();
standardField = getStandardField();
standardPVField = getStandardPVField();
testPowerSupplyArray(fd);
int64 totalConstruct = Field::getTotalConstruct();
int64 totalDestruct = Field::getTotalDestruct();
int totalReference = Field::getTotalReferenceCount();
fprintf(fd,"Field: totalConstruct %lli totalDestruct %lli totalReferenceCount %i\n",
totalConstruct,totalDestruct,totalReference);
assert(totalConstruct==(totalDestruct+totalReference));
totalConstruct = PVField::getTotalConstruct();
totalDestruct = PVField::getTotalDestruct();
fprintf(fd,"PVField: totalConstruct %lli totalDestruct %lli\n",
totalConstruct,totalDestruct);
assert(totalConstruct==totalDestruct);
return(0);
}
@@ -10,7 +10,7 @@
#include <epicsAssert.h>
#include "requester.h"
#include "pvTypes.h"
#include "pvType.h"
using namespace epics::pvData;
-92
View File
@@ -1,92 +0,0 @@
/* testSimpleStructure.cpp */
/* Author: Marty Kraimer Date: 2010.09 */
#include <cstddef>
#include <cstdlib>
#include <cstddef>
#include <string>
#include <cstdio>
#include <epicsAssert.h>
#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) {
int initialTotalReferences,finalTotalReferences;
fprintf(fd,"\ntestSimpleStructure\n");
String properties("alarm,timeStamp,display,control,valueAlarm");
initialTotalReferences = Field::getTotalReferenceCount();
PVStructure *ptop = standardPVField->scalar(
0,String(""),pvDouble,properties);
buffer.clear();
ptop->toString(&buffer);
fprintf(fd,"%s\n",buffer.c_str());
finalTotalReferences = Field::getTotalReferenceCount();
printf("before delete initialTotalReferences %d finalTotalReferences %d\n",
initialTotalReferences,finalTotalReferences);
delete ptop;
finalTotalReferences = Field::getTotalReferenceCount();
printf("after initialTotalReferences %d finalTotalReferences %d\n",
initialTotalReferences,finalTotalReferences);
assert(initialTotalReferences==finalTotalReferences);
}
void testPowerSupply(FILE * fd) {
int initialTotalReferences,finalTotalReferences;
fprintf(fd,"\ntestPowerSupply\n");
initialTotalReferences = Field::getTotalReferenceCount();
PVStructure *ptop = standardPVField->powerSupply(0);
buffer.clear();
ptop->toString(&buffer);
fprintf(fd,"%s\n",buffer.c_str());
finalTotalReferences = Field::getTotalReferenceCount();
printf("before delete initialTotalReferences %d finalTotalReferences %d\n",
initialTotalReferences,finalTotalReferences);
delete ptop;
finalTotalReferences = Field::getTotalReferenceCount();
printf("after initialTotalReferences %d finalTotalReferences %d\n",
initialTotalReferences,finalTotalReferences);
assert(initialTotalReferences==finalTotalReferences);
}
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);
long long totalConstruct = Field::getTotalConstruct();
long long totalDestruct = Field::getTotalDestruct();
int totalReference = Field::getTotalReferenceCount();
printf("Field: totalConstruct %lli totalDestruct %lli totalReferenceCount %i\n",
totalConstruct,totalDestruct,totalReference);
assert(totalConstruct==(totalDestruct+totalReference));
totalConstruct = PVField::getTotalConstruct();
totalDestruct = PVField::getTotalDestruct();
printf("PVField: totalConstruct %lli totalDestruct %lli\n",
totalConstruct,totalDestruct);
assert(totalConstruct==totalDestruct);
return(0);
}
-13
View File
@@ -6,19 +6,6 @@ PROD_HOST += testPVAuxInfo
testPVAuxInfo_SRCS += testPVAuxInfo.cpp
testPVAuxInfo_LIBS += pvFactory
PROD_HOST += testPVScalar
testPVScalar_SRCS += testPVScalar.cpp
testPVScalar_LIBS += pvFactory
testPVScalar_LIBS += pvMisc Com
PROD_HOST += testPVScalarArray
testPVScalarArray_SRCS += testPVScalarArray.cpp
testPVScalarArray_LIBS += pvFactory
PROD_HOST += testSimpleStructure
testSimpleStructure_SRCS += testSimpleStructure.cpp
testSimpleStructure_LIBS += pvFactory
PROD_HOST += testBitSet
testBitSet_SRCS += testBitSet.cpp
testBitSet_LIBS += pvMisc Com
-359
View File
@@ -1,359 +0,0 @@
/* testPVscalar.cpp */
/* Author: Marty Kraimer Date: 2010.09 */
#include <stddef.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <epicsAssert.h>
#include "requester.h"
#include "pvIntrospect.h"
#include "pvData.h"
#include "standardField.h"
#include "standardPVField.h"
using namespace epics::pvData;
static FieldCreate * pfieldCreate = 0;
static PVDataCreate *pvDataCreate = 0;
static String buffer("");
void testBoolean() {
printf("\ntestBoolean\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvBoolean);
PVBoolean *pvValue = (PVBoolean *)pvScalar;
bool value = true;
pvValue->put(value);
bool getValue = pvValue->get();
printf("put %s get %s\n",
((value==false) ? "false" : "true"),
((getValue==false) ? "false" : "true"));
if(value!=getValue) {
fprintf(stderr,"ERROR getValue put %s get %s\n",
((value==false) ? "false" : "true"),
((getValue==false) ? "false" : "true"));
}
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==false) ? "false" : "true"),
pvParent);
int offset = pvValue->getFieldOffset();
int nextOffset = pvValue->getNextFieldOffset();
int numberFields = pvValue->getNumberFields();
printf("offset %d nextOffset %d numberFields %d\n",
offset,nextOffset,numberFields);
ScalarConstPtr scalar = dynamic_cast<ScalarConstPtr>(field);
if(scalar!=field) {
fprintf(stderr,"ERROR field!=scalar field %p scalar %p\n",field,scalar);
}
buffer.clear();
buffer += "value ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
PVScalar *other = getStandardPVField()->scalarValue(0,pvDouble);
bool isEqual = pvScalar==other;
printf("expect false isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}
void testByte() {
printf("\ntestByte\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvByte);
PVByte *pvValue = (PVByte *)pvScalar;
int8 value = 2;
pvValue->put(value);
int getValue = pvValue->get();
printf("put %d get %d\n",value,getValue);
if(value!=getValue) {
fprintf(stderr,"ERROR getValue put %d get %d\n",value,getValue);
}
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==false) ? "false" : "true"),
pvParent);
int offset = pvValue->getFieldOffset();
int nextOffset = pvValue->getNextFieldOffset();
int numberFields = pvValue->getNumberFields();
printf("offset %d nextOffset %d numberFields %d\n",
offset,nextOffset,numberFields);
ScalarConstPtr scalar = dynamic_cast<ScalarConstPtr>(field);
if(scalar!=field) {
fprintf(stderr,"ERROR field!=scalar field %p scalar %p\n",field,scalar);
}
buffer.clear();
buffer += "value ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
PVScalar *other = getStandardPVField()->scalarValue(0,pvDouble);
bool isEqual = pvScalar==other;
printf("expect false isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}
void testShort() {
printf("\ntestShort\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvShort);
PVShort *pvValue = (PVShort *)pvScalar;
int16 value = 2;
pvValue->put(value);
int getValue = pvValue->get();
printf("put %d get %d\n",value,getValue);
if(value!=getValue) {
fprintf(stderr,"ERROR getValue put %d get %d\n",value,getValue);
}
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==false) ? "false" : "true"),
pvParent);
int offset = pvValue->getFieldOffset();
int nextOffset = pvValue->getNextFieldOffset();
int numberFields = pvValue->getNumberFields();
printf("offset %d nextOffset %d numberFields %d\n",
offset,nextOffset,numberFields);
ScalarConstPtr scalar = dynamic_cast<ScalarConstPtr>(field);
if(scalar!=field) {
fprintf(stderr,"ERROR field!=scalar field %p scalar %p\n",field,scalar);
}
buffer.clear();
buffer += "value ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
PVScalar *other = getStandardPVField()->scalarValue(0,pvDouble);
bool isEqual = pvScalar==other;
printf("expect false isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}
void testInt() {
printf("\ntestInt\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvInt);
PVInt *pvValue = (PVInt *)pvScalar;
int32 value = 2;
pvValue->put(value);
int getValue = pvValue->get();
printf("put %d get %d\n",value,getValue);
if(value!=getValue) {
fprintf(stderr,"ERROR getValue put %d get %d\n",value,getValue);
}
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==false) ? "false" : "true"),
pvParent);
int offset = pvValue->getFieldOffset();
int nextOffset = pvValue->getNextFieldOffset();
int numberFields = pvValue->getNumberFields();
printf("offset %d nextOffset %d numberFields %d\n",
offset,nextOffset,numberFields);
ScalarConstPtr scalar = dynamic_cast<ScalarConstPtr>(field);
if(scalar!=field) {
fprintf(stderr,"ERROR field!=scalar field %p scalar %p\n",field,scalar);
}
buffer.clear();
buffer += "value ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
PVScalar *other = getStandardPVField()->scalarValue(0,pvDouble);
bool isEqual = pvScalar==other;
printf("expect false isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}
void testLong() {
printf("\ntestLong\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvLong);
PVLong *pvValue = (PVLong *)pvScalar;
int64 value = 2;
pvValue->put(value);
int64 getValue = pvValue->get();
printf("put %ld get %ld\n",(long int)value,(long int)getValue);
if(value!=getValue) {
fprintf(stderr,"ERROR getValue put %ld get %ld\n",(long int)value,(long int)getValue);
}
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==false) ? "false" : "true"),
pvParent);
int offset = pvValue->getFieldOffset();
int nextOffset = pvValue->getNextFieldOffset();
int numberFields = pvValue->getNumberFields();
printf("offset %d nextOffset %d numberFields %d\n",
offset,nextOffset,numberFields);
ScalarConstPtr scalar = dynamic_cast<ScalarConstPtr>(field);
if(scalar!=field) {
fprintf(stderr,"ERROR field!=scalar field %p scalar %p\n",field,scalar);
}
buffer.clear();
buffer += "value ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
PVScalar *other = getStandardPVField()->scalarValue(0,pvDouble);
bool isEqual = pvScalar==other;
printf("expect false isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}
void testFloat() {
printf("\ntestFloat\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvFloat);
PVFloat *pvValue = (PVFloat *)pvScalar;
float value = 2;
pvValue->put(value);
float getValue = pvValue->get();
printf("put %f get %f\n",value,getValue);
if(value!=getValue) {
fprintf(stderr,"ERROR getValue put %f get %f\n",value,getValue);
}
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==false) ? "false" : "true"),
pvParent);
int offset = pvValue->getFieldOffset();
int nextOffset = pvValue->getNextFieldOffset();
int numberFields = pvValue->getNumberFields();
printf("offset %d nextOffset %d numberFields %d\n",
offset,nextOffset,numberFields);
ScalarConstPtr scalar = dynamic_cast<ScalarConstPtr>(field);
if(scalar!=field) {
fprintf(stderr,"ERROR field!=scalar field %p scalar %p\n",field,scalar);
}
buffer.clear();
buffer += "value ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
bool isEqual = pvScalar==pvScalar;
printf("expect true isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}
void testDouble() {
printf("\ntestDouble\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvDouble);
PVDouble *pvValue = (PVDouble *)pvScalar;
double value = 2;
pvValue->put(value);
double getValue = pvValue->get();
printf("put %lf get %lf\n",value,getValue);
if(value!=getValue) {
fprintf(stderr,"ERROR getValue put %lf get %lf\n",value,getValue);
}
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==false) ? "false" : "true"),
pvParent);
int offset = pvValue->getFieldOffset();
int nextOffset = pvValue->getNextFieldOffset();
int numberFields = pvValue->getNumberFields();
printf("offset %d nextOffset %d numberFields %d\n",
offset,nextOffset,numberFields);
ScalarConstPtr scalar = dynamic_cast<ScalarConstPtr>(field);
if(scalar!=field) {
fprintf(stderr,"ERROR field!=scalar field %p scalar %p\n",field,scalar);
}
buffer.clear();
buffer += "value ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
bool isEqual = pvScalar==pvScalar;
printf("expect true isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}
void testString() {
printf("\ntestString\n");
PVScalar *pvScalar = getStandardPVField()->scalarValue(0,pvString);
PVString *pvValue = (PVString *)pvScalar;
String value = "testString";
pvValue->put(value);
String getValue = pvValue->get();
printf("put %s get %s\n",value.c_str(),getValue.c_str());
if(value!=getValue) {
fprintf(stderr,"ERROR getValue put %s get %s\n",
value.c_str(),getValue.c_str());
}
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==false) ? "false" : "true"),
pvParent);
int offset = pvValue->getFieldOffset();
int nextOffset = pvValue->getNextFieldOffset();
int numberFields = pvValue->getNumberFields();
printf("offset %d nextOffset %d numberFields %d\n",
offset,nextOffset,numberFields);
ScalarConstPtr scalar = dynamic_cast<ScalarConstPtr>(field);
if(scalar!=field) {
fprintf(stderr,"ERROR field!=scalar field %p scalar %p\n",field,scalar);
}
buffer.clear();
buffer += "value ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
bool isEqual = pvScalar==pvScalar;
printf("expect true isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}
int main(int argc,char *argv[])
{
pfieldCreate = getFieldCreate();
pvDataCreate = getPVDataCreate();
testBoolean();
testByte();
testShort();
testInt();
testLong();
testFloat();
testDouble();
testString();
return(0);
}
-272
View File
@@ -1,272 +0,0 @@
/* testPVArray.cpp */
/* Author: Marty Kraimer Date: 2010.09 */
#include <stddef.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include "requester.h"
#include "pvIntrospect.h"
#include "pvData.h"
#include "standardField.h"
#include "standardPVField.h"
using namespace epics::pvData;
static FieldCreate * pfieldCreate = 0;
static PVDataCreate *pvDataCreate = 0;
static String buffer("");
void testBooleanArray() {
printf("\ntestBooleanArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(0,pvBoolean);
PVBooleanArray *pvValue = (PVBooleanArray *)pvScalarArray;
int length = 5;
bool *value = new bool[length];
for(int i=0; i<length; i++) value[i] = true;
pvValue->put(0,length,value,0);
BooleanArrayData data = BooleanArrayData();
pvValue->get(0,length,&data);
bool * getValue = data.data;
printf("(orig,get):");
for(int i=0; i< length; i++) {
printf("(%s,%s) ",
((value[i]==true) ? "true" : "false"),
((getValue[i]==true) ? "true" : "false"));
}
printf("\n");
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
buffer.clear();
buffer += "pv ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
delete pvValue;
delete[] value;
}
void testByteArray() {
printf("\ntestByteArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(0,pvByte);
PVByteArray *pvValue = (PVByteArray *)pvScalarArray;
int length = 5;
int8 *value = new int8[length];
for(int i=0; i<length; i++) value[i] = i;
pvValue->put(0,length,value,0);
ByteArrayData data = ByteArrayData();
pvValue->get(0,length,&data);
int8 * getValue = data.data;
printf("(orig,get):");
for(int i=0; i< length; i++) {
printf("(%d,%d) ",(int)value[i],(int)getValue[i]);
}
printf("\n");
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
buffer.clear();
buffer += "pv ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
delete pvValue;
delete[] value;
}
void testShortArray() {
printf("\ntestShortArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(0,pvShort);
PVShortArray *pvValue = (PVShortArray *)pvScalarArray;
int length = 5;
int16 *value = new int16[length];
for(int i=0; i<length; i++) value[i] = i;
pvValue->put(0,length,value,0);
ShortArrayData data = ShortArrayData();
pvValue->get(0,length,&data);
int16 * getValue = data.data;
printf("(orig,get):");
for(int i=0; i< length; i++) {
printf("(%d,%d) ",(int)value[i],(int)getValue[i]);
}
printf("\n");
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
buffer.clear();
buffer += "pv ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
delete pvValue;
delete[] value;
}
void testIntArray() {
printf("\ntestIntArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(0,pvInt);
PVIntArray *pvValue = (PVIntArray *)pvScalarArray;
int length = 5;
int32 *value = new int32[length];
for(int i=0; i<length; i++) value[i] = i;
pvValue->put(0,length,value,0);
IntArrayData data = IntArrayData();
pvValue->get(0,length,&data);
int32 * getValue = data.data;
printf("(orig,get):");
for(int i=0; i< length; i++) {
printf("(%d,%d) ",value[i],getValue[i]);
}
printf("\n");
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
buffer.clear();
buffer += "pv ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
delete pvValue;
delete[] value;
}
void testLongArray() {
printf("\ntestLongArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(0,pvLong);
PVLongArray *pvValue = (PVLongArray *)pvScalarArray;
int length = 5;
int64 *value = new int64[length];
for(int i=0; i<length; i++) value[i] = i;
pvValue->put(0,length,value,0);
LongArrayData data = LongArrayData();
pvValue->get(0,length,&data);
int64 * getValue = data.data;
printf("(orig,get):");
for(int i=0; i< length; i++) {
printf("(%ld,%ld) ",(long int)value[i],(long int)getValue[i]);
}
printf("\n");
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
buffer.clear();
buffer += "pv ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
delete pvValue;
delete[] value;
}
void testFloatArray() {
printf("\ntestFloatArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(0,pvFloat);
PVFloatArray *pvValue = (PVFloatArray *)pvScalarArray;
int length = 5;
float *value = new float[length];
for(int i=0; i<length; i++) value[i] = i;
pvValue->put(0,length,value,0);
FloatArrayData data = FloatArrayData();
pvValue->get(0,length,&data);
float * getValue = data.data;
printf("(orig,get):");
for(int i=0; i< length; i++) {
printf("(%f,%f) ",value[i],getValue[i]);
}
printf("\n");
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
buffer.clear();
buffer += "pv ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
delete pvValue;
delete[] value;
}
void testDoubleArray() {
printf("\ntestDoubleArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(0,pvDouble);
PVDoubleArray *pvValue = (PVDoubleArray *)pvScalarArray;
int length = 5;
double *value = new double[length];
for(int i=0; i<length; i++) value[i] = i;
pvValue->put(0,length,value,0);
DoubleArrayData data = DoubleArrayData();
pvValue->get(0,length,&data);
double * getValue = data.data;
printf("(orig,get):");
for(int i=0; i< length; i++) {
printf("(%f,%f) ",value[i],getValue[i]);
}
printf("\n");
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
buffer.clear();
buffer += "pv ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
delete pvValue;
delete[] value;
}
void testStringArray() {
printf("\ntestStringArray\n");
PVScalarArray *pvScalarArray =
getStandardPVField()->scalarArrayValue(0,pvString);
PVStringArray *pvValue = (PVStringArray *)pvScalarArray;
int length = 5;
String *value = new String[length];
for(int i=0; i<length; i++) {
char buf[16];
sprintf(buf,"string%d",i);
value[i] = buf;
}
pvValue->put(0,length,value,0);
StringArrayData data = StringArrayData();
pvValue->get(0,length,&data);
String * getValue = data.data;
printf("(orig,get):");
for(int i=0; i< length; i++) {
printf("(%s,%s) ",value[i].c_str(),getValue[i].c_str());
}
printf("\n");
FieldConstPtr field = pvValue->getField();
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
buffer.clear();
buffer += "pv ";
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
delete pvValue;
delete[] value;
}
int main(int argc,char *argv[])
{
pfieldCreate = getFieldCreate();
pvDataCreate = getPVDataCreate();
testBooleanArray();
testByteArray();
testShortArray();
testIntArray();
testLongArray();
testFloatArray();
testDoubleArray();
testStringArray();
printf("main returning\n");
return(0);
}
-75
View File
@@ -1,75 +0,0 @@
/* testSimpleStructure.cpp */
/* Author: Marty Kraimer Date: 2010.09 */
#include <stddef.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include "requester.h"
#include "pvIntrospect.h"
#include "pvData.h"
#include "standardField.h"
using namespace epics::pvData;
static FieldCreate * pfieldCreate = 0;
static PVDataCreate *pvDataCreate = 0;
static String buffer("");
void testSimpleStructure() {
printf("\ntestSimpleStructure\n");
String secondsPastEpoch("secondsPastEpoch");
String nanoSeconds("nanoSeconds");
String timeStamp("timeStamp");
String severity("severity");
String message("message");
String alarm("alarm");
String value("value");
String top("top");
ScalarConstPtr pseconds = pfieldCreate->createScalar(
secondsPastEpoch,pvLong);
ScalarConstPtr pnano = pfieldCreate->createScalar(
nanoSeconds,pvInt);
FieldConstPtrArray fields = new FieldConstPtr[2];
fields[0] = pseconds;
fields[1] = pnano;
StructureConstPtr ptimeStamp = pfieldCreate->createStructure(
timeStamp,2,fields);
ScalarConstPtr pseverity = pfieldCreate->createScalar(
severity,pvInt);
ScalarConstPtr pmessage = pfieldCreate->createScalar(
message,pvString);
fields = new FieldConstPtr[2];
fields[0] = pseverity;
fields[1] = pmessage;
StructureConstPtr palarm = pfieldCreate->createStructure(
alarm,2,fields);
ScalarConstPtr pvalue = pfieldCreate->createScalar(
value,pvDouble);
fields = new FieldConstPtr[3];
fields[0] = ptimeStamp;
fields[1] = palarm;
fields[2] = pvalue;
StructureConstPtr ptop = pfieldCreate->createStructure(
top,3,fields);
buffer.clear();
ptop->toString(&buffer);
printf("%s\n",buffer.c_str());
PVStructure *pvStructure = pvDataCreate->createPVStructure( 0, ptop);
buffer.clear();
pvStructure->toString(&buffer);
printf("%s\n",buffer.c_str());
}
int main(int argc,char *argv[])
{
pfieldCreate = getFieldCreate();
pvDataCreate = getPVDataCreate();
testSimpleStructure();
return(0);
}
+3 -1
View File
@@ -1,5 +1,7 @@
eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*-
if $running_under_some_shell; # testIntTypes.pl
$EPICS_HOST_ARCH = "linux-x86";
system ("./testIntTypes.pl");
system ("./testPVType.pl");
system ("./testIntrospect.pl");
system ("./testPVData.pl");
system ("./testPVStructureArray.pl");
-12
View File
@@ -1,12 +0,0 @@
eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*-
if $running_under_some_shell; # testIntTypes.pl
$EPICS_HOST_ARCH = "linux-x86";
system ("rm testIntTypes");
system ("rm testIntTypesDiff");
system ("../bin/${EPICS_HOST_ARCH}/testIntTypes testIntTypes");
system ("diff testIntTypes testIntTypesGold >> testIntTypesDiff");
if(-z "testIntTypesDiff") {
print "testIntTypes OK\n";
} else {
print "testIntTypes Failed\n";
}
+285
View File
@@ -0,0 +1,285 @@
testScalar
boolean boolean true
byte byte 10
short short 10
int int 10
long long 10
float float 10
double double 10
string string 10
structure boolean
boolean value true
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
structure valueAlarm
boolean active false
int falseSeverity 0
int trueSeverity 0
int changeStateSeverity 0
structure byte
byte value 127
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
structure display
string description this is a description
string format f10.2
string units SomeUnits
structure limit
double low 0
double high 10
structure control
structure limit
double low 1
double high 9
double minStep 0
structure valueAlarm
boolean active true
byte lowAlarmLimit 1
byte lowWarningLimit 0
byte highWarningLimit 0
byte highAlarmLimit 9
int lowAlarmSeverity 2
int lowWarningSeverity 0
int highWarningSeverity 0
int highAlarmSeverity 2
byte hystersis 0
structure short
short value 32767
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
structure display
string description this is a description
string format f10.2
string units SomeUnits
structure limit
double low 0
double high 10
structure control
structure limit
double low 1
double high 9
double minStep 0
structure valueAlarm
boolean active true
short lowAlarmLimit 1
short lowWarningLimit 0
short highWarningLimit 0
short highAlarmLimit 9
int lowAlarmSeverity 2
int lowWarningSeverity 0
int highWarningSeverity 0
int highAlarmSeverity 2
short hystersis 0
structure int
int value -2147483648
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
structure display
string description this is a description
string format f10.2
string units SomeUnits
structure limit
double low 0
double high 10
structure control
structure limit
double low 1
double high 9
double minStep 0
structure valueAlarm
boolean active true
int lowAlarmLimit 1
int lowWarningLimit 0
int highWarningLimit 0
int highAlarmLimit 9
int lowAlarmSeverity 2
int lowWarningSeverity 0
int highWarningSeverity 0
int highAlarmSeverity 2
int hystersis 0
structure long
long value -9223372032559808513
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
structure display
string description this is a description
string format f10.2
string units SomeUnits
structure limit
double low 0
double high 10
structure control
structure limit
double low 1
double high 9
double minStep 0
structure valueAlarm
boolean active true
long lowAlarmLimit 1
long lowWarningLimit 0
long highWarningLimit 0
long highAlarmLimit 9
int lowAlarmSeverity 2
int lowWarningSeverity 0
int highWarningSeverity 0
int highAlarmSeverity 2
long hystersis 0
structure float
float value 1.123e+08
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
structure display
string description this is a description
string format f10.2
string units SomeUnits
structure limit
double low 0
double high 10
structure control
structure limit
double low 1
double high 9
double minStep 0
structure valueAlarm
boolean active true
float lowAlarmLimit 1
float lowWarningLimit 0
float highWarningLimit 0
float highAlarmLimit 9
int lowAlarmSeverity 2
int lowWarningSeverity 0
int highWarningSeverity 0
int highAlarmSeverity 2
float hystersis 0
structure double
double value 1.123e+35
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
structure display
string description this is a description
string format f10.2
string units SomeUnits
structure limit
double low 0
double high 10
structure control
structure limit
double low 1
double high 9
double minStep 0
structure valueAlarm
boolean active true
double lowAlarmLimit 1
double lowWarningLimit 0
double highWarningLimit 0
double highAlarmLimit 9
int lowAlarmSeverity 2
int lowWarningSeverity 0
int highWarningSeverity 0
int highAlarmSeverity 2
double hystersis 0
structure string
string value this is a string
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
testScalarArray
structure boolean
booleanArray value [true,false,true]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
structure byte
byteArray value [0,1,2]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
structure short
shortArray value [0,1,2]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
structure int
intArray value [0,1,2]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
structure long
longArray value [0,1,2]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
structure float
floatArray value [0,1,2]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
structure double
doubleArray value [0,1,2]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
structure string
stringArray value [0,1,2]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
Field: totalConstruct 388 totalDestruct 295 totalReferenceCount 93
PVField: totalConstruct 279 totalDestruct 279
+12
View File
@@ -0,0 +1,12 @@
eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*-
if $running_under_some_shell; # testPVData.pl
$EPICS_HOST_ARCH = "linux-x86";
system ("rm testPVData");
system ("rm testPVDataDiff");
system ("../bin/${EPICS_HOST_ARCH}/testPVData testPVData");
system ("diff testPVData testPVDataGold >> testPVDataDiff");
if(-z "testPVDataDiff") {
print "testPVData OK\n";
} else {
print "testPVData Failed\n";
}
+285
View File
@@ -0,0 +1,285 @@
testScalar
boolean boolean true
byte byte 10
short short 10
int int 10
long long 10
float float 10
double double 10
string string 10
structure boolean
boolean value true
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
structure valueAlarm
boolean active false
int falseSeverity 0
int trueSeverity 0
int changeStateSeverity 0
structure byte
byte value 127
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
structure display
string description this is a description
string format f10.2
string units SomeUnits
structure limit
double low 0
double high 10
structure control
structure limit
double low 1
double high 9
double minStep 0
structure valueAlarm
boolean active true
byte lowAlarmLimit 1
byte lowWarningLimit 0
byte highWarningLimit 0
byte highAlarmLimit 9
int lowAlarmSeverity 2
int lowWarningSeverity 0
int highWarningSeverity 0
int highAlarmSeverity 2
byte hystersis 0
structure short
short value 32767
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
structure display
string description this is a description
string format f10.2
string units SomeUnits
structure limit
double low 0
double high 10
structure control
structure limit
double low 1
double high 9
double minStep 0
structure valueAlarm
boolean active true
short lowAlarmLimit 1
short lowWarningLimit 0
short highWarningLimit 0
short highAlarmLimit 9
int lowAlarmSeverity 2
int lowWarningSeverity 0
int highWarningSeverity 0
int highAlarmSeverity 2
short hystersis 0
structure int
int value -2147483648
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
structure display
string description this is a description
string format f10.2
string units SomeUnits
structure limit
double low 0
double high 10
structure control
structure limit
double low 1
double high 9
double minStep 0
structure valueAlarm
boolean active true
int lowAlarmLimit 1
int lowWarningLimit 0
int highWarningLimit 0
int highAlarmLimit 9
int lowAlarmSeverity 2
int lowWarningSeverity 0
int highWarningSeverity 0
int highAlarmSeverity 2
int hystersis 0
structure long
long value -9223372032559808513
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
structure display
string description this is a description
string format f10.2
string units SomeUnits
structure limit
double low 0
double high 10
structure control
structure limit
double low 1
double high 9
double minStep 0
structure valueAlarm
boolean active true
long lowAlarmLimit 1
long lowWarningLimit 0
long highWarningLimit 0
long highAlarmLimit 9
int lowAlarmSeverity 2
int lowWarningSeverity 0
int highWarningSeverity 0
int highAlarmSeverity 2
long hystersis 0
structure float
float value 1.123e+08
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
structure display
string description this is a description
string format f10.2
string units SomeUnits
structure limit
double low 0
double high 10
structure control
structure limit
double low 1
double high 9
double minStep 0
structure valueAlarm
boolean active true
float lowAlarmLimit 1
float lowWarningLimit 0
float highWarningLimit 0
float highAlarmLimit 9
int lowAlarmSeverity 2
int lowWarningSeverity 0
int highWarningSeverity 0
int highAlarmSeverity 2
float hystersis 0
structure double
double value 1.123e+35
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
structure display
string description this is a description
string format f10.2
string units SomeUnits
structure limit
double low 0
double high 10
structure control
structure limit
double low 1
double high 9
double minStep 0
structure valueAlarm
boolean active true
double lowAlarmLimit 1
double lowWarningLimit 0
double highWarningLimit 0
double highAlarmLimit 9
int lowAlarmSeverity 2
int lowWarningSeverity 0
int highWarningSeverity 0
int highAlarmSeverity 2
double hystersis 0
structure string
string value this is a string
structure alarm
int severity 2
string message messageForAlarm
structure timeStamp
long secondsPastEpoch 123456789
int nanoSeconds 1000000
testScalarArray
structure boolean
booleanArray value [true,false,true]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
structure byte
byteArray value [0,1,2]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
structure short
shortArray value [0,1,2]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
structure int
intArray value [0,1,2]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
structure long
longArray value [0,1,2]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
structure float
floatArray value [0,1,2]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
structure double
doubleArray value [0,1,2]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
structure string
stringArray value [0,1,2]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
Field: totalConstruct 388 totalDestruct 295 totalReferenceCount 93
PVField: totalConstruct 279 totalDestruct 279
+60
View File
@@ -0,0 +1,60 @@
structure powerSupply
structureArray value
[
structure powerSupply
structure voltage
double value 0
structure alarm
int severity 0
string message
structure power
double value 0
structure alarm
int severity 0
string message
structure current
double value 0
structure alarm
int severity 0
string message ,
structure powerSupply
structure voltage
double value 0
structure alarm
int severity 0
string message
structure power
double value 0
structure alarm
int severity 0
string message
structure current
double value 0
structure alarm
int severity 0
string message ,
structure powerSupply
structure voltage
double value 0
structure alarm
int severity 0
string message
structure power
double value 0
structure alarm
int severity 0
string message
structure current
double value 0
structure alarm
int severity 0
string message
]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
Field: totalConstruct 153 totalDestruct 60 totalReferenceCount 93
PVField: totalConstruct 56 totalDestruct 56
+12
View File
@@ -0,0 +1,12 @@
eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*-
if $running_under_some_shell; # testPVStructureArray.pl
$EPICS_HOST_ARCH = "linux-x86";
system ("rm testPVStructureArray");
system ("rm testPVStructureArrayDiff");
system ("../bin/${EPICS_HOST_ARCH}/testPVStructureArray testPVStructureArray");
system ("diff testPVStructureArray testPVStructureArrayGold >> testPVStructureArrayDiff");
if(-z "testPVStructureArrayDiff") {
print "testPVStructureArray OK\n";
} else {
print "testPVStructureArray Failed\n";
}
View File
+60
View File
@@ -0,0 +1,60 @@
structure powerSupply
structureArray value
[
structure powerSupply
structure voltage
double value 0
structure alarm
int severity 0
string message
structure power
double value 0
structure alarm
int severity 0
string message
structure current
double value 0
structure alarm
int severity 0
string message ,
structure powerSupply
structure voltage
double value 0
structure alarm
int severity 0
string message
structure power
double value 0
structure alarm
int severity 0
string message
structure current
double value 0
structure alarm
int severity 0
string message ,
structure powerSupply
structure voltage
double value 0
structure alarm
int severity 0
string message
structure power
double value 0
structure alarm
int severity 0
string message
structure current
double value 0
structure alarm
int severity 0
string message
]
structure alarm
int severity 0
string message
structure timeStamp
long secondsPastEpoch 0
int nanoSeconds 0
Field: totalConstruct 153 totalDestruct 60 totalReferenceCount 93
PVField: totalConstruct 56 totalDestruct 56
+12
View File
@@ -0,0 +1,12 @@
eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*-
if $running_under_some_shell; # testPVType.pl
$EPICS_HOST_ARCH = "linux-x86";
system ("rm testPVType");
system ("rm testPVTypeDiff");
system ("../bin/${EPICS_HOST_ARCH}/testPVType testPVType");
system ("diff testPVType testPVTypeGold >> testPVTypeDiff");
if(-z "testPVTypeDiff") {
print "testPVType OK\n";
} else {
print "testPVType Failed\n";
}
View File