#include <ngrams.h>
Public Types | |
| typedef HashVector< NGram *, NGramHasher > | hash_table_t |
| typedef std::pair< NGram *, bool > | insert_status_t |
| Pair returned as insert method result. | |
Public Member Functions | |
| NGramStore (size_t memory_pool_block_size=0) | |
| Constructor initializes all underlying containers in case, the passed types_count is non zero. | |
| hash_table_t::const_iterator | begin (ngram_size_t type) const |
| hash_table_t::const_iterator | begin (void) const |
| hash_table_t::const_iterator | end (ngram_size_t type) const |
| hash_table_t::const_iterator | end (void) const |
| const NGram * | get (const NGram *ngram) const |
| void | init (size_t memory_pool_block_size) |
| Performs object initialization. | |
| insert_status_t | insert (const NGram *ngram) |
| size_t | size (ngram_type_t type) const |
| size_t | size (void) const |
| void | sort (ngram_type_t type=0) |
Public Attributes | |
| NGram | zero_ngram |
| Only one zero-typed N-gram exists in whole universe (which is restrained by program scope of course). | |
Private Types | |
| typedef std::pair < hash_table_t::const_iterator, bool > | _hash_table_pair_cib_t |
| Pair is returned as find() methods result. | |
Private Member Functions | |
| _hash_table_pair_cib_t | _find (const NGram *ngram) const |
| NGramStore (const NGramStore &) | |
| No copy constructs. | |
| NGramStore & | operator= (const NGramStore &) |
| No assignments. | |
Private Attributes | |
| std::vector< VoidPool > | _memory_pools |
| VoidPool serves as a data container for NGram instances. | |
| std::vector< hash_table_t > | _hash_tables |
| Hash table is used to quickly gain pointer to stored NGram instance. | |
There is separate memory pool and hash table for each NGram type. NGram data are stored within the pool, while pointer to NGram is stored within the hash table.
| typedef HashVector<NGram *, NGramHasher> ace::NGramStore::hash_table_t |
typedef std::pair<hash_table_t::const_iterator, bool> ace::NGramStore::_hash_table_pair_cib_t [private] |
Pair is returned as find() methods result.
The 1st value is const_iterator pointing to founded item (if founded - otherwise its value cannot be consider as valid). 2nd value answers the question: was searched key founded?
| typedef std::pair<NGram *, bool> ace::NGramStore::insert_status_t |
Pair returned as insert method result.
The 1st value is pointer to the stored NGram instance, 2nd value determines whether inserted item was added to store (true) or was not, which means it has been already present.
| ace::NGramStore::NGramStore | ( | const NGramStore & | ) | [private] |
No copy constructs.
| ace::NGramStore::NGramStore | ( | size_t | memory_pool_block_size = 0 |
) |
Constructor initializes all underlying containers in case, the passed types_count is non zero.
| memory_pool_block_size | Number of NGram(s) to be stored in every pool. |
| NGramStore::_hash_table_pair_cib_t ace::NGramStore::_find | ( | const NGram * | ngram | ) | const [private] |
| ngram | Pointer to NGram instance which shall be looked after. |
| NGramStore& ace::NGramStore::operator= | ( | const NGramStore & | ) | [private] |
No assignments.
| hash_table_t::const_iterator ace::NGramStore::begin | ( | ngram_size_t | type | ) | const [inline] |
| type | N-gram type. |
| hash_table_t::const_iterator ace::NGramStore::begin | ( | void | ) | const [inline] |
| hash_table_t::const_iterator ace::NGramStore::end | ( | ngram_size_t | type | ) | const [inline] |
| type | N-gram type. |
| hash_table_t::const_iterator ace::NGramStore::end | ( | void | ) | const [inline] |
| void ace::NGramStore::init | ( | size_t | memory_pool_block_size | ) |
Performs object initialization.
Can be used in "post-init" manner also, but only if object has been created by default constructor.
| memory_pool_block_size | Number of NGram(s) to be stored in every pool. |
| NGramStore::insert_status_t ace::NGramStore::insert | ( | const NGram * | ngram | ) |
| ngram | Pointer to NGram instance which should be inserted into store. |
| size_t ace::NGramStore::size | ( | ngram_type_t | type | ) | const [inline] |
| type | N-gram type. |
| size_t ace::NGramStore::size | ( | void | ) | const [inline] |
| void ace::NGramStore::sort | ( | ngram_type_t | type = 0 |
) |
Only one zero-typed N-gram exists in whole universe (which is restrained by program scope of course).
std::vector<VoidPool> ace::NGramStore::_memory_pools [private] |
std::vector<hash_table_t> ace::NGramStore::_hash_tables [private] |
Hash table is used to quickly gain pointer to stored NGram instance.
There is a separate hash table for each N-gram type, what makes iteration through all instances of certain N-gram type very easy.
1.5.6