merge
This commit is contained in:
@@ -573,15 +573,15 @@ void PVStructure::deserialize(ByteBuffer *pbuffer,
|
||||
|
||||
void PVStructure::serialize(ByteBuffer *pbuffer,
|
||||
SerializableControl *pflusher, BitSet *pbitSet) const {
|
||||
size_t offset = const_cast<PVStructure*>(this)->getFieldOffset();
|
||||
size_t numberFields = const_cast<PVStructure*>(this)->getNumberFields();
|
||||
size_t next = pbitSet->nextSetBit(offset);
|
||||
size_t offset = const_cast<PVStructure*>(this)->getFieldOffset();
|
||||
int32 next = pbitSet->nextSetBit(offset);
|
||||
|
||||
// no more changes or no changes in this structure
|
||||
if(next<0||next>=offset+numberFields) return;
|
||||
if(next<0||next>=static_cast<int32>(offset+numberFields)) return;
|
||||
|
||||
// entire structure
|
||||
if(offset==next) {
|
||||
if(static_cast<int32>(offset)==next) {
|
||||
serialize(pbuffer, pflusher);
|
||||
return;
|
||||
}
|
||||
@@ -589,15 +589,16 @@ void PVStructure::serialize(ByteBuffer *pbuffer,
|
||||
for(size_t i = 0; i<numberFields; i++) {
|
||||
PVFieldPtr pvField = pvFields[i];
|
||||
offset = pvField->getFieldOffset();
|
||||
numberFields = pvField->getNumberFields();
|
||||
int32 inumberFields = pvField->getNumberFields();
|
||||
next = pbitSet->nextSetBit(offset);
|
||||
|
||||
// no more changes
|
||||
if(next<0) return;
|
||||
// no change in this pvField
|
||||
if(next>=offset+numberFields) continue;
|
||||
if(next>=static_cast<int32>(offset+inumberFields)) continue;
|
||||
|
||||
// serialize field or fields
|
||||
if(numberFields==1) {
|
||||
if(inumberFields==1) {
|
||||
pvField->serialize(pbuffer, pflusher);
|
||||
} else {
|
||||
PVStructurePtr pvStructure = std::tr1::static_pointer_cast<PVStructure>(pvField);
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace epics { namespace pvData {
|
||||
* use the following loop:
|
||||
*
|
||||
* <pre> {@code
|
||||
* for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) {
|
||||
* for (int32 i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) {
|
||||
* // operate on index i here
|
||||
* }}</pre>
|
||||
*
|
||||
|
||||
@@ -14,25 +14,25 @@
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
static bool checkBitSetPVField(
|
||||
PVField *pvField,BitSet *bitSet,int initialOffset)
|
||||
PVField *pvField,BitSet *bitSet,int32 initialOffset)
|
||||
{
|
||||
bool atLeastOneBitSet = false;
|
||||
bool allBitsSet = true;
|
||||
int offset = initialOffset;
|
||||
int nbits = pvField->getNumberFields();
|
||||
int32 offset = initialOffset;
|
||||
int32 nbits = pvField->getNumberFields();
|
||||
if(nbits==1) return bitSet->get(offset);
|
||||
int nextSetBit = bitSet->nextSetBit(offset);
|
||||
int32 nextSetBit = bitSet->nextSetBit(offset);
|
||||
if(nextSetBit>=(offset+nbits)) return false;
|
||||
if(bitSet->get(offset)) {
|
||||
if(nbits>1) {
|
||||
for(int i=offset+1; i<offset+nbits; i++) bitSet->clear(i);
|
||||
for(int32 i=offset+1; i<offset+nbits; i++) bitSet->clear(i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
PVStructure *pvStructure = static_cast<PVStructure *>(pvField);
|
||||
while(offset<initialOffset + nbits) {
|
||||
PVField *pvSubField = pvStructure->getSubField(offset).get();
|
||||
int nbitsNow = pvSubField->getNumberFields();
|
||||
int32 nbitsNow = pvSubField->getNumberFields();
|
||||
if(nbitsNow==1) {
|
||||
if(bitSet->get(offset)) {
|
||||
atLeastOneBitSet = true;
|
||||
@@ -46,7 +46,7 @@ static bool checkBitSetPVField(
|
||||
PVFieldPtrArray pvSubStructureFields =
|
||||
pvSubStructure->getPVFields();
|
||||
int num = pvSubStructure->getStructure()->getNumberFields();
|
||||
for(int i=0; i<num; i++) {
|
||||
for(int32 i=0; i<num; i++) {
|
||||
PVField *pvSubSubField = pvSubStructureFields[i].get();
|
||||
bool result = checkBitSetPVField(pvSubSubField,bitSet,offset);
|
||||
if(result) {
|
||||
@@ -63,7 +63,7 @@ static bool checkBitSetPVField(
|
||||
}
|
||||
if(allBitsSet) {
|
||||
if(nbits>1) {
|
||||
for(int i=initialOffset+1; i<initialOffset+nbits; i++){
|
||||
for(int32 i=initialOffset+1; i<initialOffset+nbits; i++){
|
||||
bitSet->clear(i);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user