1 #ifndef __NodeCreationManager_h__
2 #define __NodeCreationManager_h__
4 #include "Alphabet/Alphabet.h"
5 #include "Alphabet/AlphIO.h"
6 #include "AlphabetManagerFactory.h"
7 #include "ControlManagerFactory.h"
8 #include "ConversionManagerFactory.h"
9 #include "DasherComponent.h"
10 //#include "DasherNode.h"
11 #include "LanguageModelling/LanguageModel.h"
18 class CDasherInterfaceBase
;
22 class CNodeCreationManager
: public Dasher::CDasherComponent
{
24 CNodeCreationManager(Dasher::CDasherInterfaceBase
*pInterface
, Dasher::CEventHandler
* pEventHandler
, CSettingsStore
* pSettingsStore
, bool bGameMode
, std::string strGameModeText
, Dasher::CAlphIO
*pAlphIO
);
25 ~CNodeCreationManager();
28 /// Get a root node of a given type
31 CDasherNode
*GetRoot(int iType
, Dasher::CDasherNode
*pParent
, int iLower
, int iUpper
, void *pUserData
);
34 /// Resgister a control node
37 void RegisterNode( int iID
, const std::string
&strLabel
, int iColour
) {
38 m_pControlManagerFactory
->RegisterNode(iID
, strLabel
, iColour
);
42 /// Connect control nodes in the tree
45 void ConnectNode(int iChild
, int iParent
, int iAfter
) {
46 m_pControlManagerFactory
->ConnectNode(iChild
, iParent
, iAfter
);
50 /// Disconnect control nodes
53 void DisconnectNode(int iChild
, int iParent
) {
54 m_pControlManagerFactory
->DisconnectNode(iChild
, iParent
);
58 /// Temporary methods: TODO: remove
61 CLanguageModel
*GetLanguageModel() {
62 return m_pLanguageModel
;
65 CLanguageModel::Context
GetLearnContext() {
66 return m_pAlphabetManagerFactory
->GetLearnContext();
69 void GetProbs(CLanguageModel::Context context
, std::vector
<symbol
>&NewSymbols
, std::vector
<unsigned int >&Probs
, int iNorm
) const;
70 void LearnText(CLanguageModel::Context context
, std::string
*TheText
, bool IsMore
);
71 void EnterText(CLanguageModel::Context context
, std::string TheText
) const;
73 inline int GetColour(symbol s
) const {
74 return m_pAlphabet
->GetColour(s
);
78 /// Get the symbol ID representing space
81 symbol
GetSpaceSymbol() const {
82 return m_pAlphabet
->GetSpaceSymbol();
86 /// Get the symbol ID representing the control node
89 symbol
GetControlSymbol() const {
90 return m_pAlphabet
->GetControlSymbol();
94 /// Get the symbol ID representing the conversion pseudo-character
97 symbol
GetStartConversionSymbol() const {
98 return m_pAlphabet
->GetStartConversionSymbol();
102 /// Convert a given symbol ID to display text
105 const std::string
& GetDisplayText(int iSymbol
) const {
106 return m_pAlphabet
->GetDisplayText(iSymbol
);
110 /// Get a reference to the alphabet
113 CAlphabet
*GetAlphabet() {
118 /// Get a pointer to the alphabet - TODO: Remove duplicate
119 /// functionality with the above function
122 /* CAlphabet *GetAlphabet() const { */
123 /* return m_pAlphabet; */
126 CAlphabetManagerFactory::CTrainer
*GetTrainer();
129 CLanguageModel
*m_pLanguageModel
; // pointer to the language model
130 CAlphabet
*m_pAlphabet
; // pointer to the alphabet
132 CAlphabetManagerFactory
*m_pAlphabetManagerFactory
;
133 CControlManagerFactory
*m_pControlManagerFactory
;
134 CConversionManagerFactory
*m_pConversionManagerFactory
;