Browse Source

Cosmetic changes in BitVector.

Pro: Better documentation, fewer compiler warnings.
Contra: Recompilation of 400 files.
tempestpy_adaptions
Matthias Volk 5 years ago
parent
commit
9fc473383f
  1. 5
      src/storm/storage/BitVector.cpp
  2. 30
      src/storm/storage/BitVector.h

5
src/storm/storage/BitVector.cpp

@ -1,17 +1,14 @@
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
#include <bitset>
#include "storm/storage/BitVector.h" #include "storm/storage/BitVector.h"
#include "storm/exceptions/InvalidArgumentException.h"
#include "storm/exceptions/OutOfRangeException.h"
#include "storm/storage/BoostTypes.h" #include "storm/storage/BoostTypes.h"
#include "storm/utility/OsDetection.h" #include "storm/utility/OsDetection.h"
#include "storm/utility/Hash.h" #include "storm/utility/Hash.h"
#include "storm/utility/macros.h" #include "storm/utility/macros.h"
#include <bitset>
#ifdef STORM_DEV #ifdef STORM_DEV
#define ASSERT_BITVECTOR #define ASSERT_BITVECTOR

30
src/storm/storage/BitVector.h

@ -99,12 +99,12 @@ namespace storm {
uint_fast64_t endIndex; uint_fast64_t endIndex;
}; };
/*
/*!
* Constructs an empty bit vector of length 0. * Constructs an empty bit vector of length 0.
*/ */
BitVector(); BitVector();
/*
/*!
* Deconstructs a bit vector by deleting the underlying storage. * Deconstructs a bit vector by deleting the underlying storage.
*/ */
~BitVector(); ~BitVector();
@ -196,7 +196,7 @@ namespace storm {
* @param index The index where to set the truth value. * @param index The index where to set the truth value.
* @param value The truth value to set. * @param value The truth value to set.
*/ */
void set(const uint_fast64_t index, bool value = true);
void set(uint_fast64_t index, bool value = true);
/*! /*!
* Sets all bits in the given iterator range [first, last). * Sets all bits in the given iterator range [first, last).
@ -223,7 +223,7 @@ namespace storm {
* @param index The index of the bit to access. * @param index The index of the bit to access.
* @return True iff the bit at the given index is set. * @return True iff the bit at the given index is set.
*/ */
bool get(const uint_fast64_t index) const;
bool get(uint_fast64_t index) const;
/*! /*!
* Resizes the bit vector to hold the given new number of bits. If the bit vector becomes smaller this way, * Resizes the bit vector to hold the given new number of bits. If the bit vector becomes smaller this way,
@ -295,12 +295,15 @@ namespace storm {
BitVector operator^(BitVector const& other) const; BitVector operator^(BitVector const& other) const;
/*! /*!
* Computes a bit vector that is as long as the number of set bits in the given filter that has bit i is set
* iff the i-th set bit of the current bit vector is set in the filter.
* Computes a bit vector that contains only the values of the bits given by the filter.
* The returned bit vector is as long as the number of set bits in the given filter.
* Bit i is set in the returned bit vector iff the i-th set bit of the current bit vector is set in the filter.
* *
* @param filter A reference the bit vector to use as the filter.
* @return A bit vector that is as long as the number of set bits in the given filter that has bit i is set
* iff the i-th set bit of the current bit vector is set in the filter.
* For example: 00100110 % 10101010 returns 0101
*
* @param filter A reference bit vector to use as the filter.
* @return A bit vector that is as long as the number of set bits in the given filter and
* contains only the values of the bits set in the filter.
*/ */
BitVector operator%(BitVector const& filter) const; BitVector operator%(BitVector const& filter) const;
@ -479,7 +482,7 @@ namespace storm {
*/ */
const_iterator end() const; const_iterator end() const;
/*
/*!
* Retrieves the index of the bit that is the next bit set to true in the bit vector. If there is none, * Retrieves the index of the bit that is the next bit set to true in the bit vector. If there is none,
* this function returns the number of bits this vector holds in total. Put differently, if the return * this function returns the number of bits this vector holds in total. Put differently, if the return
* value is equal to a call to size(), then there is no bit set after the specified position. * value is equal to a call to size(), then there is no bit set after the specified position.
@ -490,7 +493,7 @@ namespace storm {
*/ */
uint_fast64_t getNextSetIndex(uint_fast64_t startingIndex) const; uint_fast64_t getNextSetIndex(uint_fast64_t startingIndex) const;
/*
/*!
* Retrieves the index of the bit that is the next bit set to false in the bit vector. If there is none, * Retrieves the index of the bit that is the next bit set to false in the bit vector. If there is none,
* this function returns the number of bits this vector holds in total. Put differently, if the return * this function returns the number of bits this vector holds in total. Put differently, if the return
* value is equal to a call to size(), then there is no unset bit after the specified position. * value is equal to a call to size(), then there is no unset bit after the specified position.
@ -501,7 +504,7 @@ namespace storm {
*/ */
uint_fast64_t getNextUnsetIndex(uint_fast64_t startingIndex) const; uint_fast64_t getNextUnsetIndex(uint_fast64_t startingIndex) const;
/*
/*!
* Compare two intervals [start1, start1+length] and [start2, start2+length] and swap them if the second * Compare two intervals [start1, start1+length] and [start2, start2+length] and swap them if the second
* one is larger than the first one. After the method the intervals are sorted in decreasing order. * one is larger than the first one. After the method the intervals are sorted in decreasing order.
* *
@ -513,6 +516,7 @@ namespace storm {
bool compareAndSwap(uint_fast64_t start1, uint_fast64_t start2, uint_fast64_t length); bool compareAndSwap(uint_fast64_t start1, uint_fast64_t start2, uint_fast64_t length);
friend std::ostream& operator<<(std::ostream& out, BitVector const& bitVector); friend std::ostream& operator<<(std::ostream& out, BitVector const& bitVector);
friend struct std::hash<storm::storage::BitVector>; friend struct std::hash<storm::storage::BitVector>;
friend struct FNV1aBitVectorHash; friend struct FNV1aBitVectorHash;
@ -600,7 +604,7 @@ namespace storm {
} // namespace storm } // namespace storm
namespace std { namespace std {
template <>
template<>
struct hash<storm::storage::BitVector> { struct hash<storm::storage::BitVector> {
std::size_t operator()(storm::storage::BitVector const& bv) const; std::size_t operator()(storm::storage::BitVector const& bv) const;
}; };

Loading…
Cancel
Save