|  | Inviwo 0.9.12-pre
    Inviwo documentation | 
represents a bitset based on roaring bitmaps provided by the CRoaring library More...
#include <bitset.h>
| Classes | |
| class | BitSetIterator | 
| Public Types | |
| template<typename T> | |
| using | iterator_category = typename std::iterator_traits<T>::iterator_category | 
| template<class T> | |
| using | is_iterator = util::is_detected<iterator_category, T> | 
| Public Member Functions | |
| BitSet (std::span< const uint32_t > span) | |
| BitSet (const std::vector< bool > &v) | |
| template<typename InputIt, class = std::enable_if_t<is_iterator<InputIt>::value>> | |
| BitSet (InputIt begin, InputIt end) | |
| template<typename... Ts, class = std::enable_if_t< std::conjunction<std::is_convertible<Ts, uint32_t>...>::value>> | |
| BitSet (Ts &&... values) | |
| BitSet (const BitSet &rhs) | |
| BitSet (BitSet &&rhs) noexcept | |
| BitSet & | operator= (const BitSet &rhs) | 
| BitSet & | operator= (BitSet &&rhs) noexcept | 
| BitSetIterator | begin () const | 
| BitSetIterator | end () const | 
| uint32_t | cardinality () const | 
| size_t | size () const | 
| bool | empty () const | 
| void | clear () | 
| bool | isSubsetOf (const BitSet &b) const | 
| bool | isStrictSubsetOf (const BitSet &b) const | 
| bool | set (const BitSet &b) | 
| void | add (std::span< const uint32_t > span) | 
| void | add (const std::vector< bool > &v) | 
| template<typename InputIt, class = typename std::enable_if_t<is_iterator<InputIt>::value>> | |
| void | add (InputIt begin, InputIt end) | 
| template<typename... Ts, typename = std::enable_if_t<std::conjunction_v<std::is_convertible<Ts, uint32_t>...>>> | |
| void | add (Ts &&... values) | 
| bool | addChecked (uint32_t v) | 
| void | addRange (uint32_t min, uint32_t max) | 
| void | addRangeClosed (uint32_t min, uint32_t max) | 
| void | remove (uint32_t v) | 
| bool | removeChecked (uint32_t v) | 
| uint32_t | max () const | 
| uint32_t | min () const | 
| bool | contains (uint32_t v) const | 
| bool | containsRange (uint32_t min, uint32_t max) const | 
| void | flip (uint32_t v) | 
| void | flipRange (uint32_t min, uint32_t max) | 
| size_t | rank (uint32_t v) const | 
| bool | operator== (const BitSet &b) const | 
| bool | operator!= (const BitSet &b) const | 
| bool | intersect (const BitSet &b) const | 
| size_t | orCardinality (const BitSet &b) const | 
| size_t | andCardinality (const BitSet &b) const | 
| size_t | andNotCardinality (const BitSet &b) const | 
| size_t | xorCardinality (const BitSet &b) const | 
| double | jaccardIndex (const BitSet &b) const | 
| BitSet & | operator&= (const BitSet &b) | 
| BitSet | operator& (const BitSet &b) const | 
| BitSet & | operator-= (const BitSet &b) | 
| BitSet | operator- (const BitSet &b) const | 
| BitSet & | operator|= (const BitSet &b) | 
| BitSet | operator| (const BitSet &b) const | 
| BitSet & | operator^= (const BitSet &b) | 
| BitSet | operator^ (const BitSet &b) const | 
| std::vector< uint32_t > | toVector () const | 
| std::string | toString () const | 
| size_t | getSizeInBytes () const | 
| void | writeData (std::ostream &os) const | 
| void | readData (std::istream &is) | 
| void | optimize () | 
| void | removeRLECompression () | 
| size_t | shrinkToFit () | 
| virtual void | serialize (Serializer &s) const override | 
| virtual void | deserialize (Deserializer &d) override | 
| Static Public Member Functions | |
| static BitSet | fastUnion (std::span< const BitSet * > bitsets) | 
| Friends | |
| std::ostream & | operator<< (std::ostream &os, const BitSet &b) | 
represents a bitset based on roaring bitmaps provided by the CRoaring library
| 
 | inline | 
Add value(s) values to the bitset
| values | one or more values | 
| bool inviwo::BitSet::addChecked | ( | uint32_t | v | ) | 
Add value v to the bitset and return true on success
| v | value | 
v was added, false if it already existed in the bitset | void inviwo::BitSet::addRange | ( | uint32_t | min, | 
| uint32_t | max ) | 
Adds all values from the open range [min,max)
| min | lower bound | 
| max | upper bound (not included) | 
| void inviwo::BitSet::addRangeClosed | ( | uint32_t | min, | 
| uint32_t | max ) | 
Adds all values from the closed range [min,max]
| min | lower bound | 
| max | upper bound (included) | 
| size_t inviwo::BitSet::andCardinality | ( | const BitSet & | b | ) | const | 
Compute the cardinality of the intersection between this bitset and b 
| size_t inviwo::BitSet::andNotCardinality | ( | const BitSet & | b | ) | const | 
Compute the cardinality of the difference between this bitset and b 
| uint32_t inviwo::BitSet::cardinality | ( | ) | const | 
Return the number of elements the bitset holds
| bool inviwo::BitSet::contains | ( | uint32_t | v | ) | const | 
Checks whether v is part of the bitset
| v | value to check | 
v exists | bool inviwo::BitSet::containsRange | ( | uint32_t | min, | 
| uint32_t | max ) const | 
Checks whether the open range [min, max) is part of the bitset
| min | lower bound | 
| max | upper bound | 
min, max) exists | 
 | overridevirtual | 
Implements inviwo::Serializable.
| 
 | static | 
compute the union of multiple bitsets 
| void inviwo::BitSet::flip | ( | uint32_t | v | ) | 
Flip the value v, that is add it to the bitset if not part of it, otherwise remove it
| v | value to flip | 
| void inviwo::BitSet::flipRange | ( | uint32_t | min, | 
| uint32_t | max ) | 
Flip all bits in the open range [min, max) 
| size_t inviwo::BitSet::getSizeInBytes | ( | ) | const | 
Return the number of bytes required to serialize the bitset
| bool inviwo::BitSet::intersect | ( | const BitSet & | b | ) | const | 
Checks whether this bitset and b intersect 
| bool inviwo::BitSet::isStrictSubsetOf | ( | const BitSet & | b | ) | const | 
Check whether this bitset is a strict subset of b 
| bool inviwo::BitSet::isSubsetOf | ( | const BitSet & | b | ) | const | 
Check whether this bitset is a subset of b 
| double inviwo::BitSet::jaccardIndex | ( | const BitSet & | b | ) | const | 
Computes the Jaccard index between this bitset and b. This distance is also known as the Tanimoto distance, or the Jaccard similarity coefficient.
The Jaccard index is undefined if both bitsets are empty.
| uint32_t inviwo::BitSet::max | ( | ) | const | 
Return the largest value
| uint32_t inviwo::BitSet::min | ( | ) | const | 
Return the smallest value
| bool inviwo::BitSet::operator!= | ( | const BitSet & | b | ) | const | 
Compare whether this bitset and b are different 
| BitSet inviwo::BitSet::operator& | ( | const BitSet & | b | ) | const | 
Intersection of this bitset and b 
| BitSet & inviwo::BitSet::operator&= | ( | const BitSet & | b | ) | 
Intersection of this bitset and b 
| BitSet inviwo::BitSet::operator- | ( | const BitSet & | b | ) | const | 
Difference of this bitset and b 
| BitSet & inviwo::BitSet::operator-= | ( | const BitSet & | b | ) | 
Difference of this bitset and b 
| bool inviwo::BitSet::operator== | ( | const BitSet & | b | ) | const | 
Compare whether this bitset and b are identical 
| BitSet inviwo::BitSet::operator^ | ( | const BitSet & | b | ) | const | 
Symmetric union of this bitset and b 
| BitSet & inviwo::BitSet::operator^= | ( | const BitSet & | b | ) | 
Symmetric union of this bitset and b 
| BitSet inviwo::BitSet::operator| | ( | const BitSet & | b | ) | const | 
Union of this bitset and b 
| BitSet & inviwo::BitSet::operator|= | ( | const BitSet & | b | ) | 
Union of this bitset and b 
| void inviwo::BitSet::optimize | ( | ) | 
Optimize the bitset representation using run-length encoding based on space efficiency. Calling shrinkToFit() might result in further memory savings.
| size_t inviwo::BitSet::orCardinality | ( | const BitSet & | b | ) | const | 
Compute the cardinality of the union between this bitset and b 
| size_t inviwo::BitSet::rank | ( | uint32_t | v | ) | const | 
Return the number of values that are less or equal to v 
| void inviwo::BitSet::readData | ( | std::istream & | is | ) | 
| void inviwo::BitSet::remove | ( | uint32_t | v | ) | 
Remove value v to the bitset
| v | value | 
| bool inviwo::BitSet::removeChecked | ( | uint32_t | v | ) | 
Remove value v to the bitset and return true on success
| v | value | 
v was removed, false if it did not exist in the bitset | void inviwo::BitSet::removeRLECompression | ( | ) | 
Enforce removing the run-length encoding of the bitset even though it might be more efficient.
| 
 | overridevirtual | 
Implements inviwo::Serializable.
| bool inviwo::BitSet::set | ( | const BitSet & | b | ) | 
Replace the bitset with the contents of b, returns true if modified
this and b were different | size_t inviwo::BitSet::shrinkToFit | ( | ) | 
Reallocates the memory needed.
| size_t inviwo::BitSet::size | ( | ) | const | 
Return the number of elements the bitset holds
| std::string inviwo::BitSet::toString | ( | ) | const | 
Create a string from the bitset
| std::vector< uint32_t > inviwo::BitSet::toVector | ( | ) | const | 
Convert bitset to a std::vector holding only set elements. The output is ordered.
| void inviwo::BitSet::writeData | ( | std::ostream & | os | ) | const | 
Write this bitset to stream os. The first four byte value contains the size of the bitset in bytes followed by the binary encoding. 
| size_t inviwo::BitSet::xorCardinality | ( | const BitSet & | b | ) | const | 
Compute the cardinality of the symmetric difference between this bitset and b