Inheritance diagram for simstring::writer_base< string_tmpl, ngram_generator_tmpl >:
This template class builds a SimString database. The first template argument (string_tmpl) specifies the type of a character, and the second template argument (ngram_generator_tmpl) customizes generation of feature sets (n-grams) from strings.
Inheriting the base class ngramdb_writer_base that builds indices from n-grams to string IDs, this class maintains associations between strings and string IDs.
string_tmpl | The type of a string. | |
ngram_generator_tmpl | The type of an n-gram generator. |
Public Types | |
typedef string_tmpl | string_type |
The type representing a string. | |
typedef uint32_t | value_type |
The type of values associated with key strings. | |
typedef ngram_generator_tmpl | ngram_generator_type |
The function type for generating n-grams from a key string. | |
typedef string_type::value_type | char_type |
The type representing a character. | |
Public Member Functions | |
writer_base (const ngram_generator_type &gen) | |
Constructs a writer object. | |
writer_base (const ngram_generator_type &gen, const std::string &name) | |
Constructs a writer object by opening a database. | |
virtual | ~writer_base () |
Destructs a writer object. | |
bool | open (const std::string &name) |
Opens a database. | |
bool | close () |
Closes the database. | |
bool | insert (const string_type &str) |
Inserts a string to the database. | |
Protected Attributes | |
std::string | m_name |
The base name of the database. | |
std::ofstream | m_ofs |
The output stream for the string collection. | |
int | m_num_entries |
The number of strings in the database. |
simstring::writer_base< string_tmpl, ngram_generator_tmpl >::writer_base | ( | const ngram_generator_type & | gen | ) | [inline] |
Constructs a writer object.
gen | The n-gram generator used by this writer. |
simstring::writer_base< string_tmpl, ngram_generator_tmpl >::writer_base | ( | const ngram_generator_type & | gen, | |
const std::string & | name | |||
) | [inline] |
Constructs a writer object by opening a database.
gen | The n-gram generator used by this writer. | |
name | The name of the database. |
bool simstring::writer_base< string_tmpl, ngram_generator_tmpl >::open | ( | const std::string & | name | ) | [inline] |
Opens a database.
name | The name of the database. |
true
if the database is successfully opened, false
otherwise. bool simstring::writer_base< string_tmpl, ngram_generator_tmpl >::close | ( | ) | [inline] |
Closes the database.
name | The name of the database. |
true
if the database is successfully opened, false
otherwise. bool simstring::writer_base< string_tmpl, ngram_generator_tmpl >::insert | ( | const string_type & | str | ) | [inline] |
Inserts a string to the database.
str | The string to be inserted. |
true
if the string is successfully inserted, false
otherwise.