Main change is epicsBoolean=>bool

equuals => operator==
Additional implementation in Convert.cpp
This commit is contained in:
Marty Kraimer
2010-10-19 14:52:07 -04:00
parent 4b912a3c30
commit e5aac3b8e4
32 changed files with 689 additions and 160 deletions

1
QtC-pvData.config Normal file
View File

@@ -0,0 +1 @@
// ADD PREDEFINED MACROS HERE!

1
QtC-pvData.creator Normal file
View File

@@ -0,0 +1 @@
[General]

76
QtC-pvData.files Normal file
View File

@@ -0,0 +1,76 @@
include/AbstractPVArray.h
include/AbstractPVField.h
include/AbstractPVScalar.h
include/AbstractPVScalarArray.h
include/BasePVBoolean.h
include/BasePVBooleanArray.h
include/BasePVByte.h
include/BasePVByteArray.h
include/BasePVDouble.h
include/BasePVDoubleArray.h
include/BasePVFloat.h
include/BasePVFloatArray.h
include/BasePVInt.h
include/BasePVIntArray.h
include/BasePVLong.h
include/BasePVLongArray.h
include/BasePVShort.h
include/BasePVShortArray.h
include/BasePVString.h
include/BasePVStructure.h
include/BasePVStructureArray.h
include/bitSet.h
include/byteBuffer.h
include/convert.h
include/factory.h
include/lock.h
include/noDefaultMethods.h
include/pvData.h
include/pvIntrospect.h
include/requester.h
include/serialize.h
include/standardField.h
pvDataApp/factory/AbstractPVArray.h
pvDataApp/factory/AbstractPVField.h
pvDataApp/factory/AbstractPVScalar.h
pvDataApp/factory/AbstractPVScalarArray.h
pvDataApp/factory/BasePVBoolean.h
pvDataApp/factory/BasePVBooleanArray.h
pvDataApp/factory/BasePVByte.h
pvDataApp/factory/BasePVByteArray.h
pvDataApp/factory/BasePVDouble.h
pvDataApp/factory/BasePVDoubleArray.h
pvDataApp/factory/BasePVFloat.h
pvDataApp/factory/BasePVFloatArray.h
pvDataApp/factory/BasePVInt.h
pvDataApp/factory/BasePVIntArray.h
pvDataApp/factory/BasePVLong.h
pvDataApp/factory/BasePVLongArray.h
pvDataApp/factory/BasePVShort.h
pvDataApp/factory/BasePVShortArray.h
pvDataApp/factory/BasePVString.h
pvDataApp/factory/BasePVStringArray.h
pvDataApp/factory/BasePVStructure.h
pvDataApp/factory/BasePVStructureArray.h
pvDataApp/factory/Convert.cpp
pvDataApp/factory/factory.h
pvDataApp/factory/FieldCreateFactory.cpp
pvDataApp/factory/PVAuxInfoImpl.cpp
pvDataApp/factory/PVDataCreateFactory.cpp
pvDataApp/factory/StandardField.cpp
pvDataApp/factory/TypeFunc.cpp
pvDataApp/misc/bitSet.h
pvDataApp/misc/byteBuffer.h
pvDataApp/misc/lock.h
pvDataApp/misc/noDefaultMethods.h
pvDataApp/misc/requester.h
pvDataApp/misc/serialize.h
pvDataApp/pv/convert.h
pvDataApp/pv/pvData.h
pvDataApp/pv/pvIntrospect.h
pvDataApp/pv/standardField.h
pvDataApp/test/testIntrospect.cpp
pvDataApp/test/testPVAuxInfo.cpp
pvDataApp/test/testPVScalar.cpp
pvDataApp/test/testPVScalarArray.cpp
pvDataApp/test/testSimpleStructure.cpp

4
QtC-pvData.includes Normal file
View File

@@ -0,0 +1,4 @@
include
pvDataApp/factory
pvDataApp/misc
pvDataApp/pv

View File

@@ -16,7 +16,7 @@ namespace epics { namespace pvData {
{}
int length;
int capacity;
epicsBoolean capacityMutable;
bool capacityMutable;
};
PVArray::PVArray(PVStructure *parent,FieldConstPtr field)
@@ -51,7 +51,7 @@ namespace epics { namespace pvData {
}
epicsBoolean PVArray::isCapacityMutable()
bool PVArray::isCapacityMutable()
{
if(PVField::isImmutable()) {
return epicsFalse;
@@ -59,7 +59,7 @@ namespace epics { namespace pvData {
return pImpl->capacityMutable;
}
void PVArray::setCapacityMutable(epicsBoolean isMutable)
void PVArray::setCapacityMutable(bool isMutable)
{
if(isMutable && PVField::isImmutable()) {
PVField::message(fieldImmutable,errorMessage);

View File

@@ -22,7 +22,7 @@ static String notImplemented("not implemented");
int fieldOffset;
int nextFieldOffset;
PVAuxInfo *pvAuxInfo;
epicsBoolean immutable;
bool immutable;
Requester *requester;
PostHandler *postHandler;
};
@@ -106,7 +106,7 @@ static String notImplemented("not implemented");
return pImpl->pvAuxInfo;
}
epicsBoolean PVField::isImmutable() {return pImpl->immutable;}
bool PVField::isImmutable() {return pImpl->immutable;}
void PVField::setImmutable() {pImpl->immutable = epicsTrue;}

View File

@@ -18,17 +18,17 @@ namespace epics { namespace pvData {
public:
BasePVBoolean(PVStructure *parent,ScalarConstPtr scalar);
virtual ~BasePVBoolean();
virtual epicsBoolean get();
virtual void put(epicsBoolean val);
virtual bool get();
virtual void put(bool val);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) ;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
epicsBoolean value;
bool value;
};
BasePVBoolean::BasePVBoolean(PVStructure *parent,ScalarConstPtr scalar)
@@ -37,9 +37,9 @@ namespace epics { namespace pvData {
BasePVBoolean::~BasePVBoolean() {}
epicsBoolean BasePVBoolean::get() { return value;}
bool BasePVBoolean::get() { return value;}
void BasePVBoolean::put(epicsBoolean val){value = val;}
void BasePVBoolean::put(bool val){value = val;}
void BasePVBoolean::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher)
@@ -61,7 +61,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVBoolean::equals(PVField *pvField)
bool BasePVBoolean::operator==(PVField *pvField)
{
return getConvert()->equals(this,pvField);
}

View File

@@ -25,7 +25,7 @@ namespace epics { namespace pvData {
virtual int get(int offset, int length, BooleanArrayData *data) ;
virtual int put(int offset,int length,BooleanArray from,
int fromOffset);
virtual void shareData(epicsBoolean value[],int capacity,int length);
virtual void shareData(bool value[],int capacity,int length);
// from Serializable
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) ;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher);
@@ -33,14 +33,14 @@ namespace epics { namespace pvData {
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
epicsBoolean *value;
bool *value;
};
BasePVBooleanArray::BasePVBooleanArray(PVStructure *parent,
ScalarArrayConstPtr scalarArray)
: PVBooleanArray(parent,scalarArray),value(new epicsBoolean[0])
: PVBooleanArray(parent,scalarArray),value(new bool[0])
{ }
BasePVBooleanArray::~BasePVBooleanArray()
@@ -58,7 +58,7 @@ namespace epics { namespace pvData {
}
int length = PVArray::getLength();
if(length>capacity) length = capacity;
epicsBoolean *newValue = new epicsBoolean[capacity];
bool *newValue = new bool[capacity];
for(int i=0; i<length; i++) newValue[i] = value[i];
delete[]value;
value = newValue;
@@ -108,7 +108,7 @@ namespace epics { namespace pvData {
}
void BasePVBooleanArray::shareData(
epicsBoolean shareValue[],int capacity,int length)
bool shareValue[],int capacity,int length)
{
delete[] value;
value = shareValue;
@@ -145,7 +145,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVBooleanArray::equals(PVField *pv)
bool BasePVBooleanArray::operator==(PVField *pv)
{
return getConvert()->equals(this,pv);
}

View File

@@ -26,7 +26,7 @@ namespace epics { namespace pvData {
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
epicsInt8 value;
};
@@ -61,7 +61,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVByte::equals(PVField *pvField)
bool BasePVByte::operator==(PVField *pvField)
{
return getConvert()->equals(this,pvField);
}

View File

@@ -33,7 +33,7 @@ namespace epics { namespace pvData {
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
epicsInt8 *value;
};
@@ -145,7 +145,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVByteArray::equals(PVField *pv)
bool BasePVByteArray::operator==(PVField *pv)
{
return getConvert()->equals(this,pv);
}

View File

@@ -26,7 +26,7 @@ namespace epics { namespace pvData {
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
double value;
};
@@ -61,7 +61,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVDouble::equals(PVField *pvField)
bool BasePVDouble::operator==(PVField *pvField)
{
return getConvert()->equals(this,pvField);
}

View File

@@ -33,7 +33,7 @@ namespace epics { namespace pvData {
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
double *value;
};
@@ -145,7 +145,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVDoubleArray::equals(PVField *pv)
bool BasePVDoubleArray::operator==(PVField *pv)
{
return getConvert()->equals(this,pv);
}

View File

@@ -26,7 +26,7 @@ namespace epics { namespace pvData {
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
float value;
};
@@ -61,7 +61,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVFloat::equals(PVField *pvField)
bool BasePVFloat::operator==(PVField *pvField)
{
return getConvert()->equals(this,pvField);
}

View File

@@ -33,7 +33,7 @@ namespace epics { namespace pvData {
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
float *value;
};
@@ -145,7 +145,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVFloatArray::equals(PVField *pv)
bool BasePVFloatArray::operator==(PVField *pv)
{
return getConvert()->equals(this,pv);
}

View File

@@ -26,7 +26,7 @@ namespace epics { namespace pvData {
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
epicsInt32 value;
};
@@ -61,7 +61,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVInt::equals(PVField *pvField)
bool BasePVInt::operator==(PVField *pvField)
{
return getConvert()->equals(this,pvField);
}

View File

@@ -33,7 +33,7 @@ namespace epics { namespace pvData {
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
epicsInt32 *value;
};
@@ -145,7 +145,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVIntArray::equals(PVField *pv)
bool BasePVIntArray::operator==(PVField *pv)
{
return getConvert()->equals(this,pv);
}

View File

@@ -26,7 +26,7 @@ namespace epics { namespace pvData {
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
epicsInt64 value;
};
@@ -61,7 +61,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVLong::equals(PVField *pvField)
bool BasePVLong::operator==(PVField *pvField)
{
return getConvert()->equals(this,pvField);
}

View File

@@ -33,7 +33,7 @@ namespace epics { namespace pvData {
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
epicsInt64 *value;
};
@@ -145,7 +145,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVLongArray::equals(PVField *pv)
bool BasePVLongArray::operator==(PVField *pv)
{
return getConvert()->equals(this,pv);
}

View File

@@ -26,7 +26,7 @@ namespace epics { namespace pvData {
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
epicsInt16 value;
};
@@ -61,7 +61,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVShort::equals(PVField *pvField)
bool BasePVShort::operator==(PVField *pvField)
{
return getConvert()->equals(this,pvField);
}

View File

@@ -33,7 +33,7 @@ namespace epics { namespace pvData {
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
epicsInt16 *value;
};
@@ -145,7 +145,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVShortArray::equals(PVField *pv)
bool BasePVShortArray::operator==(PVField *pv)
{
return getConvert()->equals(this,pv);
}

View File

@@ -26,7 +26,7 @@ namespace epics { namespace pvData {
DeserializableControl *pflusher);
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
String value;
};
@@ -61,7 +61,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVString::equals(PVField *pvField)
bool BasePVString::operator==(PVField *pvField)
{
return getConvert()->equals(this,pvField);
}

View File

@@ -33,7 +33,7 @@ namespace epics { namespace pvData {
SerializableControl *pflusher, int offset, int count) ;
virtual void toString(StringBuilder buf);
virtual void toString(StringBuilder buf,int indentLevel);
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
private:
String *value;
};
@@ -145,7 +145,7 @@ namespace epics { namespace pvData {
PVField::toString(buf,indentLevel);
}
epicsBoolean BasePVStringArray::equals(PVField *pv)
bool BasePVStringArray::operator==(PVField *pv)
{
return getConvert()->equals(this,pv);
}

View File

@@ -145,7 +145,7 @@ namespace epics { namespace pvData {
throw std::logic_error(notImplemented);
}
epicsBoolean PVStructure::putExtendsStructureName(
bool PVStructure::putExtendsStructureName(
String extendsStructureName)
{
throw std::logic_error(notImplemented);
@@ -188,7 +188,7 @@ namespace epics { namespace pvData {
throw std::logic_error(notImplemented);
}
epicsBoolean PVStructure::equals(PVField *pv)
bool PVStructure::operator==(PVField *pv)
{
throw std::logic_error(notImplemented);
}

View File

@@ -93,7 +93,7 @@ namespace epics { namespace pvData {
throw std::logic_error(notImplemented);
}
epicsBoolean PVStructureArray::equals(PVField *pv)
bool PVStructureArray::operator==(PVField *pv)
{
throw std::logic_error(notImplemented);
}

View File

@@ -13,9 +13,11 @@ namespace epics { namespace pvData {
static Convert* convert = 0;
static String logicError("Logic error. Should never get here.");
static String notImplemented("not implemented");
static String illegalScalarType("Illegal ScalarType");
static epicsBoolean convertEquals(PVField *a,PVField *b);
static bool convertEquals(PVField *a,PVField *b);
static int convertFromByteArray(PVScalarArray *pv, int offset,
int len,epicsInt8 from[], int fromOffset);
static int convertToByteArray(PVScalarArray *pv, int offset,
@@ -98,7 +100,7 @@ void Convert::getFullName(StringBuilder buf,PVField * pvField)
}
}
epicsBoolean Convert::equals(PVField *a,PVField *b)
bool Convert::equals(PVField *a,PVField *b)
{
return convertEquals(a,b);
}
@@ -120,7 +122,7 @@ void Convert::fromString(PVScalar *pvScalar, String from)
switch(scalarType) {
case pvBoolean: {
PVBoolean *pv = (PVBoolean *)pvScalar;
epicsBoolean value =
bool value =
((from.compare("true")==0) ? epicsTrue : epicsFalse);
pv->put(value);
break;
@@ -176,11 +178,10 @@ void Convert::fromString(PVScalar *pvScalar, String from)
value->put(from);
break;
}
default:
String message("Convert::fromString unknown scalarType ");
ScalarTypeFunc::toString(&message,scalarType);
throw std::logic_error(message);
}
String message("Convert::fromString unknown scalarType ");
ScalarTypeFunc::toString(&message,scalarType);
throw std::logic_error(message);
}
int Convert::fromString(PVScalarArray *pv, String from)
@@ -204,18 +205,18 @@ int Convert::fromString(PVScalarArray *pv, String from)
}
int Convert::fromStringArray(PVScalarArray *pv, int offset, int length,
StringArray from, int fromOffset)
String from[], int fromOffset)
{
return convertFromStringArray(pv,offset,length,from,fromOffset);
}
int Convert::toStringArray(PVScalarArray * pv, int offset, int length,
StringArray to, int toOffset)
String to[], int toOffset)
{
return convertToStringArray(pv,offset,length,to,toOffset);
}
epicsBoolean Convert::isCopyCompatible(FieldConstPtr from, FieldConstPtr to)
bool Convert::isCopyCompatible(FieldConstPtr from, FieldConstPtr to)
{
if(from->getType()!=to->getType()) return epicsFalse;
switch(from->getType()) {
@@ -257,7 +258,7 @@ void Convert::copy(PVField *from,PVField *to)
}
}
epicsBoolean Convert::isCopyScalarCompatible(
bool Convert::isCopyScalarCompatible(
ScalarConstPtr fromField, ScalarConstPtr toField)
{
ScalarType fromScalarType = fromField->getScalarType();
@@ -273,7 +274,7 @@ epicsBoolean Convert::isCopyScalarCompatible(
void Convert::copyScalar(PVScalar *from, PVScalar *to)
{
if(to->isImmutable()) {
if(from->equals(to)) return;
if(from==to) return;
String message("Convert.copyScalar destination is immutable");
throw std::invalid_argument(message);
}
@@ -294,7 +295,7 @@ void Convert::copyScalar(PVScalar *from, PVScalar *to)
data->toString(&buf);
dataTo->put(buf);
} else {
epicsBoolean value = data->get();
bool value = data->get();
PVBoolean *dataTo = (PVBoolean*)to;
dataTo->put(value);
}
@@ -342,13 +343,12 @@ void Convert::copyScalar(PVScalar *from, PVScalar *to)
convert->fromString(to,value);
break;
}
default:
String message("Convert.copyScalar arguments are not compatible");
throw std::invalid_argument(message);
}
String message("Convert::copyScalar should never get here");
throw std::logic_error(message);
}
epicsBoolean Convert::isCopyScalarArrayCompatible(ScalarArrayConstPtr fromArray,
bool Convert::isCopyScalarArrayCompatible(ScalarArrayConstPtr fromArray,
ScalarArrayConstPtr toArray)
{
ScalarType fromType = fromArray->getElementType();
@@ -365,7 +365,7 @@ int Convert::copyScalarArray(PVScalarArray *from, int offset,
PVScalarArray *to, int toOffset, int length)
{
if(to->isImmutable()) {
if(from->equals(to)) return from->getLength();
if(from==to) return from->getLength();
String message("Convert.copyArray destination is immutable");
throw std::invalid_argument(message);
}
@@ -387,7 +387,7 @@ int Convert::copyScalarArray(PVScalarArray *from, int offset,
PVBooleanArray *pvto = (PVBooleanArray*)to;
while(length>0) {
int num = 0;
epicsBoolean *data = 0;
bool *data = 0;
int fromOffset = 0;
BooleanArrayData booleanArrayData = BooleanArrayData();
num = pvfrom->get(offset,length,&booleanArrayData);
@@ -452,7 +452,7 @@ int Convert::copyScalarArray(PVScalarArray *from, int offset,
throw std::logic_error(message);
}
epicsBoolean Convert::isCopyStructureCompatible(
bool Convert::isCopyStructureCompatible(
StructureConstPtr fromStruct, StructureConstPtr toStruct)
{
FieldConstPtrArray fromFields = fromStruct->getFields();
@@ -488,7 +488,7 @@ epicsBoolean Convert::isCopyStructureCompatible(
void Convert::copyStructure(PVStructure *from, PVStructure *to)
{
if(to->isImmutable()) {
if(from->equals(to)) return;
if(from==to) return;
String message("Convert.copyStructure destination is immutable");
throw std::invalid_argument(message);
}
@@ -556,7 +556,7 @@ void Convert::copyStructure(PVStructure *from, PVStructure *to)
}
}
epicsBoolean Convert::isCopyStructureArrayCompatible(
bool Convert::isCopyStructureArrayCompatible(
StructureArrayConstPtr from, StructureArrayConstPtr to)
{
return isCopyStructureCompatible(from->getStructure(),to->getStructure());
@@ -566,7 +566,7 @@ void Convert::copyStructureArray(
PVStructureArray *from, PVStructureArray *to)
{
if(to->isImmutable()) {
if(from->equals(to)) return;
if(from==to) return;
String message("Convert.copyStructureArray destination is immutable");
throw std::invalid_argument(message);
}
@@ -602,134 +602,560 @@ void Convert::copyStructureArray(
epicsInt8 Convert::toByte(PVScalar * pv)
{
throw std::logic_error(notImplemented);
ScalarConstPtr scalar = pv->getScalar();
ScalarType scalarType = scalar->getScalarType();
switch(scalarType) {
case pvBoolean:
throw std::logic_error(String("boolean can not be converted to byte"));
case pvByte: {
PVByte *value = (PVByte *)pv;
return value->get();
}
case pvShort: {
PVShort *value = (PVShort *)pv;
return value->get();
}
case pvInt: {
PVInt *value = (PVInt *)pv;
return value->get();
}
case pvLong: {
PVLong *value = (PVLong *)pv;
return value->get();
}
case pvFloat: {
PVFloat *value = (PVFloat *)pv;
return value->get();
}
case pvDouble: {
PVDouble *value = (PVDouble *)pv;
return value->get();
}
case pvString:
throw std::logic_error(String("string can not be converted to byte"));
}
throw std::logic_error(logicError);
}
epicsInt16 Convert::toShort(PVScalar * pv)
{
throw std::logic_error(notImplemented);
ScalarConstPtr scalar = pv->getScalar();
ScalarType scalarType = scalar->getScalarType();
switch(scalarType) {
case pvBoolean:
throw std::logic_error(String("boolean can not be converted to short"));
case pvByte: {
PVByte *value = (PVByte *)pv;
return value->get();
}
case pvShort: {
PVShort *value = (PVShort *)pv;
return value->get();
}
case pvInt: {
PVInt *value = (PVInt *)pv;
return value->get();
}
case pvLong: {
PVLong *value = (PVLong *)pv;
return value->get();
}
case pvFloat: {
PVFloat *value = (PVFloat *)pv;
return value->get();
}
case pvDouble: {
PVDouble *value = (PVDouble *)pv;
return value->get();
}
case pvString:
throw std::logic_error(String("string can not be converted to short"));
}
throw std::logic_error(logicError);
}
epicsInt32 Convert::toInt(PVScalar * pv)
{
throw std::logic_error(notImplemented);
ScalarConstPtr scalar = pv->getScalar();
ScalarType scalarType = scalar->getScalarType();
switch(scalarType) {
case pvBoolean:
throw std::logic_error(String("boolean can not be converted to int"));
case pvByte: {
PVByte *value = (PVByte *)pv;
return value->get();
}
case pvShort: {
PVShort *value = (PVShort *)pv;
return value->get();
}
case pvInt: {
PVInt *value = (PVInt *)pv;
return value->get();
}
case pvLong: {
PVLong *value = (PVLong *)pv;
return value->get();
}
case pvFloat: {
PVFloat *value = (PVFloat *)pv;
return value->get();
}
case pvDouble: {
PVDouble *value = (PVDouble *)pv;
return value->get();
}
case pvString:
throw std::logic_error(String("string can not be converted to int"));
}
throw std::logic_error(logicError);
}
epicsInt64 Convert::toLong(PVScalar * pv)
{
throw std::logic_error(notImplemented);
ScalarConstPtr scalar = pv->getScalar();
ScalarType scalarType = scalar->getScalarType();
switch(scalarType) {
case pvBoolean:
throw std::logic_error(String("boolean can not be converted to long"));
case pvByte: {
PVByte *value = (PVByte *)pv;
return value->get();
}
case pvShort: {
PVShort *value = (PVShort *)pv;
return value->get();
}
case pvInt: {
PVInt *value = (PVInt *)pv;
return value->get();
}
case pvLong: {
PVLong *value = (PVLong *)pv;
return value->get();
}
case pvFloat: {
PVFloat *value = (PVFloat *)pv;
return value->get();
}
case pvDouble: {
PVDouble *value = (PVDouble *)pv;
return value->get();
}
case pvString:
throw std::logic_error(String("string can not be converted to long"));
}
throw std::logic_error(logicError);
}
float Convert::toFloat(PVScalar * pv)
{
throw std::logic_error(notImplemented);
ScalarConstPtr scalar = pv->getScalar();
ScalarType scalarType = scalar->getScalarType();
switch(scalarType) {
case pvBoolean:
throw std::logic_error(String("boolean can not be converted to float"));
case pvByte: {
PVByte *value = (PVByte *)pv;
return value->get();
}
case pvShort: {
PVShort *value = (PVShort *)pv;
return value->get();
}
case pvInt: {
PVInt *value = (PVInt *)pv;
return value->get();
}
case pvLong: {
PVLong *value = (PVLong *)pv;
return value->get();
}
case pvFloat: {
PVFloat *value = (PVFloat *)pv;
return value->get();
}
case pvDouble: {
PVDouble *value = (PVDouble *)pv;
return value->get();
}
case pvString:
throw std::logic_error(String("string can not be converted to float"));
}
throw std::logic_error(logicError);
}
double Convert::toDouble(PVScalar * pv)
{
throw std::logic_error(notImplemented);
ScalarConstPtr scalar = pv->getScalar();
ScalarType scalarType = scalar->getScalarType();
switch(scalarType) {
case pvBoolean:
throw std::logic_error(String("boolean can not be converted to double"));
case pvByte: {
PVByte *value = (PVByte *)pv;
return value->get();
}
case pvShort: {
PVShort *value = (PVShort *)pv;
return value->get();
}
case pvInt: {
PVInt *value = (PVInt *)pv;
return value->get();
}
case pvLong: {
PVLong *value = (PVLong *)pv;
return value->get();
}
case pvFloat: {
PVFloat *value = (PVFloat *)pv;
return value->get();
}
case pvDouble: {
PVDouble *value = (PVDouble *)pv;
return value->get();
}
case pvString:
throw std::logic_error(String("string can not be converted to double"));
}
throw std::logic_error(logicError);
}
void Convert::fromByte(PVScalar *pv,epicsInt8 from)
{
throw std::logic_error(notImplemented);
ScalarConstPtr scalar = pv->getScalar();
ScalarType scalarType = scalar->getScalarType();
switch(scalarType) {
case pvBoolean:
throw std::logic_error(String("byte can not be converted to boolean"));
case pvByte: {
PVByte *value = (PVByte *)pv;
value->put(from); return;
}
case pvShort: {
PVShort *value = (PVShort *)pv;
value->put(from); return;
}
case pvInt: {
PVInt *value = (PVInt *)pv;
value->put(from); return;
}
case pvLong: {
PVLong *value = (PVLong *)pv;
value->put(from); return;
}
case pvFloat: {
PVFloat *value = (PVFloat *)pv;
value->put(from); return;
}
case pvDouble: {
PVDouble *value = (PVDouble *)pv;
value->put(from); return;
}
case pvString: {
PVString *value = (PVString *)pv;
char buffer[20];
int ival = from;
sprintf(buffer,"%d",ival);
String xxx(buffer);
value->put(xxx);
return;
}
}
throw std::logic_error(logicError);
}
void Convert::fromShort(PVScalar *pv,epicsInt16 from)
{
throw std::logic_error(notImplemented);
ScalarConstPtr scalar = pv->getScalar();
ScalarType scalarType = scalar->getScalarType();
switch(scalarType) {
case pvBoolean:
throw std::logic_error(String("short can not be converted to boolean"));
case pvByte: {
PVByte *value = (PVByte *)pv;
value->put(from); return;
}
case pvShort: {
PVShort *value = (PVShort *)pv;
value->put(from); return;
}
case pvInt: {
PVInt *value = (PVInt *)pv;
value->put(from); return;
}
case pvLong: {
PVLong *value = (PVLong *)pv;
value->put(from); return;
}
case pvFloat: {
PVFloat *value = (PVFloat *)pv;
value->put(from); return;
}
case pvDouble: {
PVDouble *value = (PVDouble *)pv;
value->put(from); return;
}
case pvString: {
PVString *value = (PVString *)pv;
char buffer[20];
int ival = from;
sprintf(buffer,"%d",ival);
String xxx(buffer);
value->put(xxx);
return;
}
}
throw std::logic_error(logicError);
}
void Convert::fromInt(PVScalar *pv, epicsInt32 from)
{
throw std::logic_error(notImplemented);
ScalarConstPtr scalar = pv->getScalar();
ScalarType scalarType = scalar->getScalarType();
switch(scalarType) {
case pvBoolean:
throw std::logic_error(String("int can not be converted to boolean"));
case pvByte: {
PVByte *value = (PVByte *)pv;
value->put(from); return;
}
case pvShort: {
PVShort *value = (PVShort *)pv;
value->put(from); return;
}
case pvInt: {
PVInt *value = (PVInt *)pv;
value->put(from); return;
}
case pvLong: {
PVLong *value = (PVLong *)pv;
value->put(from); return;
}
case pvFloat: {
PVFloat *value = (PVFloat *)pv;
value->put(from); return;
}
case pvDouble: {
PVDouble *value = (PVDouble *)pv;
value->put(from); return;
}
case pvString: {
PVString *value = (PVString *)pv;
char buffer[20];
int ival = from;
sprintf(buffer,"%d",ival);
String xxx(buffer);
value->put(xxx);
return;
}
}
throw std::logic_error(logicError);
}
void Convert::fromLong(PVScalar *pv, epicsInt64 from)
{
throw std::logic_error(notImplemented);
ScalarConstPtr scalar = pv->getScalar();
ScalarType scalarType = scalar->getScalarType();
switch(scalarType) {
case pvBoolean:
throw std::logic_error(String("long can not be converted to boolean"));
case pvByte: {
PVByte *value = (PVByte *)pv;
value->put(from); return;
}
case pvShort: {
PVShort *value = (PVShort *)pv;
value->put(from); return;
}
case pvInt: {
PVInt *value = (PVInt *)pv;
value->put(from); return;
}
case pvLong: {
PVLong *value = (PVLong *)pv;
value->put(from); return;
}
case pvFloat: {
PVFloat *value = (PVFloat *)pv;
value->put(from); return;
}
case pvDouble: {
PVDouble *value = (PVDouble *)pv;
value->put(from); return;
}
case pvString: {
PVString *value = (PVString *)pv;
char buffer[20];
long int ival = from;
sprintf(buffer,"%ld",ival);
String xxx(buffer);
value->put(xxx);
return;
}
}
throw std::logic_error(logicError);
}
void Convert::fromFloat(PVScalar* pv, float from)
{
throw std::logic_error(notImplemented);
ScalarConstPtr scalar = pv->getScalar();
ScalarType scalarType = scalar->getScalarType();
switch(scalarType) {
case pvBoolean:
throw std::logic_error(String("float can not be converted to boolean"));
case pvByte: {
PVByte *value = (PVByte *)pv;
value->put(from); return;
}
case pvShort: {
PVShort *value = (PVShort *)pv;
value->put(from); return;
}
case pvInt: {
PVInt *value = (PVInt *)pv;
value->put(from); return;
}
case pvLong: {
PVLong *value = (PVLong *)pv;
value->put(from); return;
}
case pvFloat: {
PVFloat *value = (PVFloat *)pv;
value->put(from); return;
}
case pvDouble: {
PVDouble *value = (PVDouble *)pv;
value->put(from); return;
}
case pvString: {
PVString *value = (PVString *)pv;
char buffer[20];
double dval = from;
sprintf(buffer,"%e",dval);
String xxx(buffer);
value->put(xxx);
return;
}
}
throw std::logic_error(logicError);
}
void Convert::fromDouble(PVScalar *pv, double from)
{
throw std::logic_error(notImplemented);
ScalarConstPtr scalar = pv->getScalar();
ScalarType scalarType = scalar->getScalarType();
switch(scalarType) {
case pvBoolean:
throw std::logic_error(String("double can not be converted to boolean"));
case pvByte: {
PVByte *value = (PVByte *)pv;
value->put(from); return;
}
case pvShort: {
PVShort *value = (PVShort *)pv;
value->put(from); return;
}
case pvInt: {
PVInt *value = (PVInt *)pv;
value->put(from); return;
}
case pvLong: {
PVLong *value = (PVLong *)pv;
value->put(from); return;
}
case pvFloat: {
PVFloat *value = (PVFloat *)pv;
value->put(from); return;
}
case pvDouble: {
PVDouble *value = (PVDouble *)pv;
value->put(from); return;
}
case pvString: {
PVString *value = (PVString *)pv;
char buffer[20];
double dval = from;
sprintf(buffer,"%e",dval);
String xxx(buffer);
value->put(xxx);
return;
}
}
throw std::logic_error(logicError);
}
int Convert::toByteArray(PVScalarArray * pv, int offset, int length,
epicsInt8 to[], int toOffset)
{
throw std::logic_error(notImplemented);
return convertToByteArray(pv, offset, length, to, toOffset);
}
int Convert::toShortArray(PVScalarArray * pv, int offset, int length,
epicsInt16 to[], int toOffset)
{
throw std::logic_error(notImplemented);
return convertToShortArray(pv, offset, length, to, toOffset);
}
int Convert::toIntArray(PVScalarArray * pv, int offset, int length,
epicsInt32 to[], int toOffset)
{
throw std::logic_error(notImplemented);
return convertToIntArray(pv, offset, length, to, toOffset);
}
int Convert::toLongArray(PVScalarArray * pv, int offset, int length,
epicsInt64 to[], int toOffset)
{
throw std::logic_error(notImplemented);
return convertToLongArray(pv, offset, length, to, toOffset);
}
int Convert::toFloatArray(PVScalarArray * pv, int offset, int length,
float to[], int toOffset)
{
throw std::logic_error(notImplemented);
return convertToFloatArray(pv, offset, length, to, toOffset);
}
int Convert::toDoubleArray(PVScalarArray * pv, int offset, int length,
double to[], int toOffset)
{
throw std::logic_error(notImplemented);
return convertToDoubleArray(pv, offset, length, to, toOffset);
}
int Convert::fromByteArray(PVScalarArray *pv, int offset, int length,
epicsInt8 from[], int fromOffset)
{
throw std::logic_error(notImplemented);
return convertFromByteArray(pv, offset, length, from, fromOffset);
}
int Convert::fromShortArray(PVScalarArray *pv, int offset, int length,
epicsInt16 from[], int fromOffset)
{
throw std::logic_error(notImplemented);
return convertFromShortArray(pv, offset, length, from, fromOffset);
}
int Convert::fromIntArray(PVScalarArray *pv, int offset, int length,
epicsInt32 from[], int fromOffset)
{
throw std::logic_error(notImplemented);
return convertFromIntArray(pv, offset, length, from, fromOffset);
}
int Convert::fromLongArray(PVScalarArray *pv, int offset, int length,
epicsInt64 from[], int fromOffset)
{
throw std::logic_error(notImplemented);
return convertFromLongArray(pv, offset, length, from, fromOffset);
}
int Convert::fromFloatArray(PVScalarArray *pv, int offset, int length,
float from[], int fromOffset)
{
throw std::logic_error(notImplemented);
return convertFromFloatArray(pv, offset, length, from, fromOffset);
}
int Convert::fromDoubleArray(PVScalarArray *pv, int offset, int length,
double from[], int fromOffset)
{
throw std::logic_error(notImplemented);
return convertFromDoubleArray(pv, offset, length, from, fromOffset);
}
void Convert::newLine(StringBuilder buffer, int indentLevel)
@@ -738,7 +1164,7 @@ void Convert::newLine(StringBuilder buffer, int indentLevel)
for(int i=0; i<indentLevel; i++) *buffer += " ";
}
static epicsBoolean scalarEquals(PVScalar *a,PVScalar *b)
static bool scalarEquals(PVScalar *a,PVScalar *b)
{
ScalarType ascalarType = a->getScalar()->getScalarType();
ScalarType bscalarType = b->getScalar()->getScalarType();
@@ -747,8 +1173,8 @@ static epicsBoolean scalarEquals(PVScalar *a,PVScalar *b)
case pvBoolean: {
PVBoolean *pa = (PVBoolean *)a;
PVBoolean *pb = (PVBoolean *)b;
epicsBoolean avalue = pa->get();
epicsBoolean bvalue = pb->get();
bool avalue = pa->get();
bool bvalue = pb->get();
return ((avalue==bvalue) ? epicsTrue : epicsFalse);
}
case pvByte: {
@@ -805,22 +1231,45 @@ static epicsBoolean scalarEquals(PVScalar *a,PVScalar *b)
throw std::logic_error(message);
}
static epicsBoolean arrayEquals(PVScalarArray *a,PVScalarArray *b)
static bool arrayEquals(PVScalarArray *a,PVScalarArray *b)
{
if(a==b) return epicsTrue;
ScalarType aType = a->getScalarArray()->getElementType();
ScalarType bType = b->getScalarArray()->getElementType();
if(aType!=bType) return epicsFalse;
if(a->getLength()!=b->getLength()) return epicsFalse;
int length = a->getLength();
switch(aType) {
case pvBoolean: {
PVBooleanArray *aarray = (PVBooleanArray *)a;
PVBooleanArray *barray = (PVBooleanArray *)b;
BooleanArrayData adata = BooleanArrayData();
BooleanArrayData bdata = BooleanArrayData();
aarray->get(0,length,&adata);
barray->get(0,length,&bdata);
bool *avalue = adata.data;
bool *bvalue = bdata.data;
for(int i=0; i<length; i++) {
if(avalue[i]!=bvalue[i]) return epicsFalse;
}
return epicsTrue;
}
}
String message("should not get here");
throw std::logic_error(message);
}
static bool structureArrayEquals(PVStructureArray *a,PVStructureArray *b)
{
throw std::logic_error(notImplemented);
}
static epicsBoolean structureArrayEquals(PVStructureArray *a,PVStructureArray *b)
static bool structureEquals(PVStructure *a,PVStructure *b)
{
throw std::logic_error(notImplemented);
}
static epicsBoolean structureEquals(PVStructure *a,PVStructure *b)
{
throw std::logic_error(notImplemented);
}
epicsBoolean convertEquals(PVField *a,PVField *b)
bool convertEquals(PVField *a,PVField *b)
{
if(a==b) return epicsTrue;
Type atype = a->getField()->getType();
@@ -928,7 +1377,7 @@ void convertToString(StringBuilder buffer,PVField * pv,int indentLevel)
switch(pvScalar->getScalar()->getScalarType()) {
case pvBoolean: {
PVBoolean *data = (PVBoolean*)pv;
epicsBoolean value = data->get();
bool value = data->get();
if(value) {
*buffer += "true";
} else {
@@ -1006,7 +1455,7 @@ void convertArray(StringBuilder buffer,PVScalarArray * pv,int indentLevel)
if(i!=0) *buffer += ",";
int num = pvdata->get(i,1,&data);
if(num==1) {
epicsBoolean * value = data.data;
bool * value = data.data;
if(value[data.offset]) {
*buffer += "true";
} else {

View File

@@ -22,24 +22,24 @@ namespace epics { namespace pvData {
}
epicsBoolean ScalarTypeFunc::isInteger(ScalarType type) {
bool ScalarTypeFunc::isInteger(ScalarType type) {
if(type>=pvByte && type<=pvLong) return epicsTrue;
return epicsFalse;
}
epicsBoolean ScalarTypeFunc::isNumeric(ScalarType type) {
bool ScalarTypeFunc::isNumeric(ScalarType type) {
if(type>=pvByte && type<=pvDouble) return epicsTrue;
return epicsFalse;
}
epicsBoolean ScalarTypeFunc::isPrimitive(ScalarType type) {
bool ScalarTypeFunc::isPrimitive(ScalarType type) {
if(type>=pvBoolean && type<=pvDouble) return epicsTrue;
return epicsFalse;
}
ScalarType ScalarTypeFunc::getScalarType(String pvalue) {
static String unknownString = "error unknown ScalarType";
if(pvalue.compare("epicsBooleanean")==0) return pvBoolean;
if(pvalue.compare("boolean")==0) return pvBoolean;
if(pvalue.compare("byte")==0) return pvByte;
if(pvalue.compare("short")==0) return pvShort;
if(pvalue.compare("int")==0) return pvInt;

View File

@@ -15,7 +15,7 @@ class ByteBuffer {
virtual ~ByteBuffer();
virtual int getSize() = 0;
virtual int getArrayOffset() = 0;
virtual epicsBoolean getBoolean() = 0;
virtual bool getBoolean() = 0;
virtual epicsInt8 getByte() = 0;
virtual epicsInt16 geShort() = 0;
virtual epicsInt32 getInt() = 0;
@@ -23,7 +23,7 @@ class ByteBuffer {
virtual float getFloat() = 0;
virtual double getDouble() = 0;
virtual String getString() = 0;
virtual ByteBuffer *putBoolean(epicsBoolean value) = 0;
virtual ByteBuffer *putBoolean(bool value) = 0;
virtual ByteBuffer *putByte(epicsInt8 value) = 0;
virtual ByteBuffer *geShort(epicsInt16 value) = 0;
virtual ByteBuffer *putInt(epicsInt32 value) = 0;

View File

@@ -13,28 +13,28 @@ namespace epics { namespace pvData {
Convert();
~Convert();
void getFullName(StringBuilder buf,PVField *pvField);
epicsBoolean equals(PVField *a,PVField *b);
bool equals(PVField *a,PVField *b);
void getString(StringBuilder buf,PVField * pvField,int indentLevel);
void getString(StringBuilder buf,PVField *pvField);
void fromString(PVScalar *pv, String from);
int fromString(PVScalarArray *pv, String from);
int fromStringArray(PVScalarArray *pv, int offset, int length,
StringArray from, int fromOffset);
String from[], int fromOffset);
int toStringArray(PVScalarArray *pv, int offset, int length,
StringArray to, int toOffset);
epicsBoolean isCopyCompatible(FieldConstPtr from, FieldConstPtr to);
String to[], int toOffset);
bool isCopyCompatible(FieldConstPtr from, FieldConstPtr to);
void copy(PVField *from,PVField *to);
epicsBoolean isCopyScalarCompatible(
bool isCopyScalarCompatible(
ScalarConstPtr from, ScalarConstPtr to);
void copyScalar(PVScalar *from, PVScalar *to);
epicsBoolean isCopyScalarArrayCompatible(ScalarArrayConstPtr from,
bool isCopyScalarArrayCompatible(ScalarArrayConstPtr from,
ScalarArrayConstPtr to);
int copyScalarArray(PVScalarArray *from, int offset,
PVScalarArray *to, int toOffset, int length);
epicsBoolean isCopyStructureCompatible(
bool isCopyStructureCompatible(
StructureConstPtr from, StructureConstPtr to);
void copyStructure(PVStructure *from, PVStructure *to);
epicsBoolean isCopyStructureArrayCompatible(
bool isCopyStructureArrayCompatible(
StructureArrayConstPtr from, StructureArrayConstPtr to);
void copyStructureArray(
PVStructureArray *from, PVStructureArray *to);

View File

@@ -38,8 +38,6 @@ namespace epics { namespace pvData {
class PVStructure;
class PVStructureArray;
// NOTE this prevents compiler from generating default methods for this and
// derived classes
class PVAuxInfo : private NoDefaultMethods {
@@ -72,7 +70,7 @@ namespace epics { namespace pvData {
int getNextFieldOffset() ;
int getNumberFields() ;
PVAuxInfo * getPVAuxInfo();
epicsBoolean isImmutable() ;
bool isImmutable() ;
void setImmutable();
FieldConstPtr getField() ;
PVStructure * getParent() ;
@@ -82,7 +80,7 @@ namespace epics { namespace pvData {
void setPostHandler(PostHandler *postHandler);
virtual void toString(StringBuilder buf) ;
virtual void toString(StringBuilder buf,int indentLevel) ;
virtual epicsBoolean equals(PVField *pv) = 0;
virtual bool operator==(PVField *pv) = 0;
protected:
PVField(PVStructure *parent,FieldConstPtr field);
void replaceStructure();
@@ -108,8 +106,8 @@ namespace epics { namespace pvData {
int getLength() ;
void setLength(int length);
int getCapacity() ;
epicsBoolean isCapacityMutable() ;
void setCapacityMutable(epicsBoolean isMutable);
bool isCapacityMutable() ;
void setCapacityMutable(bool isMutable);
virtual void setCapacity(int capacity) = 0;
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) = 0;
@@ -171,7 +169,7 @@ namespace epics { namespace pvData {
SerializableControl *pflusher, int offset, int count) = 0;
virtual void toString(StringBuilder buf) = 0;
virtual void toString(StringBuilder buf,int indentLevel) = 0;
virtual epicsBoolean equals(PVField *pv) = 0;
virtual bool operator==(PVField *pv) = 0;
protected:
PVStructureArray(PVStructure *parent,
StructureArrayConstPtr structureArray);
@@ -205,11 +203,11 @@ namespace epics { namespace pvData {
String fieldName,ScalarType elementType);
PVStructureArray *getStructureArrayField(String fieldName);
String getExtendsStructureName();
epicsBoolean putExtendsStructureName(
bool putExtendsStructureName(
String extendsStructureName);
virtual void toString(StringBuilder buf) ;
virtual void toString(StringBuilder buf,int indentLevel) ;
virtual epicsBoolean equals(PVField *pv) ;
virtual bool operator==(PVField *pv) ;
virtual void serialize(
ByteBuffer *pbuffer,SerializableControl *pflusher) ;
virtual void deserialize(
@@ -229,8 +227,8 @@ namespace epics { namespace pvData {
class PVBoolean : public PVScalar {
public:
virtual ~PVBoolean();
virtual epicsBoolean get() = 0;
virtual void put(epicsBoolean value) = 0;
virtual bool get() = 0;
virtual void put(bool value) = 0;
protected:
PVBoolean(PVStructure *parent,ScalarConstPtr scalar)
: PVScalar(parent,scalar) {}
@@ -315,7 +313,7 @@ namespace epics { namespace pvData {
};
typedef epicsBoolean * BooleanArray;
typedef bool * BooleanArray;
class BooleanArrayData {
public:
BooleanArray data;
@@ -329,7 +327,7 @@ namespace epics { namespace pvData {
virtual void toString(StringBuilder buf,int indentLevel) = 0 ;
virtual int get(int offset, int length, BooleanArrayData *data) = 0;
virtual int put(int offset,int length, BooleanArray from, int fromOffset) = 0;
virtual void shareData(epicsBoolean value[],int capacity,int length) = 0;
virtual void shareData(bool value[],int capacity,int length) = 0;
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) = 0;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher) = 0;
protected:

View File

@@ -48,9 +48,9 @@ namespace epics { namespace pvData {
class ScalarTypeFunc {
public:
static epicsBoolean isInteger(ScalarType type);
static epicsBoolean isNumeric(ScalarType type);
static epicsBoolean isPrimitive(ScalarType type);
static bool isInteger(ScalarType type);
static bool isNumeric(ScalarType type);
static bool isPrimitive(ScalarType type);
static ScalarType getScalarType(String value);
static void toString(StringBuilder buf,ScalarType scalarType);
};

View File

@@ -22,9 +22,9 @@ void testBoolean() {
printf("\ntestBoolean\n");
PVScalar *pvScalar = getStandardField()->scalarValue(pvBoolean);
PVBoolean *pvValue = (PVBoolean *)pvScalar;
epicsBoolean value = epicsTrue;
bool value = epicsTrue;
pvValue->put(value);
epicsBoolean getValue = pvValue->get();
bool getValue = pvValue->get();
printf("put %s get %s\n",
((value==epicsFalse) ? "false" : "true"),
((getValue==epicsFalse) ? "false" : "true"));
@@ -37,7 +37,7 @@ void testBoolean() {
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
epicsBoolean isImmutable = pvValue->isImmutable();
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==epicsFalse) ? "false" : "true"),
@@ -57,7 +57,7 @@ void testBoolean() {
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
PVScalar *other = getStandardField()->scalarValue(pvDouble);
epicsBoolean isEqual = pvScalar->equals(other);
bool isEqual = pvScalar==other;
printf("expect false isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}
@@ -77,7 +77,7 @@ void testByte() {
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
epicsBoolean isImmutable = pvValue->isImmutable();
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==epicsFalse) ? "false" : "true"),
@@ -97,7 +97,7 @@ void testByte() {
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
PVScalar *other = getStandardField()->scalarValue(pvDouble);
epicsBoolean isEqual = pvScalar->equals(other);
bool isEqual = pvScalar==other;
printf("expect false isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}
@@ -117,7 +117,7 @@ void testShort() {
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
epicsBoolean isImmutable = pvValue->isImmutable();
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==epicsFalse) ? "false" : "true"),
@@ -137,7 +137,7 @@ void testShort() {
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
PVScalar *other = getStandardField()->scalarValue(pvDouble);
epicsBoolean isEqual = pvScalar->equals(other);
bool isEqual = pvScalar==other;
printf("expect false isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}
@@ -157,7 +157,7 @@ void testInt() {
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
epicsBoolean isImmutable = pvValue->isImmutable();
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==epicsFalse) ? "false" : "true"),
@@ -177,7 +177,7 @@ void testInt() {
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
PVScalar *other = getStandardField()->scalarValue(pvDouble);
epicsBoolean isEqual = pvScalar->equals(other);
bool isEqual = pvScalar==other;
printf("expect false isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}
@@ -197,7 +197,7 @@ void testLong() {
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
epicsBoolean isImmutable = pvValue->isImmutable();
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==epicsFalse) ? "false" : "true"),
@@ -217,7 +217,7 @@ void testLong() {
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
PVScalar *other = getStandardField()->scalarValue(pvDouble);
epicsBoolean isEqual = pvScalar->equals(other);
bool isEqual = pvScalar==other;
printf("expect false isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}
@@ -237,7 +237,7 @@ void testFloat() {
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
epicsBoolean isImmutable = pvValue->isImmutable();
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==epicsFalse) ? "false" : "true"),
@@ -256,7 +256,7 @@ void testFloat() {
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
epicsBoolean isEqual = pvScalar->equals(pvScalar);
bool isEqual = pvScalar==pvScalar;
printf("expect true isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}
@@ -276,7 +276,7 @@ void testDouble() {
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
epicsBoolean isImmutable = pvValue->isImmutable();
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==epicsFalse) ? "false" : "true"),
@@ -295,7 +295,7 @@ void testDouble() {
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
epicsBoolean isEqual = pvScalar->equals(pvScalar);
bool isEqual = pvScalar==pvScalar;
printf("expect true isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}
@@ -316,7 +316,7 @@ void testString() {
buffer.clear();
field->toString(&buffer);
printf("%s\n",buffer.c_str());
epicsBoolean isImmutable = pvValue->isImmutable();
bool isImmutable = pvValue->isImmutable();
PVStructure *pvParent = pvValue->getParent();
printf("immutable %s parent %p\n",
((isImmutable==epicsFalse) ? "false" : "true"),
@@ -335,7 +335,7 @@ void testString() {
pvValue->toString(&buffer);
printf("%s\n",buffer.c_str());
pvScalar->message(String("this is a test message"),infoMessage);
epicsBoolean isEqual = pvScalar->equals(pvScalar);
bool isEqual = pvScalar==pvScalar;
printf("expect true isEqual %s\n",(isEqual ? "true" : "false"));
delete pvValue;
}

View File

@@ -24,12 +24,12 @@ void testBooleanArray() {
getStandardField()->scalarArrayValue(pvBoolean);
PVBooleanArray *pvValue = (PVBooleanArray *)pvScalarArray;
int length = 5;
epicsBoolean *value = new epicsBoolean[length];
bool *value = new bool[length];
for(int i=0; i<length; i++) value[i] = epicsTrue;
pvValue->put(0,length,value,0);
BooleanArrayData data = BooleanArrayData();
pvValue->get(0,length,&data);
epicsBoolean * getValue = data.data;
bool * getValue = data.data;
printf("(orig,get):");
for(int i=0; i< length; i++) {
printf("(%s,%s) ",