Vocabulary Administration class. More...
#include <vocadmin.H>
Public Member Functions | |
| CVocAdmin (const size_t &nNumWords, const bool &bDebug) | |
| Constructor. | |
| ~CVocAdmin () | |
| Destructor. | |
| size_t | GetLearnPos (bool bRandom) |
| Get the next learning position. | |
| void | MarkAsLearnedStack (size_t idx) |
| Mark position idx as learned in the bit array stack. | |
| void | MarkAsLearned (size_t idx) |
| Mark position idx as learned in the bit array. | |
| bool | IsFinished () |
| Is learning process finished function. | |
Private Member Functions | |
| void | printBits () |
| Helper function. | |
| void | initArrStack () |
| Helper function. | |
Private Attributes | |
| size_t * | m_pBitArrLearned |
| Learned bit array with m_nNumArrDim dimensions. | |
| size_t * | m_pBitArrLearnedStack |
| Learned bit array stack with m_nNumArrDim dimensions. | |
| size_t | m_nNumUnlearnedWords |
| number of unlearned words | |
| size_t | m_nNumUnlearnedWordsStack |
| number of unlearned words in the current stack | |
| size_t | m_nNumArrDim |
| Number of array dimensions in m_pBitArrLearned and m_pBitArrLearnedStack. | |
| size_t | m_nLastLearnPos |
| number of the last learn position | |
| bool | m_bDebug |
| debug mode | |
Vocabulary Administration class.
This class controls the learning process. It administrates a bit array with the current learning status and handles the current learning position as well.
| CVocAdmin::CVocAdmin | ( | const size_t & | nNumWords, | |
| const bool & | bDebug | |||
| ) |
Constructor.
This constructor initializes a bit array with numWords positions. and sets the debug mode.
| nNumWords | size from the learning bit array. | |
| bDebug | enable or disable the debug mode. |
References initArrStack(), m_bDebug, m_nNumArrDim, m_nNumUnlearnedWords, m_pBitArrLearned, and m_pBitArrLearnedStack.
| CVocAdmin::~CVocAdmin | ( | ) |
Destructor.
This destructor releases the allocated memory.
References m_pBitArrLearned, and m_pBitArrLearnedStack.
| size_t CVocAdmin::GetLearnPos | ( | bool | bRandom | ) |
Get the next learning position.
This function returns a unlearned position x. If the random mode is disabled, x is equal the current position + 1.
| bRandom | enable or disable the random mode. |
References m_nLastLearnPos, m_nNumArrDim, m_nNumUnlearnedWordsStack, and m_pBitArrLearnedStack.
| void CVocAdmin::initArrStack | ( | ) | [private] |
Helper function.
This function initializes a second learning bit array. CVocAdmin will need this array, if the stack mode is enabled.
References m_nLastLearnPos, m_nNumArrDim, m_nNumUnlearnedWords, m_nNumUnlearnedWordsStack, m_pBitArrLearned, and m_pBitArrLearnedStack.
Referenced by CVocAdmin(), and MarkAsLearnedStack().
| bool CVocAdmin::IsFinished | ( | ) |
Is learning process finished function.
This function returns true, if every position in the learning bit array is 1.
References m_nNumUnlearnedWords, and printBits().
| void CVocAdmin::MarkAsLearned | ( | size_t | idx | ) |
Mark position idx as learned in the bit array.
This function changes the bit idx in the learning bit array to 1. It will be used, if the stack by stack mode is disabled or vocatra is in the last stack.
| idx | learned position in the current array. |
References m_nNumUnlearnedWords, and m_pBitArrLearned.
| void CVocAdmin::MarkAsLearnedStack | ( | size_t | idx | ) |
Mark position idx as learned in the bit array stack.
This function changes the bit idx in the learning bit array stack to 1. It will be used, if vocatra is not in the last stack and the stack by stack mode is enabled.
| idx | learned position in the current array stack. |
References initArrStack(), m_nNumUnlearnedWordsStack, and m_pBitArrLearnedStack.
| void CVocAdmin::printBits | ( | ) | [private] |
Helper function.
This function prints the learning bit array to the standard output, if the debug mode is enabled.
References CVocatraInfo::GetName(), m_bDebug, m_nNumArrDim, and m_pBitArrLearned.
Referenced by IsFinished().
size_t CVocAdmin::m_nNumArrDim [private] |
Number of array dimensions in m_pBitArrLearned and m_pBitArrLearnedStack.
Referenced by CVocAdmin(), GetLearnPos(), initArrStack(), and printBits().
size_t* CVocAdmin::m_pBitArrLearned [private] |
Learned bit array with m_nNumArrDim dimensions.
Every dimension contains 32 positions and every position resp. bit represents a word. If the bit is set to 1 means that the word is already learned.
Referenced by CVocAdmin(), initArrStack(), MarkAsLearned(), printBits(), and ~CVocAdmin().
size_t* CVocAdmin::m_pBitArrLearnedStack [private] |
Learned bit array stack with m_nNumArrDim dimensions.
Referenced by CVocAdmin(), GetLearnPos(), initArrStack(), MarkAsLearnedStack(), and ~CVocAdmin().
|
|
Generated for Vocatra by
|