tagging release
[dasher.git] / Src / DasherCore / NodeCreationManager.h
blobe54d5c3271886282983989f6087f086f5c943199
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"
13 #include <string>
14 #include <vector>
16 namespace Dasher {
17 class CDasherNode;
18 class CDasherInterfaceBase;
20 /// \ingroup Model
21 /// @{
22 class CNodeCreationManager : public Dasher::CDasherComponent {
23 public:
24 CNodeCreationManager(Dasher::CDasherInterfaceBase *pInterface, Dasher::CEventHandler * pEventHandler, CSettingsStore * pSettingsStore, bool bGameMode, std::string strGameModeText, Dasher::CAlphIO *pAlphIO);
25 ~CNodeCreationManager();
27 ///
28 /// Get a root node of a given type
29 ///
31 CDasherNode *GetRoot(int iType, Dasher::CDasherNode *pParent, int iLower, int iUpper, void *pUserData);
33 ///
34 /// Resgister a control node
35 ///
37 void RegisterNode( int iID, const std::string &strLabel, int iColour ) {
38 m_pControlManagerFactory->RegisterNode(iID, strLabel, iColour);
41 ///
42 /// Connect control nodes in the tree
43 ///
45 void ConnectNode(int iChild, int iParent, int iAfter) {
46 m_pControlManagerFactory->ConnectNode(iChild, iParent, iAfter);
49 ///
50 /// Disconnect control nodes
51 ///
53 void DisconnectNode(int iChild, int iParent) {
54 m_pControlManagerFactory->DisconnectNode(iChild, iParent);
57 ///
58 /// Temporary methods: TODO: remove
59 ///
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);
77 ///
78 /// Get the symbol ID representing space
79 ///
81 symbol GetSpaceSymbol() const {
82 return m_pAlphabet->GetSpaceSymbol();
85 ///
86 /// Get the symbol ID representing the control node
87 ///
89 symbol GetControlSymbol() const {
90 return m_pAlphabet->GetControlSymbol();
93 ///
94 /// Get the symbol ID representing the conversion pseudo-character
95 ///
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() {
114 return m_pAlphabet;
118 /// Get a pointer to the alphabet - TODO: Remove duplicate
119 /// functionality with the above function
122 /* CAlphabet *GetAlphabet() const { */
123 /* return m_pAlphabet; */
124 /* } */
126 CAlphabetManagerFactory::CTrainer *GetTrainer();
128 private:
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;
136 /// @}
138 #endif