1 #ifndef __WordGeneratorBase_h__
2 #define __WordGeneratorBase_h__
6 #include "Alphabet/AlphabetMap.h"
7 #include "Alphabet/AlphIO.h"
13 * The base class for all word generators. Word generators encapsulate
14 * logic for simply generating words based on implementation-specific
15 * conditions. The benefit of this is that a generator can
16 * easily be written that selects words based on a function of the current
17 * value of the Sri Lankan rupee and the amount of twitter feeds regarding
18 * the winter olympics, for example.
21 * A typical use case for any class deriving from CWordGeneratorBase
22 * would be the following:
23 * 1) Construct the object (providing any implementation-specific params)
25 * 2) To retrieve a word, simply call GetNextWord. This will continue
26 * until the specific implementation determines that there are no
27 * more words for any reason. When there are no more, GetNextWord
28 * returns the empty string.
31 * CWordGeneratorBase gen = CWordGeneratorBase(params...);
33 * while ((word = gen.GetNextWord()) != "") {
37 class CWordGeneratorBase
{
39 const CAlphInfo
*m_pAlph
;
40 const CAlphabetMap
*m_pAlphMap
;
42 CWordGeneratorBase(const CAlphInfo
*pAlph
, const CAlphabetMap
*pAlphMap
);
44 virtual ~CWordGeneratorBase() { }
46 void GetSymbols(std::vector
<symbol
> &into
);
48 /// Gets the next line from this generator
49 /// @return the next line, or "" if exhausted
50 virtual std::string
GetLine() = 0;