#include <hash_vector.h>
Public Types | |
| typedef _StType | type |
| Stored type definition. | |
| typedef iterator | const_iterator |
| Const iterator is simply iterator. | |
| typedef std::pair< iterator, bool > | pair_ib |
| Iterator and bool pair (insert method return value). | |
| typedef std::pair< iterator, iterator > | pair_ii |
| Pair of iterators (equal_range method return value). | |
Public Member Functions | |
| HashVector (size_t init_size, size_t bucket_size, size_t crop_ratio) | |
| Constructor creates new hash table. | |
| HashVector & | operator= (const HashVector &rhs) |
| Assignment operator. | |
| const_iterator | begin (void) const |
| const_iterator | end (void) const |
| pair_ib | insert (_StType value) |
| Insert totally relies on caller! No checks (if item is already in) are performed! | |
| pair_ii | equal_range (const _StType value) const |
| Searches for given value and returns appropriate range. | |
| size_t | size (void) const |
| void | sort (void) |
| Sort items in all buckets according to their frequency. | |
Private Types | |
| typedef std::vector< _StType > | _store_t |
| Container for items (to be stored) - aka bucket. | |
| typedef std::vector< _store_t > | _buckets_t |
| Container for buckets - aka hash table. | |
Private Member Functions | |
| void | _expand (void) |
| Double sizes the buckets (hash table) and rehashes all containers. | |
Private Attributes | |
| size_t | _init_size |
| We begin with _init_size buckets (shall be power of two). | |
| size_t | _bucket_size |
| How much items (in average) per bucket? | |
| std::vector< _store_t > | _buckets |
| Buckets (hash table). | |
| _HashFunc | _h |
| Hash function object. | |
| size_t | _items |
| Items counter. | |
| size_t | _crop_ratio |
| If capacity of vector is bigger than (crop ratio * its size), then we "crop" it. | |
Classes | |
| class | items_compare |
| Function object for equal to comparison of two N-gram pointers (one passed as constructor param, second as unary operator() param). More... | |
| class | items_sort |
| Function object for less than comparison of two N-gram pointers which is based on frequencies of instances they point to. More... | |
| class | iterator |
| Iterator class needed (simple - only forward, no random access!). More... | |
| _StType | Stored type (should be pointer to NGram). | |
| _HashFunc | Hashing function type. |
| typedef _StType ace::HashVector< _StType, _HashFunc >::type |
Stored type definition.
typedef std::vector<_StType> ace::HashVector< _StType, _HashFunc >::_store_t [private] |
Container for items (to be stored) - aka bucket.
typedef std::vector<_store_t> ace::HashVector< _StType, _HashFunc >::_buckets_t [private] |
Container for buckets - aka hash table.
| typedef iterator ace::HashVector< _StType, _HashFunc >::const_iterator |
| typedef std::pair<iterator, bool> ace::HashVector< _StType, _HashFunc >::pair_ib |
Iterator and bool pair (insert method return value).
| typedef std::pair<iterator, iterator> ace::HashVector< _StType, _HashFunc >::pair_ii |
Pair of iterators (equal_range method return value).
| ace::HashVector< _StType, _HashFunc >::HashVector | ( | size_t | init_size, | |
| size_t | bucket_size, | |||
| size_t | crop_ratio | |||
| ) | [inline] |
Constructor creates new hash table.
| init_size | Starting size of container. | |
| bucket_size | Maximum allowed ratio of |items| / |buckets|. | |
| crop_ratio | Crop ratio value. |
| void ace::HashVector< _StType, _HashFunc >::_expand | ( | void | ) | [inline, private] |
Double sizes the buckets (hash table) and rehashes all containers.
| HashVector& ace::HashVector< _StType, _HashFunc >::operator= | ( | const HashVector< _StType, _HashFunc > & | rhs | ) | [inline] |
Assignment operator.
| const_iterator ace::HashVector< _StType, _HashFunc >::begin | ( | void | ) | const [inline] |
| const_iterator ace::HashVector< _StType, _HashFunc >::end | ( | void | ) | const [inline] |
| pair_ib ace::HashVector< _StType, _HashFunc >::insert | ( | _StType | value | ) | [inline] |
Insert totally relies on caller! No checks (if item is already in) are performed!
| value | Value to be inserted. |
| pair_ii ace::HashVector< _StType, _HashFunc >::equal_range | ( | const _StType | value | ) | const [inline] |
Searches for given value and returns appropriate range.
| value | Value to be searched. |
| size_t ace::HashVector< _StType, _HashFunc >::size | ( | void | ) | const [inline] |
| void ace::HashVector< _StType, _HashFunc >::sort | ( | void | ) | [inline] |
Sort items in all buckets according to their frequency.
size_t ace::HashVector< _StType, _HashFunc >::_init_size [private] |
We begin with _init_size buckets (shall be power of two).
size_t ace::HashVector< _StType, _HashFunc >::_bucket_size [private] |
How much items (in average) per bucket?
std::vector<_store_t> ace::HashVector< _StType, _HashFunc >::_buckets [private] |
Buckets (hash table).
_HashFunc ace::HashVector< _StType, _HashFunc >::_h [private] |
Hash function object.
size_t ace::HashVector< _StType, _HashFunc >::_items [private] |
Items counter.
size_t ace::HashVector< _StType, _HashFunc >::_crop_ratio [private] |
If capacity of vector is bigger than (crop ratio * its size), then we "crop" it.
1.5.6