27 #ifndef Common_WordStream_h
28 #define Common_WordStream_h
58 bool random =
false,
const char *separator =
" ");
112 #endif // Common_WordStream_h
std::string String
A String is simply a typedef to std::string.
const char * m_separator
The separator, as specified by the user.
const char * m_end
End pointer for the memory mapped file.
std::mt19937 ms_rng
Random number generator.
size_t m_words_per_record
Words per record, as specified by the user.
off_t m_len
Length of the memory mapped file.
std::vector< struct word_info > m_words
All words from the mapped file.
std::shared_ptr< WordStream > WordStreamPtr
String m_record
The current string.
char * m_base
Base pointer for the memory mapped file.
Internal structure for a single word.
std::vector< size_t > m_offset
Helper for parsing the words.
virtual ~WordStream()
Releases internal resources.
A class generating a stream of words; the words are retrieved from a file and can be randomized...
const char * next()
Retrieves the next word, or an empty string if EOF is reached.
A String class based on std::string.
WordStream(const String &word_file, unsigned seed, size_t words_per_record, bool random=false, const char *separator=" ")
Constructor.
bool m_random
Whether to return random strings or not.