Except for serialization all pv classes are implemented
This commit is contained in:
@@ -12,7 +12,7 @@ namespace epics { namespace pvData {
|
||||
|
||||
class PVArrayPvt {
|
||||
public:
|
||||
PVArrayPvt() : length(0),capacity(0),capacityMutable(epicsTrue)
|
||||
PVArrayPvt() : length(0),capacity(0),capacityMutable(true)
|
||||
{}
|
||||
int length;
|
||||
int capacity;
|
||||
@@ -54,7 +54,7 @@ namespace epics { namespace pvData {
|
||||
bool PVArray::isCapacityMutable()
|
||||
{
|
||||
if(PVField::isImmutable()) {
|
||||
return epicsFalse;
|
||||
return false;
|
||||
}
|
||||
return pImpl->capacityMutable;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ namespace epics { namespace pvData {
|
||||
PVField::message(fieldImmutable,errorMessage);
|
||||
return;
|
||||
}
|
||||
if(pImpl->capacityMutable==epicsFalse) {
|
||||
if(pImpl->capacityMutable==false) {
|
||||
PVField::message(capacityImmutable,errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ PVFieldPvt::PVFieldPvt(PVStructure *parent,FieldConstPtr field)
|
||||
: parent(parent),field(field),
|
||||
fieldOffset(0), nextFieldOffset(0),
|
||||
pvAuxInfo(0),
|
||||
immutable(epicsFalse),requester(0),postHandler(0)
|
||||
immutable(false),requester(0),postHandler(0)
|
||||
{
|
||||
delete pvAuxInfo;
|
||||
field->incReferenceCount();
|
||||
@@ -107,7 +107,7 @@ return pImpl->pvAuxInfo;
|
||||
|
||||
bool PVField::isImmutable() {return pImpl->immutable;}
|
||||
|
||||
void PVField::setImmutable() {pImpl->immutable = epicsTrue;}
|
||||
void PVField::setImmutable() {pImpl->immutable = true;}
|
||||
|
||||
FieldConstPtr PVField::getField() {return pImpl->field;}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace epics { namespace pvData {
|
||||
};
|
||||
|
||||
BasePVBoolean::BasePVBoolean(PVStructure *parent,ScalarConstPtr scalar)
|
||||
: PVBoolean(parent,scalar),value(epicsFalse)
|
||||
: PVBoolean(parent,scalar),value(false)
|
||||
{}
|
||||
|
||||
BasePVBoolean::~BasePVBoolean() {}
|
||||
|
||||
@@ -51,8 +51,8 @@ namespace epics { namespace pvData {
|
||||
|
||||
void BasePVDoubleArray::setCapacity(int capacity)
|
||||
{
|
||||
if(PVArray::getCapacity()==capacity) return;
|
||||
if(!PVArray::isCapacityMutable()) {
|
||||
if(getCapacity()==capacity) return;
|
||||
if(!isCapacityMutable()) {
|
||||
std::string message("not capacityMutable");
|
||||
PVField::message(message, errorMessage);
|
||||
return;
|
||||
@@ -63,7 +63,7 @@ namespace epics { namespace pvData {
|
||||
for(int i=0; i<length; i++) newValue[i] = value[i];
|
||||
delete[]value;
|
||||
value = newValue;
|
||||
PVArray::setCapacityLength(capacity,length);
|
||||
setCapacityLength(capacity,length);
|
||||
}
|
||||
|
||||
int BasePVDoubleArray::get(int offset, int len, DoubleArrayData *data)
|
||||
|
||||
@@ -495,10 +495,9 @@ namespace epics { namespace pvData {
|
||||
PVFieldPtrArray bFields = b->getPVFields();
|
||||
PVFieldPtrArray pvFields = pImpl->pvFields;
|
||||
int len = b->getNumberFields();
|
||||
if (len == pImpl->numberFields) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (!(pvFields[i]==bFields[i])) return false;
|
||||
}
|
||||
if(len!=pImpl->numberFields) return false;
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (!(pvFields[i]==bFields[i])) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,117 +10,177 @@
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
class PVStructureArrayPvt {
|
||||
public:
|
||||
PVStructureArrayPvt(StructureArrayConstPtr structureArray);
|
||||
~PVStructureArrayPvt();
|
||||
|
||||
StructureArrayConstPtr structureArray;
|
||||
StructureArrayData *structureArrayData;
|
||||
PVStructurePtrArray pvStructureArray;
|
||||
};
|
||||
PVStructureArrayPvt::PVStructureArrayPvt(
|
||||
StructureArrayConstPtr structureArray)
|
||||
: structureArray(structureArray),
|
||||
structureArrayData(new StructureArrayData()),
|
||||
pvStructureArray(new PVStructurePtr[0])
|
||||
{}
|
||||
|
||||
PVStructureArrayPvt::~PVStructureArrayPvt()
|
||||
{
|
||||
delete structureArrayData;
|
||||
delete pvStructureArray;
|
||||
}
|
||||
|
||||
|
||||
PVStructureArray::PVStructureArray(PVStructure *parent,
|
||||
StructureArrayConstPtr structureArray)
|
||||
: PVArray(parent,structureArray),
|
||||
pImpl(new PVStructureArrayPvt(structureArray))
|
||||
{
|
||||
}
|
||||
: PVArray(parent,structureArray)
|
||||
{}
|
||||
|
||||
PVStructureArray::~PVStructureArray()
|
||||
{
|
||||
delete pImpl;
|
||||
}
|
||||
|
||||
StructureArrayConstPtr PVStructureArray::getStructureArray()
|
||||
{
|
||||
return pImpl->structureArray;
|
||||
}
|
||||
|
||||
int PVStructureArray::get(
|
||||
int offset, int length, StructureArrayData *data)
|
||||
{
|
||||
throw std::logic_error(notImplemented);
|
||||
}
|
||||
|
||||
int PVStructureArray::put(int offset,int length,
|
||||
PVStructurePtrArray from, int fromOffset)
|
||||
{
|
||||
throw std::logic_error(notImplemented);
|
||||
}
|
||||
|
||||
void PVStructureArray::shareData(
|
||||
PVStructurePtrArray value,int capacity,int length)
|
||||
{
|
||||
throw std::logic_error(notImplemented);
|
||||
}
|
||||
|
||||
void PVStructureArray::toString(StringBuilder buf) {toString(buf,0);}
|
||||
|
||||
void PVStructureArray::toString(StringBuilder buf,int indentLevel)
|
||||
{
|
||||
throw std::logic_error(notImplemented);
|
||||
}
|
||||
|
||||
void PVStructureArray::serialize(
|
||||
ByteBuffer *pbuffer,SerializableControl *pflusher)
|
||||
{
|
||||
throw std::logic_error(notImplemented);
|
||||
}
|
||||
|
||||
void PVStructureArray::deserialize(
|
||||
ByteBuffer *pbuffer,DeserializableControl *pflusher)
|
||||
{
|
||||
throw std::logic_error(notImplemented);
|
||||
}
|
||||
|
||||
void PVStructureArray::serialize(ByteBuffer *pbuffer,
|
||||
SerializableControl *pflusher, int offset, int count)
|
||||
{
|
||||
throw std::logic_error(notImplemented);
|
||||
}
|
||||
|
||||
bool PVStructureArray::operator==(PVField *pv)
|
||||
{
|
||||
throw std::logic_error(notImplemented);
|
||||
}
|
||||
|
||||
bool PVStructureArray::operator!=(PVField *pv)
|
||||
{
|
||||
throw std::logic_error(notImplemented);
|
||||
}
|
||||
PVStructureArray::~PVStructureArray() {}
|
||||
|
||||
class BasePVStructureArray : public PVStructureArray {
|
||||
public:
|
||||
BasePVStructureArray(PVStructure *parent,
|
||||
StructureArrayConstPtr structureArray);
|
||||
~BasePVStructureArray();
|
||||
virtual ~BasePVStructureArray();
|
||||
virtual StructureArrayConstPtr getStructureArray();
|
||||
virtual void setCapacity(int capacity);
|
||||
virtual int get(int offset, int length,
|
||||
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);
|
||||
virtual void serialize(ByteBuffer *pbuffer,
|
||||
SerializableControl *pflusher);
|
||||
virtual void deserialize(ByteBuffer *buffer,
|
||||
DeserializableControl *pflusher);
|
||||
virtual void serialize(ByteBuffer *pbuffer,
|
||||
SerializableControl *pflusher, int offset, int count);
|
||||
private:
|
||||
StructureArrayConstPtr structureArray;
|
||||
StructureArrayData *structureArrayData;
|
||||
PVStructurePtrArray value;
|
||||
};
|
||||
|
||||
|
||||
BasePVStructureArray::BasePVStructureArray(
|
||||
PVStructure *parent,StructureArrayConstPtr structureArray)
|
||||
: PVStructureArray(parent,structureArray) {}
|
||||
: PVStructureArray(parent,structureArray),
|
||||
structureArray(structureArray),
|
||||
structureArrayData(new StructureArrayData()),
|
||||
value(new PVStructurePtr[0])
|
||||
{}
|
||||
|
||||
BasePVStructureArray::~BasePVStructureArray() {}
|
||||
BasePVStructureArray::~BasePVStructureArray()
|
||||
{
|
||||
delete structureArrayData;
|
||||
delete[] value;
|
||||
}
|
||||
|
||||
void BasePVStructureArray::setCapacity(int capacity) {
|
||||
if(getCapacity()==capacity) return;
|
||||
if(!isCapacityMutable()) {
|
||||
std::string message("not capacityMutable");
|
||||
PVField::message(message, errorMessage);
|
||||
return;
|
||||
}
|
||||
int length = PVArray::getLength();
|
||||
PVStructurePtrArray newValue = new PVStructurePtr[capacity];
|
||||
int limit = length;
|
||||
if(length>capacity) limit = capacity;
|
||||
for(int i=0; i<limit; i++) newValue[i] = value[i];
|
||||
for(int i=limit; i<capacity; i++) newValue[i] = 0;
|
||||
if(length>capacity) length = capacity;
|
||||
delete[] value;
|
||||
value = newValue;
|
||||
setCapacityLength(capacity,length);
|
||||
}
|
||||
|
||||
|
||||
StructureArrayConstPtr BasePVStructureArray::getStructureArray()
|
||||
{
|
||||
return structureArray;
|
||||
}
|
||||
|
||||
int BasePVStructureArray::get(
|
||||
int offset, int len, StructureArrayData *data)
|
||||
{
|
||||
int n = len;
|
||||
int length = getLength();
|
||||
if(offset+len > length) {
|
||||
n = length - offset;
|
||||
if(n<0) n = 0;
|
||||
}
|
||||
data->data = value;
|
||||
data->offset = offset;
|
||||
return n;
|
||||
}
|
||||
|
||||
int BasePVStructureArray::put(int offset,int len,
|
||||
PVStructurePtrArray from, int fromOffset)
|
||||
{
|
||||
if(isImmutable()) {
|
||||
message(String("field is immutable"), errorMessage);
|
||||
return 0;
|
||||
}
|
||||
if(from==value) return len;
|
||||
if(len<1) return 0;
|
||||
int length = getLength();
|
||||
int capacity = getCapacity();
|
||||
if(offset+len > length) {
|
||||
int newlength = offset + len;
|
||||
if(newlength>capacity) {
|
||||
setCapacity(newlength);
|
||||
newlength = capacity;
|
||||
len = newlength - offset;
|
||||
if(len<=0) return 0;
|
||||
}
|
||||
length = newlength;
|
||||
setLength(length);
|
||||
}
|
||||
StructureConstPtr structure = structureArray->getStructure();
|
||||
for(int i=0; i<len; i++) {
|
||||
PVStructurePtr frompv = from[i+fromOffset];
|
||||
if(frompv==0) {
|
||||
value[i+offset] = 0;
|
||||
continue;
|
||||
}
|
||||
if(frompv->getStructure()!=structure) {
|
||||
throw std::invalid_argument(String(
|
||||
"Element is not a compatible structure"));
|
||||
}
|
||||
value[i+offset] = frompv;
|
||||
}
|
||||
postPut();
|
||||
return len;
|
||||
}
|
||||
|
||||
void BasePVStructureArray::shareData(
|
||||
PVStructurePtrArray value,int capacity,int length)
|
||||
{
|
||||
this->value = value;
|
||||
setCapacity(capacity);
|
||||
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)
|
||||
{
|
||||
throw std::logic_error(notImplemented);
|
||||
}
|
||||
|
||||
void BasePVStructureArray::deserialize(
|
||||
ByteBuffer *pbuffer,DeserializableControl *pflusher)
|
||||
{
|
||||
throw std::logic_error(notImplemented);
|
||||
}
|
||||
|
||||
void BasePVStructureArray::serialize(ByteBuffer *pbuffer,
|
||||
SerializableControl *pflusher, int offset, int count)
|
||||
{
|
||||
throw std::logic_error(notImplemented);
|
||||
}
|
||||
|
||||
bool BasePVStructureArray::operator==(PVField *pvField)
|
||||
{
|
||||
return getConvert()->equals(this,pvField);
|
||||
}
|
||||
|
||||
bool BasePVStructureArray::operator!=(PVField *pvField)
|
||||
{
|
||||
return !(getConvert()->equals(this,pvField));
|
||||
}
|
||||
|
||||
}}
|
||||
#endif /* BASEPVSTRUCTUREARRAY_H */
|
||||
|
||||
@@ -66,7 +66,7 @@ static std::vector<String> split(String commaSeparatedList);
|
||||
static std::vector<String> split(String commaSeparatedList) {
|
||||
String::size_type numValues = 1;
|
||||
String::size_type index=0;
|
||||
while(epicsTrue) {
|
||||
while(true) {
|
||||
String::size_type pos = commaSeparatedList.find(',',index);
|
||||
if(pos==String::npos) break;
|
||||
numValues++;
|
||||
@@ -125,7 +125,7 @@ void Convert::fromString(PVScalar *pvScalar, String from)
|
||||
case pvBoolean: {
|
||||
PVBoolean *pv = (PVBoolean *)pvScalar;
|
||||
bool value =
|
||||
((from.compare("true")==0) ? epicsTrue : epicsFalse);
|
||||
((from.compare("true")==0) ? true : false);
|
||||
pv->put(value);
|
||||
break;
|
||||
}
|
||||
@@ -220,7 +220,7 @@ int Convert::toStringArray(PVScalarArray * pv, int offset, int length,
|
||||
|
||||
bool Convert::isCopyCompatible(FieldConstPtr from, FieldConstPtr to)
|
||||
{
|
||||
if(from->getType()!=to->getType()) return epicsFalse;
|
||||
if(from->getType()!=to->getType()) return false;
|
||||
switch(from->getType()) {
|
||||
case scalar:
|
||||
return isCopyScalarCompatible((ScalarConstPtr)from,(ScalarConstPtr)to);
|
||||
@@ -265,12 +265,12 @@ bool Convert::isCopyScalarCompatible(
|
||||
{
|
||||
ScalarType fromScalarType = fromField->getScalarType();
|
||||
ScalarType toScalarType = toField->getScalarType();
|
||||
if(fromScalarType==toScalarType) return epicsTrue;
|
||||
if(fromScalarType==toScalarType) return true;
|
||||
if(ScalarTypeFunc::isNumeric(fromScalarType)
|
||||
&& ScalarTypeFunc::isNumeric(toScalarType)) return epicsTrue;
|
||||
if(fromScalarType==pvString) return epicsTrue;
|
||||
if(toScalarType==pvString) return epicsTrue;
|
||||
return epicsFalse;
|
||||
&& ScalarTypeFunc::isNumeric(toScalarType)) return true;
|
||||
if(fromScalarType==pvString) return true;
|
||||
if(toScalarType==pvString) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void Convert::copyScalar(PVScalar *from, PVScalar *to)
|
||||
@@ -355,12 +355,12 @@ bool Convert::isCopyScalarArrayCompatible(ScalarArrayConstPtr fromArray,
|
||||
{
|
||||
ScalarType fromType = fromArray->getElementType();
|
||||
ScalarType toType = toArray->getElementType();
|
||||
if(fromType==toType) return epicsTrue;
|
||||
if(fromType==toType) return true;
|
||||
if(ScalarTypeFunc::isNumeric(fromType)
|
||||
&& ScalarTypeFunc::isNumeric(toType)) return epicsTrue;
|
||||
if(toType==pvString) return epicsTrue;
|
||||
if(fromType==pvString) return epicsTrue;
|
||||
return epicsFalse;
|
||||
&& ScalarTypeFunc::isNumeric(toType)) return true;
|
||||
if(toType==pvString) return true;
|
||||
if(fromType==pvString) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int Convert::copyScalarArray(PVScalarArray *from, int offset,
|
||||
@@ -460,31 +460,31 @@ bool Convert::isCopyStructureCompatible(
|
||||
FieldConstPtrArray fromFields = fromStruct->getFields();
|
||||
FieldConstPtrArray toFields = toStruct->getFields();
|
||||
int length = fromStruct->getNumberFields();
|
||||
if(length!=toStruct->getNumberFields()) return epicsFalse;
|
||||
if(length!=toStruct->getNumberFields()) return false;
|
||||
for(int i=0; i<length; i++) {
|
||||
FieldConstPtr from = fromFields[i];
|
||||
FieldConstPtr to = toFields[i];
|
||||
Type fromType = from->getType();
|
||||
Type toType = to->getType();
|
||||
if(fromType!=toType) return epicsFalse;
|
||||
if(fromType!=toType) return false;
|
||||
switch(fromType) {
|
||||
case scalar:
|
||||
if(!convert->isCopyScalarCompatible((ScalarConstPtr)from,(ScalarConstPtr)to)) return epicsFalse;
|
||||
if(!convert->isCopyScalarCompatible((ScalarConstPtr)from,(ScalarConstPtr)to)) return false;
|
||||
break;
|
||||
case scalarArray:
|
||||
if(!isCopyScalarArrayCompatible((ScalarArrayConstPtr)from,(ScalarArrayConstPtr)to))
|
||||
return epicsFalse;
|
||||
return false;
|
||||
break;
|
||||
case structure:
|
||||
if(!isCopyStructureCompatible((StructureConstPtr)from,(StructureConstPtr)to))
|
||||
return epicsFalse;
|
||||
return false;
|
||||
break;
|
||||
case structureArray:
|
||||
if(!isCopyStructureArrayCompatible((StructureArrayConstPtr)from,
|
||||
(StructureArrayConstPtr)to)) return epicsFalse;
|
||||
(StructureArrayConstPtr)to)) return false;
|
||||
}
|
||||
}
|
||||
return epicsTrue;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Convert::copyStructure(PVStructure *from, PVStructure *to)
|
||||
@@ -1170,63 +1170,63 @@ static bool scalarEquals(PVScalar *a,PVScalar *b)
|
||||
{
|
||||
ScalarType ascalarType = a->getScalar()->getScalarType();
|
||||
ScalarType bscalarType = b->getScalar()->getScalarType();
|
||||
if(ascalarType!=bscalarType) return epicsFalse;
|
||||
if(ascalarType!=bscalarType) return false;
|
||||
switch(ascalarType) {
|
||||
case pvBoolean: {
|
||||
PVBoolean *pa = (PVBoolean *)a;
|
||||
PVBoolean *pb = (PVBoolean *)b;
|
||||
bool avalue = pa->get();
|
||||
bool bvalue = pb->get();
|
||||
return ((avalue==bvalue) ? epicsTrue : epicsFalse);
|
||||
return ((avalue==bvalue) ? true : false);
|
||||
}
|
||||
case pvByte: {
|
||||
PVByte *pa = (PVByte *)a;
|
||||
PVByte *pb = (PVByte *)b;
|
||||
epicsInt8 avalue = pa->get();
|
||||
epicsInt8 bvalue = pb->get();
|
||||
return ((avalue==bvalue) ? epicsTrue : epicsFalse);
|
||||
return ((avalue==bvalue) ? true : false);
|
||||
}
|
||||
case pvShort: {
|
||||
PVShort *pa = (PVShort *)a;
|
||||
PVShort *pb = (PVShort *)b;
|
||||
epicsInt16 avalue = pa->get();
|
||||
epicsInt16 bvalue = pb->get();
|
||||
return ((avalue==bvalue) ? epicsTrue : epicsFalse);
|
||||
return ((avalue==bvalue) ? true : false);
|
||||
}
|
||||
case pvInt: {
|
||||
PVInt *pa = (PVInt *)a;
|
||||
PVInt *pb = (PVInt *)b;
|
||||
epicsInt32 avalue = pa->get();
|
||||
epicsInt32 bvalue = pb->get();
|
||||
return ((avalue==bvalue) ? epicsTrue : epicsFalse);
|
||||
return ((avalue==bvalue) ? true : false);
|
||||
}
|
||||
case pvLong: {
|
||||
PVLong *pa = (PVLong *)a;
|
||||
PVLong *pb = (PVLong *)b;
|
||||
epicsInt64 avalue = pa->get();
|
||||
epicsInt64 bvalue = pb->get();
|
||||
return ((avalue==bvalue) ? epicsTrue : epicsFalse);
|
||||
return ((avalue==bvalue) ? true : false);
|
||||
}
|
||||
case pvFloat: {
|
||||
PVFloat *pa = (PVFloat *)a;
|
||||
PVFloat *pb = (PVFloat *)b;
|
||||
float avalue = pa->get();
|
||||
float bvalue = pb->get();
|
||||
return ((avalue==bvalue) ? epicsTrue : epicsFalse);
|
||||
return ((avalue==bvalue) ? true : false);
|
||||
}
|
||||
case pvDouble: {
|
||||
PVDouble *pa = (PVDouble *)a;
|
||||
PVDouble *pb = (PVDouble *)b;
|
||||
double avalue = pa->get();
|
||||
double bvalue = pb->get();
|
||||
return ((avalue==bvalue) ? epicsTrue : epicsFalse);
|
||||
return ((avalue==bvalue) ? true : false);
|
||||
}
|
||||
case pvString: {
|
||||
PVString *pa = (PVString *)a;
|
||||
PVString *pb = (PVString *)b;
|
||||
String avalue = pa->get();
|
||||
String bvalue = pb->get();
|
||||
return ((avalue==bvalue) ? epicsTrue : epicsFalse);
|
||||
return ((avalue==bvalue) ? true : false);
|
||||
}
|
||||
}
|
||||
String message("should not get here");
|
||||
@@ -1235,11 +1235,11 @@ static bool scalarEquals(PVScalar *a,PVScalar *b)
|
||||
|
||||
static bool arrayEquals(PVScalarArray *a,PVScalarArray *b)
|
||||
{
|
||||
if(a==b) return epicsTrue;
|
||||
if(a==b) return true;
|
||||
ScalarType aType = a->getScalarArray()->getElementType();
|
||||
ScalarType bType = b->getScalarArray()->getElementType();
|
||||
if(aType!=bType) return epicsFalse;
|
||||
if(a->getLength()!=b->getLength()) return epicsFalse;
|
||||
if(aType!=bType) return false;
|
||||
if(a->getLength()!=b->getLength()) return false;
|
||||
int length = a->getLength();
|
||||
switch(aType) {
|
||||
case pvBoolean: {
|
||||
@@ -1252,9 +1252,9 @@ static bool arrayEquals(PVScalarArray *a,PVScalarArray *b)
|
||||
BooleanArray avalue = adata.data;
|
||||
BooleanArray bvalue = bdata.data;
|
||||
for(int i=0; i<length; i++) {
|
||||
if(avalue[i]!=bvalue[i]) return epicsFalse;
|
||||
if(avalue[i]!=bvalue[i]) return false;
|
||||
}
|
||||
return epicsTrue;
|
||||
return true;
|
||||
}
|
||||
case pvByte: {
|
||||
PVByteArray *aarray = (PVByteArray *)a;
|
||||
@@ -1266,9 +1266,9 @@ static bool arrayEquals(PVScalarArray *a,PVScalarArray *b)
|
||||
ByteArray avalue = adata.data;
|
||||
ByteArray bvalue = bdata.data;
|
||||
for(int i=0; i<length; i++) {
|
||||
if(avalue[i]!=bvalue[i]) return epicsFalse;
|
||||
if(avalue[i]!=bvalue[i]) return false;
|
||||
}
|
||||
return epicsTrue;
|
||||
return true;
|
||||
}
|
||||
case pvShort: {
|
||||
PVShortArray *aarray = (PVShortArray *)a;
|
||||
@@ -1280,9 +1280,9 @@ static bool arrayEquals(PVScalarArray *a,PVScalarArray *b)
|
||||
ShortArray avalue = adata.data;
|
||||
ShortArray bvalue = bdata.data;
|
||||
for(int i=0; i<length; i++) {
|
||||
if(avalue[i]!=bvalue[i]) return epicsFalse;
|
||||
if(avalue[i]!=bvalue[i]) return false;
|
||||
}
|
||||
return epicsTrue;
|
||||
return true;
|
||||
}
|
||||
case pvInt: {
|
||||
PVIntArray *aarray = (PVIntArray *)a;
|
||||
@@ -1294,9 +1294,9 @@ static bool arrayEquals(PVScalarArray *a,PVScalarArray *b)
|
||||
IntArray avalue = adata.data;
|
||||
IntArray bvalue = bdata.data;
|
||||
for(int i=0; i<length; i++) {
|
||||
if(avalue[i]!=bvalue[i]) return epicsFalse;
|
||||
if(avalue[i]!=bvalue[i]) return false;
|
||||
}
|
||||
return epicsTrue;
|
||||
return true;
|
||||
}
|
||||
case pvLong: {
|
||||
PVLongArray *aarray = (PVLongArray *)a;
|
||||
@@ -1308,9 +1308,9 @@ static bool arrayEquals(PVScalarArray *a,PVScalarArray *b)
|
||||
LongArray avalue = adata.data;
|
||||
LongArray bvalue = bdata.data;
|
||||
for(int i=0; i<length; i++) {
|
||||
if(avalue[i]!=bvalue[i]) return epicsFalse;
|
||||
if(avalue[i]!=bvalue[i]) return false;
|
||||
}
|
||||
return epicsTrue;
|
||||
return true;
|
||||
}
|
||||
case pvFloat: {
|
||||
PVFloatArray *aarray = (PVFloatArray *)a;
|
||||
@@ -1322,9 +1322,9 @@ static bool arrayEquals(PVScalarArray *a,PVScalarArray *b)
|
||||
FloatArray avalue = adata.data;
|
||||
FloatArray bvalue = bdata.data;
|
||||
for(int i=0; i<length; i++) {
|
||||
if(avalue[i]!=bvalue[i]) return epicsFalse;
|
||||
if(avalue[i]!=bvalue[i]) return false;
|
||||
}
|
||||
return epicsTrue;
|
||||
return true;
|
||||
}
|
||||
case pvDouble: {
|
||||
PVDoubleArray *aarray = (PVDoubleArray *)a;
|
||||
@@ -1336,9 +1336,9 @@ static bool arrayEquals(PVScalarArray *a,PVScalarArray *b)
|
||||
DoubleArray avalue = adata.data;
|
||||
DoubleArray bvalue = bdata.data;
|
||||
for(int i=0; i<length; i++) {
|
||||
if(avalue[i]!=bvalue[i]) return epicsFalse;
|
||||
if(avalue[i]!=bvalue[i]) return false;
|
||||
}
|
||||
return epicsTrue;
|
||||
return true;
|
||||
}
|
||||
case pvString: {
|
||||
PVStringArray *aarray = (PVStringArray *)a;
|
||||
@@ -1350,9 +1350,9 @@ static bool arrayEquals(PVScalarArray *a,PVScalarArray *b)
|
||||
String *avalue = adata.data;
|
||||
String *bvalue = bdata.data;
|
||||
for(int i=0; i<length; i++) {
|
||||
if(avalue[i]!=bvalue[i]) return epicsFalse;
|
||||
if(avalue[i]!=bvalue[i]) return false;
|
||||
}
|
||||
return epicsTrue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
String message("should not get here");
|
||||
@@ -1399,10 +1399,12 @@ static bool structureEquals(PVStructure *a,PVStructure *b)
|
||||
|
||||
bool convertEquals(PVField *a,PVField *b)
|
||||
{
|
||||
if(a==b) return epicsTrue;
|
||||
void * avoid = (void *)a;
|
||||
void * bvoid = (void *)b;
|
||||
if(avoid==bvoid) return true;
|
||||
Type atype = a->getField()->getType();
|
||||
Type btype = b->getField()->getType();
|
||||
if(atype!=btype) return epicsFalse;
|
||||
if(atype!=btype) return false;
|
||||
if(atype==scalar) return scalarEquals((PVScalar *)a,(PVScalar *)b);
|
||||
if(atype==scalarArray) {
|
||||
return arrayEquals((PVScalarArray *)a,(PVScalarArray *)b);
|
||||
|
||||
@@ -23,18 +23,18 @@ namespace epics { namespace pvData {
|
||||
|
||||
|
||||
bool ScalarTypeFunc::isInteger(ScalarType type) {
|
||||
if(type>=pvByte && type<=pvLong) return epicsTrue;
|
||||
return epicsFalse;
|
||||
if(type>=pvByte && type<=pvLong) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScalarTypeFunc::isNumeric(ScalarType type) {
|
||||
if(type>=pvByte && type<=pvDouble) return epicsTrue;
|
||||
return epicsFalse;
|
||||
if(type>=pvByte && type<=pvDouble) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScalarTypeFunc::isPrimitive(ScalarType type) {
|
||||
if(type>=pvBoolean && type<=pvDouble) return epicsTrue;
|
||||
return epicsFalse;
|
||||
if(type>=pvBoolean && type<=pvDouble) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
ScalarType ScalarTypeFunc::getScalarType(String pvalue) {
|
||||
|
||||
@@ -157,27 +157,23 @@ namespace epics { namespace pvData {
|
||||
class PVStructureArray : public PVArray {
|
||||
public:
|
||||
virtual ~PVStructureArray();
|
||||
virtual StructureArrayConstPtr getStructureArray();
|
||||
virtual StructureArrayConstPtr getStructureArray() = 0;
|
||||
virtual void setCapacity(int capacity) = 0;
|
||||
virtual int get(int offset, int length,
|
||||
StructureArrayData *data);
|
||||
StructureArrayData *data) = 0;
|
||||
virtual int put(int offset,int length,
|
||||
PVStructurePtrArray from, int fromOffset);
|
||||
virtual void shareData( PVStructurePtrArray value,int capacity,int length);
|
||||
PVStructurePtrArray from, int fromOffset) = 0;
|
||||
virtual void shareData( PVStructurePtrArray value,int capacity,int length) = 0;
|
||||
virtual void serialize(ByteBuffer *pbuffer,
|
||||
SerializableControl *pflusher) ;
|
||||
SerializableControl *pflusher) = 0 ;
|
||||
virtual void deserialize(ByteBuffer *buffer,
|
||||
DeserializableControl *pflusher);
|
||||
DeserializableControl *pflusher) = 0;
|
||||
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);
|
||||
SerializableControl *pflusher, int offset, int count) = 0;
|
||||
protected:
|
||||
PVStructureArray(PVStructure *parent,
|
||||
StructureArrayConstPtr structureArray);
|
||||
private:
|
||||
class PVStructureArrayPvt *pImpl;
|
||||
};
|
||||
|
||||
typedef PVField* PVFieldPtr;
|
||||
@@ -330,6 +326,7 @@ namespace epics { namespace pvData {
|
||||
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;
|
||||
virtual void shareData(BooleanArray value,int capacity,int length) = 0;
|
||||
@@ -353,6 +350,7 @@ namespace epics { namespace pvData {
|
||||
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;
|
||||
virtual void shareData(ByteArray value,int capacity,int length) = 0;
|
||||
@@ -376,6 +374,7 @@ namespace epics { namespace pvData {
|
||||
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;
|
||||
virtual void shareData(ShortArray value,int capacity,int length) = 0;
|
||||
@@ -398,6 +397,7 @@ namespace epics { namespace pvData {
|
||||
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;
|
||||
virtual void shareData(IntArray value,int capacity,int length)= 0;
|
||||
@@ -421,6 +421,7 @@ namespace epics { namespace pvData {
|
||||
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;
|
||||
virtual void shareData(LongArray value,int capacity,int length)= 0;
|
||||
@@ -444,6 +445,7 @@ namespace epics { namespace pvData {
|
||||
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;
|
||||
virtual void shareData(FloatArray value,int capacity,int length)= 0;
|
||||
@@ -469,6 +471,7 @@ namespace epics { namespace pvData {
|
||||
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;
|
||||
virtual void shareData(DoubleArray value,int capacity,int length) = 0;
|
||||
@@ -492,6 +495,7 @@ namespace epics { namespace pvData {
|
||||
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;
|
||||
virtual void shareData(StringArray value,int capacity,int length)= 0;
|
||||
|
||||
Reference in New Issue
Block a user