diff --git a/pvDataApp/misc/bitSet.cpp b/pvDataApp/misc/bitSet.cpp index 8169aff..31d6414 100644 --- a/pvDataApp/misc/bitSet.cpp +++ b/pvDataApp/misc/bitSet.cpp @@ -374,5 +374,20 @@ namespace epics { namespace pvData { words[i] |= (buffer->getByte() & 0xffL) << (8 * j); } + + epicsShareExtern std::ostream& operator<<(std::ostream& o, const BitSet& b) + { + o << '{'; + int32 i = b.nextSetBit(0); + if (i != -1) { + o << i; + for (i = b.nextSetBit(i+1); i >= 0; i = b.nextSetBit(i+1)) { + int32 endOfRun = b.nextClearBit(i); + do { o << ", " << i; } while (++i < endOfRun); + } + } + o << '}'; + return o; + } }}; diff --git a/pvDataApp/misc/bitSet.h b/pvDataApp/misc/bitSet.h index ae7357c..be6f231 100644 --- a/pvDataApp/misc/bitSet.h +++ b/pvDataApp/misc/bitSet.h @@ -317,6 +317,8 @@ namespace epics { namespace pvData { static uint32 bitCount(uint64 i); }; + + epicsShareExtern std::ostream& operator<<(std::ostream& o, const BitSet& b); }} #endif /* BITSET_H */