|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Contiguous array of bits. More...
#include <bitArray.H>
Classes | |
| class | BitProxy |
| class | Iterator |
Public Types | |
| using | Item_Type = unsigned int |
| Type returned by Iterator::get_curr() - individual bits as unsigned int. | |
| using | iterator = __iterator< BitArray > |
| using | const_iterator = __const_iterator< BitArray > |
Public Member Functions | |
| BitArray (const size_t dim=0) | |
| Bit array constructor. | |
| BitArray (const size_t dim, const unsigned int value) | |
| Build a BitArray of size dim with all bits set to value. | |
| void | reserve (const size_t dim) |
| Reserve memory in advance for the bit array dim dimension. | |
| constexpr size_t | size () const noexcept |
| Returns the dimension of the bit array. | |
| void | set_size (const size_t sz) |
| Resets the dimension of the array. | |
| int | operator[] (const size_t i) const |
| BitProxy | operator[] (const size_t i) noexcept |
| int | read_bit_ne (const size_t i) const noexcept |
| int | read_bit (const size_t i) const |
| Read bit i. | |
| int | operator() (const size_t i) const |
| void | write_bit (const size_t i, const unsigned int value) |
| Write bit i with the value. | |
| int | read (const size_t i) const |
| Quick read of bit i. | |
| void | write (const size_t i, const unsigned int value) |
| Writes bit i with value without memory check. | |
| int | fast_read (const size_t i) const noexcept |
| Read bit i without any check. | |
| void | fast_write (const size_t i, const unsigned int value) |
| Write bit i without checking i. | |
| void | push (const unsigned int value) |
| Inserts the value at the end of the array. | |
| void | pop () |
| Removes the last bit of the array. | |
| void | empty () noexcept |
| Delete all inserted bits. | |
| BitArray (const BitArray &array) | |
| Copy constructor. | |
| void | swap (BitArray &array) noexcept |
| BitArray (BitArray &&array) noexcept | |
| Move constructor; it allocates nothing. | |
| BitArray & | operator= (BitArray &&array) noexcept |
| DynList< char > | bits_list () const |
| Converts it to a list. | |
| BitArray & | operator= (const BitArray &array) |
| Bit array allocation. | |
| void | save (std::ostream &output) const |
| Saves the bit sequence in a text file. | |
| void | load (std::istream &input) |
| Loads an array of bits saved with save(). | |
| BitArray (std::ifstream &input) | |
| Build a new array of bits from a file constructed using the save() method. | |
| void | save_in_array_of_chars (const std::string &name, std::ostream &output) const |
| Saves a static string declaration to a text file. | |
| void | load_from_array_of_chars (const unsigned char str[], const size_t num_bits) |
| Reads an array of bits saved in a character array. | |
| void | left_shift (const size_t n=1) |
| Shifts the bits n positions to the left. | |
| void | right_shift (const size_t n=1) |
| Shifts the bits n positions to the right. | |
| void | dyn_left_shift (const size_t n=1) |
| Shifts bits n positions to the left dynamically. | |
| void | dyn_right_shift (const size_t n=1) |
| Shifts bits n positions to the right dynamically. | |
| void | circular_left_shift (const size_t n=1) |
| Shifts the bits n positions to the left circularly. | |
| void | circular_right_shift (const size_t n=1) |
| Shifts the bits n positions to the right circularly. | |
| template<typename T > | |
| void | set_num (T n) |
| void | set_num (const char &c) |
| void | set_num (const short &c) |
| void | set_num (const int &c) |
| void | set_num (const long &c) |
| unsigned long | get_unum () const noexcept |
| long | get_num () const noexcept |
| void | set_bit_str (const std::string &str) |
| std::string | get_bit_str () const |
| std::string | to_string () const |
| BitArray (const unsigned char str[], const size_t num_bits) | |
| Constructs a new array of bits from an array of characters previously generated with load_from_array_of_chars. | |
| BitArray & | operator|= (const BitArray &rhs) |
| BitArray & | operator&= (const BitArray &rhs) |
| bool | operator== (const BitArray &rhs) const |
| auto | get_it () const noexcept |
| template<class Operation > | |
| bool | traverse (Operation &operation) const |
| template<class Operation > | |
| bool | traverse (Operation &operation) |
| template<class Operation > | |
| bool | traverse (Operation &&operation=Operation()) const |
| template<class Operation > | |
| bool | traverse (Operation &&operation=Operation()) |
| template<template< typename > class Container = DynList> | |
| Container< unsigned int > | items () const |
| iterator | begin () noexcept |
| iterator | end () noexcept |
| const_iterator | begin () const noexcept |
| const_iterator | end () const noexcept |
| const_iterator | cbegin () const noexcept |
| const_iterator | cend () const noexcept |
| const_iterator | cbegin () noexcept |
| const_iterator | cend () noexcept |
| int | count_ones () const noexcept |
| int | count_zeros () const noexcept |
Public Member Functions inherited from Aleph::FunctionalMixin< BitArray, unsigned int > | |
| auto | for_each (Operation &operation) const -> decltype(self()) |
| Apply an operation to each element (read-only). | |
| auto | for_each (Operation &operation) -> decltype(self()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| auto | for_each (Operation &&operation=Operation()) const -> decltype(self()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| auto | for_each (Operation &&operation=Operation()) -> decltype(self()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| auto | mutable_for_each (Operation &operation) -> decltype(self()) |
| Apply an operation to each element (mutable). | |
| auto | mutable_for_each (Operation &&operation=Operation()) -> decltype(self()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| bool | all (Operation &operation) const |
| Test if all elements satisfy a predicate. | |
| bool | all (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| bool | forall (Operation &operation) const |
| Alias for all(). | |
| bool | forall (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| bool | exists (Operation &operation) const |
| Test if any element satisfies a predicate. | |
| bool | exists (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| Container< concepts_detail::map_result_t< R, Operation &, unsigned int > > | maps (Operation &operation) const |
| Container< concepts_detail::map_result_t< R, Operation &, unsigned int > > | maps (Operation &&operation=Operation()) const |
| Acc | foldl (const Acc &init, std::function< Acc(const Acc &, const unsigned int &)> operation) const |
| Left fold (reduce) with initial value. | |
| Acc | fold_left (std::function< Acc(const Acc &, const unsigned int &)> operation, const Acc &init) const |
| Left fold with operation first (alternative signature). | |
| unsigned int | fold (const unsigned int &init, Operation &operation) const |
| Simple fold with same type for accumulator and elements. | |
| unsigned int | fold (const unsigned int &init, Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| DynList< unsigned int > | filter (Operation &operation) const |
| Filter elements by a predicate. | |
| DynList< unsigned int > | filter (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| DynList< std::tuple< unsigned int, size_t > > | pfilter (Operation &operation) const |
| Filter with position information. | |
| DynList< std::tuple< unsigned int, size_t > > | pfilter (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| std::pair< DynList< unsigned int >, DynList< unsigned int > > | partition (Operation &op) const |
| Partition elements by a predicate. | |
| std::pair< DynList< unsigned int >, DynList< unsigned int > > | partition (Operation &&op=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| std::tuple< DynList< unsigned int >, DynList< unsigned int > > | tpartition (Operation &op) const |
| Partition returning tuple instead of pair. | |
| std::tuple< DynList< unsigned int >, DynList< unsigned int > > | tpartition (Operation &&op=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| size_t | length () const noexcept |
| Count the number of elements. | |
| Container< unsigned int > | rev () const |
| Create a reversed copy. | |
| Container< unsigned int > | take (const size_t n) const |
| Take the first n elements. | |
| Container< unsigned int > | drop (const size_t n) const |
| Skip the first n elements. | |
| unsigned int | sum (const unsigned int &init=unsigned int {}) const |
| Compute the sum of all elements. | |
| unsigned int | product (const unsigned int &init) const |
| Compute the product of all elements. | |
| const unsigned int * | min () const |
| Find the minimum element. | |
| const unsigned int * | max () const |
| Find the maximum element. | |
| const unsigned int * | min_by (Compare cmp) const |
| Find the minimum element using a custom comparator. | |
| const unsigned int * | max_by (Compare cmp) const |
| Find the maximum element using a custom comparator. | |
| bool | has_value (const unsigned int &val) const |
| Check if container has a value. | |
| bool | none (Predicate &pred) const |
| Check if no element satisfies a predicate. | |
| bool | none (Predicate &&pred) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| size_t | count_if (Predicate pred) const |
| Count elements satisfying a predicate. | |
| const unsigned int * | first () const |
| Get the first element. | |
| unsigned int | first_or (const unsigned int &default_val) const |
| Get the first element or a default value. | |
| const unsigned int * | last () const |
| Get the last element. | |
| unsigned int | last_or (const unsigned int &default_val) const |
| Get the last element or a default value. | |
| Container< std::pair< size_t, unsigned int > > | enumerate () const |
| Enumerate elements with their indices. | |
| size_t | find_index (Predicate pred) const |
| Find the index of the first element satisfying a predicate. | |
| size_t | index_of (const unsigned int &val) const |
| Find the index of a specific value. | |
| Container< unsigned int > | unique () const |
| Remove consecutive duplicate elements. | |
| Container< unsigned int > | unique_by (EqPred eq) const |
| Remove consecutive duplicates using a custom equality predicate. | |
| Container< unsigned int > | intersperse (const unsigned int &sep) const |
| Intersperse a separator between elements. | |
| Container< Container< unsigned int > > | chunk (size_t n) const |
| Split into chunks of fixed size. | |
| Container< Container< unsigned int > > | sliding (size_t size, size_t step=1) const |
| Create sliding windows of fixed size. | |
| std::vector< unsigned int > | to_vector () const |
| Convert to std::vector. | |
| DynListType | to_dynlist () const |
| Convert container to DynList. | |
| StringType | join (const StringType &sep=StringType{", "}) const |
| Join elements into a string with separator. | |
| std::string | join_str (const std::string &sep=", ") const |
| Join string elements with separator. | |
| Container< std::pair< unsigned int, typename Other::Item_Type > > | zip_with (const Other &other) const |
| Zip with another container. | |
Private Member Functions | |
| void | clear_unused_bits_in_last_byte () noexcept |
| void | ensure_num_bytes (const size_t num_bytes) |
| size_t | get_num_bytes () const noexcept |
| template<class Operation > | |
| bool | __traverse (Operation &operation) |
Private Attributes | |
| size_t | current_size |
| DynArray< Byte > | array_of_bytes |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const BitArray &array) |
| BitArray | operator| (const BitArray &op1, const BitArray &op2) |
| BitArray | operator& (const BitArray &op1, const BitArray &op2) |
| const_iterator | cbegin (const BitArray &s) noexcept |
| const_iterator | cend (const BitArray &s) noexcept |
| const_iterator | begin (const BitArray &s) noexcept |
| const_iterator | end (const BitArray &s) noexcept |
| iterator | begin (BitArray &s) noexcept |
| iterator | end (BitArray &s) noexcept |
Additional Inherited Members | |
Public Attributes inherited from Aleph::FunctionalMixin< BitArray, unsigned int > | |
| and | |
| Transform elements using a mapping function. | |
Protected Member Functions inherited from Aleph::FunctionalMixin< BitArray, unsigned int > | |
| const BitArray & | self () const noexcept |
| BitArray & | self () noexcept |
Contiguous array of bits.
BitArray defines a contiguous array of bits. The consumption of memory is proportional to n/8; where n is the number of bits that you want to manage.
The array is dynamic, which means it can expand dynamically according to need.
Access to the ith bit can be done using the operator []. However, since this kind of access is implemented using a proxy class, access may fail in some expressions where the compiler cannot carry out the appropriate type transformations.
Definition at line 200 of file bitArray.H.
Definition at line 1210 of file bitArray.H.
| using Aleph::BitArray::Item_Type = unsigned int |
Type returned by Iterator::get_curr() - individual bits as unsigned int.
Definition at line 307 of file bitArray.H.
| using Aleph::BitArray::iterator = __iterator< BitArray > |
Definition at line 1210 of file bitArray.H.
|
inline |
Bit array constructor.
| [in] | dim | number of bits. By default, it is 256. |
| bad_alloc | if there is not enough memory for a block continuous dim/8 bytes. |
Definition at line 315 of file bitArray.H.
References array_of_bytes.
|
inline |
Build a BitArray of size dim with all bits set to value.
Definition at line 322 of file bitArray.H.
References dim(), value, and write_bit().
|
inline |
Copy constructor.
Instantiates an array of bits exact copy of array.
| [in] | array | the array of bits to be copied. |
| bad_alloc | if there is not enough memory for a block continuous dim/8 bytes. |
Definition at line 535 of file bitArray.H.
|
inlinenoexcept |
Move constructor; it allocates nothing.
It takes the bytes of array. It does not build an empty array first, which allocates a directory: without memory for it, a constructor that is noexcept would end the program.
| [in,out] | array | the source, left empty and reusable. |
Definition at line 555 of file bitArray.H.
|
inline |
Build a new array of bits from a file constructed using the save() method.
Definition at line 698 of file bitArray.H.
References load().
|
inline |
Constructs a new array of bits from an array of characters previously generated with load_from_array_of_chars.
Definition at line 1004 of file bitArray.H.
References load_from_array_of_chars().
|
inlineprivate |
Definition at line 1095 of file bitArray.H.
References current_size, and read_bit().
Referenced by traverse(), and traverse().
|
inlinenoexcept |
Definition at line 1210 of file bitArray.H.
|
inlinenoexcept |
Definition at line 1210 of file bitArray.H.
|
inline |
Converts it to a list.
Definition at line 570 of file bitArray.H.
References Aleph::DynList< T >::append(), current_size, and read_bit().
|
inlinenoexcept |
Definition at line 1210 of file bitArray.H.
|
inlinenoexcept |
Definition at line 1210 of file bitArray.H.
|
inlinenoexcept |
Definition at line 1210 of file bitArray.H.
|
inlinenoexcept |
Definition at line 1210 of file bitArray.H.
|
inline |
Shifts the bits n positions to the left circularly.
The bits are shifted without losing any, the first n bits They begin to occupy the last n positions in the arrangement.
| [in] | n | the number of positions to shift the bits. |
Definition at line 863 of file bitArray.H.
References current_size, read_bit(), and write_bit().
|
inline |
Shifts the bits n positions to the right circularly.
The bits are shifted without losing any, the last n bits They come to occupy the first n positions in the arrangement.
| [in] | n | the number of positions to shift the bits. |
Definition at line 892 of file bitArray.H.
References current_size, read_bit(), and write_bit().
|
inlineprivatenoexcept |
Definition at line 205 of file bitArray.H.
References array_of_bytes, current_size, Aleph::Byte::get_int(), and Aleph::Byte::set_int().
Referenced by dyn_right_shift(), load(), load_from_array_of_chars(), operator&=(), Aleph::BitArray::BitProxy::operator=(), Aleph::BitArray::BitProxy::operator=(), operator|=(), pop(), set_size(), write(), and write_bit().
|
inlinenoexcept |
Definition at line 1212 of file bitArray.H.
|
inlinenoexcept |
Definition at line 1217 of file bitArray.H.
|
inline |
Shifts bits n positions to the left dynamically.
The bits are shifted without losing any and the array grows adding n zeros to the right.
| [in] | n | the number of positions to shift the bits. |
Definition at line 822 of file bitArray.H.
References push().
|
inline |
Shifts bits n positions to the right dynamically.
The bits are shifted without losing any and the array is decremented. eliminating the n zeros that would be on the left
| [in] | n | the number of positions to shift the bits. |
Definition at line 835 of file bitArray.H.
References clear_unused_bits_in_last_byte(), current_size, read_bit(), set_size(), and write_bit().
|
inlinenoexcept |
Delete all inserted bits.
Definition at line 521 of file bitArray.H.
References array_of_bytes, and current_size.
Referenced by set_bit_str(), and set_num().
|
inlinenoexcept |
Definition at line 1210 of file bitArray.H.
|
inlinenoexcept |
Definition at line 1210 of file bitArray.H.
|
inlineprivate |
|
inlinenoexcept |
Read bit i without any check.
| [in] | i | index of the bit. |
Definition at line 482 of file bitArray.H.
References array_of_bytes, and current_size.
Referenced by Aleph::Bloom_Filter< T >::contains(), Aleph::Compact_Quotient_Filter< T >::get_bit_at(), Aleph::Compact_Quotient_Filter< T >::get_rem(), and Aleph::Compact_Quotient_Filter< T >::slot_empty().
|
inline |
Write bit i without checking i.
It does not change size().
| [in] | i | index of the bit. |
| [in] | value | 0 or 1. |
| out_of_range | if value is neither 0 nor 1. |
Definition at line 498 of file bitArray.H.
References ah_out_of_range_error_if, array_of_bytes, current_size, and value.
Referenced by Aleph::Compact_Quotient_Filter< T >::clear(), Aleph::Bloom_Filter< T >::insert(), Aleph::Compact_Quotient_Filter< T >::set_bit_at(), and Aleph::Compact_Quotient_Filter< T >::set_rem().
|
inline |
Definition at line 981 of file bitArray.H.
References current_size, and read_bit().
Referenced by TEST(), to_string(), and Moved_From_Case< BitArray >::use().
|
inlinenoexcept |
Definition at line 1180 of file bitArray.H.
|
inlinenoexcept |
Definition at line 961 of file bitArray.H.
References get_unum().
|
inlineprivatenoexcept |
Definition at line 235 of file bitArray.H.
References current_size.
Referenced by operator&=(), operator|=(), pop(), save(), and save_in_array_of_chars().
|
inlinenoexcept |
Definition at line 949 of file bitArray.H.
References current_size, and read_bit_ne().
Referenced by get_num().
|
inline |
Definition at line 1208 of file bitArray.H.
|
inline |
Shifts the bits n positions to the left.
The bits are shifted and the array is considered a fixed size, that is, the first n bits are lost.
| [in] | n | the number of positions to shift the bits. |
Definition at line 786 of file bitArray.H.
References current_size, read_bit(), and write_bit().
|
inline |
Loads an array of bits saved with save().
load(input) reads the header that save() writes, the number of bytes and the number of bits, then the bytes, and restores the array to the value saved. The header is checked before anything is reserved: its two numbers must agree, and the bytes cannot be more than a DynArray holds (DynArray::Max_Dim_Allowed). Each byte is stored as it is read, so a header that claims more bytes than the input has takes no more memory than the bytes read.
| [in] | input | stream with an array of bits saved with save(). |
| std::runtime_error | if the header or a byte cannot be read, if the header is inconsistent or claims too many bytes, or if a byte is not in [0, 255]. Then this is as it was. |
| std::bad_alloc | if there is not enough memory. Then this is as it was. |
Definition at line 661 of file bitArray.H.
References ah_runtime_error_if, array_of_bytes, clear_unused_bits_in_last_byte(), current_size, and swap().
Referenced by BitArray(), Aleph::Huffman_Encoder_Engine::load_tree(), Aleph::load_tree(), and main().
|
inline |
Reads an array of bits saved in a character array.
load_from_array_of_chars(str, num_bits) takes an array str, previously generated with save_in_array_of_chars, of num_bits long, and loads it.
| [in] | str | the character array where the of is located bits. |
| [in] | num_bits | the number of bits in the array. Note that not is the same as the number of bytes. |
Definition at line 762 of file bitArray.H.
References array_of_bytes, clear_unused_bits_in_last_byte(), and current_size.
Referenced by BitArray(), and Aleph::load_tree_from_array().
Definition at line 1042 of file bitArray.H.
References array_of_bytes, clear_unused_bits_in_last_byte(), current_size, get_num_bytes(), Aleph::Byte::set_int(), and size().
|
inline |
Definition at line 415 of file bitArray.H.
References read_bit().
Definition at line 561 of file bitArray.H.
References array_of_bytes, current_size, and swap().
Bit array allocation.
Release all memory of this, set aside new memory for host array and exactly copies the bits of array to this.
| [in] | array | the array of bits to be copied. |
| bad_alloc | if there is not enough memory for a block continuous dim/8 bytes. |
Definition at line 589 of file bitArray.H.
References array_of_bytes, and current_size.
|
inline |
Definition at line 1081 of file bitArray.H.
References read_bit(), and size().
|
inline |
Definition at line 388 of file bitArray.H.
References read_bit().
|
inlinenoexcept |
Definition at line 390 of file bitArray.H.
Definition at line 1009 of file bitArray.H.
References array_of_bytes, clear_unused_bits_in_last_byte(), current_size, ensure_num_bytes(), get_num_bytes(), and size().
|
inline |
Removes the last bit of the array.
Definition at line 512 of file bitArray.H.
References ah_underflow_error_if, array_of_bytes, clear_unused_bits_in_last_byte(), current_size, and get_num_bytes().
Referenced by Aleph::Huffman_Encoder_Engine::build_prefix_encoding(), and Moved_From_Case< BitArray >::use().
|
inline |
Inserts the value at the end of the array.
Definition at line 506 of file bitArray.H.
References current_size, value, and write_bit().
Referenced by Aleph::Huffman_Encoder_Engine::append_code(), Aleph::Huffman_Encoder_Engine::build_prefix_encoding(), dyn_left_shift(), Moved_From_Case< BitArray >::make(), TEST_F(), Aleph::tree_to_bits(), and Moved_From_Case< BitArray >::use().
|
inline |
Quick read of bit i.
Read bit i without checking memory
| [in] | i | index of the bit to be read. |
Definition at line 445 of file bitArray.H.
References ah_out_of_range_error_if, array_of_bytes, and current_size.
|
inline |
Read bit i.
| [in] | i | index of the bit to be read. |
Definition at line 409 of file bitArray.H.
References ah_out_of_range_error_if, current_size, and read_bit_ne().
Referenced by __traverse(), Aleph::CA::Bit_Cell_Storage< N >::at(), bits_list(), Aleph::bits_to_tree_helper(), circular_left_shift(), circular_right_shift(), Aleph::Huffman_Decoder_Engine::decode(), demo_basic_operations(), demo_bitwise_operations(), demo_set_operations(), demo_sieve_of_eratosthenes(), demo_simple_bloom_filter(), demo_subset_enumeration(), dyn_right_shift(), get_bit_str(), Aleph::BitArray::Iterator::get_curr(), Aleph::Compact_Cuckoo_Filter< T, FingerprintBits, EntriesPerBucket >::Bucket::get_slot(), left_shift(), operator()(), operator==(), operator[](), print_bits(), right_shift(), and Moved_From_Case< BitArray >::use().
|
inlinenoexcept |
Definition at line 392 of file bitArray.H.
References array_of_bytes, and Aleph::Byte::read_bit().
Referenced by Aleph::BitArray::Iterator::get_curr_ne(), get_unum(), and read_bit().
|
inline |
Reserve memory in advance for the bit array dim dimension.
reserve() sets aside the memory of dim bits and sets size() to dim, as set_size() does: a smaller dim drops the last bits, and the new bits are 0. After it, the bits below dim can be accessed with read(), write(), fast_read() and fast_write(), which are faster because they do not allocate memory.
| bad_alloc | if not enough memory |
| length_error | if dim bits need more bytes than a DynArray holds (DynArray::Max_Dim_Allowed). |
Definition at line 344 of file bitArray.H.
References dim(), and set_size().
Referenced by Aleph::Bloom_Filter< T >::Bloom_Filter(), Aleph::Compact_Quotient_Filter< T >::Compact_Quotient_Filter(), set_bit_str(), set_num(), and TEST().
|
inline |
Shifts the bits n positions to the right.
The bits are shifted and the array is considered a fixed size, that is, the last n bits are lost.
| [in] | n | the number of positions to shift the bits. |
Definition at line 804 of file bitArray.H.
References current_size, read_bit(), and write_bit().
|
inline |
Saves the bit sequence in a text file.
save() stores the sequence in the output text file, already opened, of bits in decimal format.
The first line always saves the size in bytes and in bits. The sequential bytes are then saved as a decimal value. corresponding to the arrangement.
| [in] | output | open output stream where the arrangement. |
Definition at line 612 of file bitArray.H.
References ah_runtime_error_if, array_of_bytes, current_size, get_num_bytes(), and output.
Referenced by main().
|
inline |
Saves a static string declaration to a text file.
characters representing the arrangement.
save_in_array_of_chars(name, output) generates a declaration of the guy:
char name [ size ] = { comma-separated array values };
The declaration is saved in the output stream and the array name is name.
| [in] | name | name of the array variable. |
| [in] | output | output stream where you want to save the statement. |
Definition at line 718 of file bitArray.H.
References array_of_bytes, current_size, get_num_bytes(), and output.
|
inline |
Definition at line 966 of file bitArray.H.
References empty(), reserve(), and write_bit().
Referenced by TEST().
|
inline |
Definition at line 929 of file bitArray.H.
|
inline |
Definition at line 939 of file bitArray.H.
|
inline |
Definition at line 944 of file bitArray.H.
|
inline |
Definition at line 934 of file bitArray.H.
Definition at line 915 of file bitArray.H.
References current_size, empty(), reserve(), and write_bit().
|
inline |
Resets the dimension of the array.
It allocates the memory of all the sz bits, as reserve() says.
| [in] | sz | the new number of bits |
| bad_alloc | if not enough memory |
| length_error | if sz bits need more bytes than a DynArray holds (DynArray::Max_Dim_Allowed). |
Definition at line 362 of file bitArray.H.
References array_of_bytes, clear_unused_bits_in_last_byte(), current_size, and write_bit().
Referenced by dyn_right_shift(), reserve(), and TEST().
|
inlineconstexprnoexcept |
Returns the dimension of the bit array.
Definition at line 350 of file bitArray.H.
References current_size.
Referenced by Aleph::Huffman_Encoder_Engine::append_code(), Aleph::bits_to_tree_helper(), Aleph::Bloom_Filter< T >::contains(), Aleph::Huffman_Decoder_Engine::decode(), Aleph::Adaptive_Huffman_Decoder::decode(), demo_basic_operations(), demo_bitwise_operations(), Aleph::Huffman_Encoder_Engine::encode(), Aleph::Huffman_Encoder_Engine::encode(), Aleph::BitArray::Iterator::end(), Aleph::Bloom_Filter< T >::get_m(), Aleph::Bloom_Filter< T >::get_x(), Aleph::BitArray::Iterator::has_curr(), Aleph::Bloom_Filter< T >::hashes(), Aleph::Bloom_Filter< T >::insert(), Moved_From_Case< BitArray >::is_empty(), Aleph::BitArray::Iterator::next(), operator&=(), operator==(), operator|=(), print(), print_bits(), Aleph::BitArray::Iterator::reset_last(), Aleph::Bloom_Filter< T >::set_bits(), TEST(), and Moved_From_Case< BitArray >::use().
|
inlinenoexcept |
Definition at line 541 of file bitArray.H.
References array_of_bytes, and current_size.
Referenced by load(), operator=(), Aleph::CA::Bit_Cell_Storage< N >::swap(), Aleph::Bloom_Filter< T >::swap(), and Aleph::Compact_Quotient_Filter< T >::swap().
|
inline |
Definition at line 990 of file bitArray.H.
References get_bit_str().
|
inline |
Definition at line 1201 of file bitArray.H.
|
inline |
Definition at line 1195 of file bitArray.H.
|
inline |
Definition at line 1189 of file bitArray.H.
References __traverse().
|
inline |
Definition at line 1183 of file bitArray.H.
References __traverse().
|
inline |
Writes bit i with value without memory check.
| [in] | i | index of the bit to be written. |
| [in] | value | value to be written at position i. |
Definition at line 462 of file bitArray.H.
References ah_out_of_range_error_if, array_of_bytes, clear_unused_bits_in_last_byte(), current_size, and value.
|
inline |
Write bit i with the value.
| [in] | i | index of the bit to be written. |
| [in] | value | value to be written at position i. |
Definition at line 424 of file bitArray.H.
References ah_out_of_range_error_if, array_of_bytes, clear_unused_bits_in_last_byte(), current_size, and value.
Referenced by BitArray(), circular_left_shift(), circular_right_shift(), Aleph::Compact_Cuckoo_Filter< T, FingerprintBits, EntriesPerBucket >::Bucket::clear(), demo_basic_operations(), demo_bitwise_operations(), demo_set_operations(), demo_sieve_of_eratosthenes(), demo_simple_bloom_filter(), demo_subset_enumeration(), dyn_right_shift(), Aleph::CA::Bit_Cell_Storage< N >::fill(), left_shift(), push(), right_shift(), Aleph::CA::Bit_Cell_Storage< N >::set(), set_bit_str(), set_num(), set_size(), and Aleph::Compact_Cuckoo_Filter< T, FingerprintBits, EntriesPerBucket >::Bucket::set_slot().
Definition at line 1210 of file bitArray.H.
|
friend |
Definition at line 1210 of file bitArray.H.
|
friend |
Definition at line 1210 of file bitArray.H.
|
friend |
Definition at line 1210 of file bitArray.H.
Definition at line 1210 of file bitArray.H.
|
friend |
Definition at line 1210 of file bitArray.H.
Definition at line 1074 of file bitArray.H.
|
friend |
Definition at line 995 of file bitArray.H.
Definition at line 1067 of file bitArray.H.
Definition at line 203 of file bitArray.H.
Referenced by BitArray(), Aleph::BitArray::BitProxy::BitProxy(), clear_unused_bits_in_last_byte(), empty(), ensure_num_bytes(), fast_read(), fast_write(), load(), load_from_array_of_chars(), operator&=(), operator=(), operator=(), Aleph::BitArray::BitProxy::operator=(), Aleph::BitArray::BitProxy::operator=(), operator|=(), pop(), read(), read_bit_ne(), save(), save_in_array_of_chars(), set_size(), swap(), write(), and write_bit().
|
private |
Definition at line 202 of file bitArray.H.
Referenced by __traverse(), bits_list(), circular_left_shift(), circular_right_shift(), clear_unused_bits_in_last_byte(), dyn_right_shift(), empty(), fast_read(), fast_write(), get_bit_str(), get_num_bytes(), get_unum(), left_shift(), load(), load_from_array_of_chars(), Aleph::BitArray::BitProxy::operator int(), operator&=(), operator=(), operator=(), Aleph::BitArray::BitProxy::operator=(), Aleph::BitArray::BitProxy::operator=(), operator|=(), pop(), push(), read(), read_bit(), right_shift(), save(), save_in_array_of_chars(), set_num(), set_size(), size(), swap(), write(), and write_bit().