added pvArray.html; made queue.h and bitSetUtil.* compatible with pvDataCPP.
This commit is contained in:
@@ -13,25 +13,31 @@
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using std::size_t;
|
||||
|
||||
static bool checkBitSetPVField(
|
||||
PVField *pvField,BitSet *bitSet,int32 initialOffset)
|
||||
PVFieldPtr const &pvField,BitSetPtr const &bitSet,int32 initialOffset)
|
||||
{
|
||||
bool atLeastOneBitSet = false;
|
||||
bool allBitsSet = true;
|
||||
int32 offset = initialOffset;
|
||||
int32 nbits = pvField->getNumberFields();
|
||||
if(nbits==1) return bitSet->get(offset);
|
||||
int32 nextSetBit = bitSet->nextSetBit(offset);
|
||||
if(nextSetBit>=(offset+nbits)) return false;
|
||||
if(nextSetBit<0) return false;
|
||||
if(bitSet->get(offset)) {
|
||||
if(nbits>1) {
|
||||
for(int32 i=offset+1; i<offset+nbits; i++) bitSet->clear(i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
PVStructure *pvStructure = static_cast<PVStructure *>(pvField);
|
||||
|
||||
bool atLeastOneBitSet = false;
|
||||
bool allBitsSet = true;
|
||||
PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField);
|
||||
offset = pvStructure->getFieldOffset() + 1;
|
||||
while(offset<initialOffset + nbits) {
|
||||
PVField *pvSubField = pvStructure->getSubField(offset).get();
|
||||
PVFieldPtr pvSubField = pvStructure->getSubField(offset);
|
||||
int32 nbitsNow = pvSubField->getNumberFields();
|
||||
if(nbitsNow==1) {
|
||||
if(bitSet->get(offset)) {
|
||||
@@ -41,24 +47,16 @@ static bool checkBitSetPVField(
|
||||
}
|
||||
offset++;
|
||||
} else {
|
||||
offset++;
|
||||
PVStructure *pvSubStructure = static_cast<PVStructure*>(pvField);
|
||||
PVFieldPtrArray pvSubStructureFields =
|
||||
pvSubStructure->getPVFields();
|
||||
int num = pvSubStructure->getStructure()->getNumberFields();
|
||||
for(int32 i=0; i<num; i++) {
|
||||
PVField *pvSubSubField = pvSubStructureFields[i].get();
|
||||
bool result = checkBitSetPVField(pvSubSubField,bitSet,offset);
|
||||
if(result) {
|
||||
atLeastOneBitSet = true;
|
||||
if(!bitSet->get(offset)) {
|
||||
allBitsSet = false;
|
||||
}
|
||||
} else {
|
||||
bool result = checkBitSetPVField(pvSubField,bitSet,offset);
|
||||
if(result) {
|
||||
atLeastOneBitSet = true;
|
||||
if(!bitSet->get(offset)) {
|
||||
allBitsSet = false;
|
||||
}
|
||||
offset += pvSubSubField->getNumberFields();
|
||||
} else {
|
||||
allBitsSet = false;
|
||||
}
|
||||
offset += pvSubField->getNumberFields();
|
||||
}
|
||||
}
|
||||
if(allBitsSet) {
|
||||
@@ -72,7 +70,7 @@ static bool checkBitSetPVField(
|
||||
return atLeastOneBitSet;
|
||||
}
|
||||
|
||||
bool BitSetUtil::compress(BitSet *bitSet,PVStructure *pvStructure)
|
||||
bool BitSetUtil::compress(BitSetPtr const &bitSet,PVStructurePtr const &pvStructure)
|
||||
{
|
||||
return checkBitSetPVField(pvStructure,bitSet,0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user