OpenASIP
2.0
|
#include <BitTrie.hh>
Public Types | |
using | WidthType = unsigned |
The type for width of bit vector. More... | |
using | BitVector = std::tuple< ValueType, WidthType > |
The bit vector type used to store patterns to tries. Binary value is queried by value() method. Width value is queried by width() method. More... | |
using | Frequency = unsigned int |
The type for frequencies of the patterns. More... | |
Public Member Functions | |
BitTrie () | |
BitTrie (bool bitReadLeftToRight) | |
virtual | ~BitTrie () |
unsigned | frequency (const BitVector &prefixBits) const |
bool | check (const BitVector &exactbits) const |
bool | insert (BitVector bits) |
bool | insert (BitVector bits, const DataType &data) |
bool | erase (BitVector bits) |
void | clear () |
unsigned | size () const |
BitVector | uniqueUnusedPrefix () const |
DataType & | at (BitVector bits) |
BitVector | longestCompletePattern (const BitVector &bits) const |
void | dump (std::ostream &out) const |
Static Public Member Functions | |
static WidthType & | width (BitVector &bitVector) |
static const WidthType & | width (const BitVector &bitVector) |
static ValueType & | value (BitVector &bitVector) |
static const ValueType & | value (const BitVector &bitVector) |
Private Member Functions | |
BitTrie (bool bitReadLeftToRight, BitTrie &parent) | |
bool | nextBit (const BitVector &bitVector) const |
BitVector | stripBit (BitVector bitVector) const |
BitTrie * | findNode (const BitVector &bits) |
const BitTrie * | findNode (const BitVector &bits) const |
Static Private Member Functions | |
static BitVector | uniqueUnusedPrefixImpl (const BitTrie &bitTrie) |
static BitVector | uniquePrefixImpl (const BitTrie &bitTrie) |
static bool | nodeTerminatesPattern (const BitTrie &node) |
static BitVector | patternAtNode (const BitTrie &node) |
static bool | nodeBitValue (const BitTrie &node) |
static bool | isRootNode (const BitTrie &node) |
static unsigned | depth (const BitTrie &node) |
Private Attributes | |
bool | bitReadLeftToRight_ = false |
The configuration how bits are read and stored into the trie. If true, the rightmost (LSB) bit is placed in the leaf node. If false, the leftmost (MSB) bit is placed in the leaf node. More... | |
BitTrie * | node_ [2] = {nullptr, nullptr} |
The bits are encoded as indexes where 0: zero node, 1: one node. If node at index is not nullptr, a bit has been stored in the trie. More... | |
BitTrie * | parent_ = nullptr |
Parent of the (sub)trie. If the pointer is null, the node is root of the trie. More... | |
Frequency | frequency_ = 0 |
The frequency. The current occurrence of the bit pattern so far. More... | |
DataType * | data_ = nullptr |
The data at this node. More... | |
Definition at line 59 of file BitTrie.hh.
using BitTrie< DataType, ValueType >::BitVector = std::tuple<ValueType, WidthType> |
The bit vector type used to store patterns to tries. Binary value is queried by value() method. Width value is queried by width() method.
Definition at line 70 of file BitTrie.hh.
using BitTrie< DataType, ValueType >::Frequency = unsigned int |
The type for frequencies of the patterns.
Definition at line 72 of file BitTrie.hh.
using BitTrie< DataType, ValueType >::WidthType = unsigned |
The type for width of bit vector.
Definition at line 66 of file BitTrie.hh.
BitTrie< DataType, ValueType >::BitTrie | ( | ) |
BitTrie< DataType, ValueType >::BitTrie | ( | bool | bitReadLeftToRight | ) |
|
virtual |
|
private |
DataType& BitTrie< DataType, ValueType >::at | ( | BitVector | bits | ) |
bool BitTrie< DataType, ValueType >::check | ( | const BitVector & | exactbits | ) | const |
void BitTrie< DataType, ValueType >::clear | ( | ) |
|
staticprivate |
void BitTrie< DataType, ValueType >::dump | ( | std::ostream & | out | ) | const |
bool BitTrie< DataType, ValueType >::erase | ( | BitVector | bits | ) |
|
private |
|
private |
unsigned BitTrie< DataType, ValueType >::frequency | ( | const BitVector & | prefixBits | ) | const |
bool BitTrie< DataType, ValueType >::insert | ( | BitVector | bits | ) |
bool BitTrie< DataType, ValueType >::insert | ( | BitVector | bits, |
const DataType & | data | ||
) |
|
staticprivate |
BitVector BitTrie< DataType, ValueType >::longestCompletePattern | ( | const BitVector & | bits | ) | const |
|
private |
|
staticprivate |
|
staticprivate |
|
staticprivate |
unsigned BitTrie< DataType, ValueType >::size | ( | ) | const |
|
private |
|
staticprivate |
BitVector BitTrie< DataType, ValueType >::uniqueUnusedPrefix | ( | ) | const |
|
staticprivate |
|
static |
|
static |
|
static |
|
static |
|
private |
The configuration how bits are read and stored into the trie. If true, the rightmost (LSB) bit is placed in the leaf node. If false, the leftmost (MSB) bit is placed in the leaf node.
Definition at line 110 of file BitTrie.hh.
|
private |
The data at this node.
Definition at line 120 of file BitTrie.hh.
|
private |
The frequency. The current occurrence of the bit pattern so far.
Definition at line 118 of file BitTrie.hh.
|
private |
The bits are encoded as indexes where 0: zero node, 1: one node. If node at index is not nullptr, a bit has been stored in the trie.
Definition at line 113 of file BitTrie.hh.
|
private |
Parent of the (sub)trie. If the pointer is null, the node is root of the trie.
Definition at line 116 of file BitTrie.hh.