[dasher] Remove NodeCreationManager::GetRoot(int,...) in favour of



commit 0d1621d4f915fe0ad7b4d8624358186b2627f5c8
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Fri Aug 21 13:38:22 2009 +0100

    Remove NodeCreationManager::GetRoot(int,...) in favour of
    Get{Alph,Conv,Ctrl}Root(...).
    Each subclass has its own GetRoot method taking different, appropriate,
    argument types; pure virtual NodeManager::GetRoot removed as never
    called directly.

 ChangeLog                                   |    2 +
 Src/DasherCore/AlphabetManager.cpp          |   26 ++++++--------------
 Src/DasherCore/AlphabetManager.h            |   12 +++------
 Src/DasherCore/AlphabetManagerFactory.cpp   |    4 +-
 Src/DasherCore/AlphabetManagerFactory.h     |    2 +-
 Src/DasherCore/ControlManager.cpp           |   12 +--------
 Src/DasherCore/ControlManager.h             |    2 +-
 Src/DasherCore/ConversionHelper.cpp         |   10 ++-----
 Src/DasherCore/ConversionHelper.h           |    2 +-
 Src/DasherCore/ConversionManager.cpp        |   11 +-------
 Src/DasherCore/ConversionManager.h          |    2 +-
 Src/DasherCore/ConversionManagerFactory.cpp |    4 +-
 Src/DasherCore/ConversionManagerFactory.h   |    2 +-
 Src/DasherCore/DasherModel.cpp              |   14 ++++-------
 Src/DasherCore/MandarinAlphMgr.cpp          |    6 ++--
 Src/DasherCore/MandarinAlphMgr.h            |    2 +-
 Src/DasherCore/NodeCreationManager.cpp      |   33 ++++++++++++--------------
 Src/DasherCore/NodeCreationManager.h        |    6 +++-
 Src/DasherCore/NodeManager.h                |    7 ++---
 19 files changed, 61 insertions(+), 98 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 324aae7..233d00d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
 	* Move handling of double/long/etc. clicks into subclasses.
 	* Subclasses of DynamicFilter now handle their own states, and
 	  BP_FIXED_MARKERS is now compulsory.
+	* Remove NodeCreationManager::GetRoot(int,...) in favour of
+	  Get{Alph,Conv,Ctrl}Root(...).
 
 2009-08-18  Patrick Welche <prlw1 cam ac uk>
 
diff --git a/Src/DasherCore/AlphabetManager.cpp b/Src/DasherCore/AlphabetManager.cpp
index 56785ee..3debacd 100644
--- a/Src/DasherCore/AlphabetManager.cpp
+++ b/Src/DasherCore/AlphabetManager.cpp
@@ -53,45 +53,36 @@ CAlphabetManager::CAlphabetManager(CDasherInterfaceBase *pInterface, CNodeCreati
 
 }
 
-CDasherNode *CAlphabetManager::GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData) {
+CDasherNode *CAlphabetManager::GetRoot(CDasherNode *pParent, int iLower, int iUpper, char *szContext, int iOffset) {
 
   CDasherNode *pNewNode;
 
-  // TODO: iOffset has gotten a bit hacky here
-
   int iSymbol;
-  int iOffset;
   int iColour;
 
   std::string strContext;
 
   CLanguageModel::Context iContext;
 
-  if(pUserData && static_cast<SRootData *>(pUserData)->szContext) {
-    std::string strRootText(static_cast<SRootData *>(pUserData)->szContext);
-
+  if(szContext) {
     int iMaxContextLength = m_pLanguageModel->GetContextLength() + 1;
 
     // TODO: No need to explicitly pass context
     // TODO: Utility function for looking up symbolic context
 
-    int iStart = static_cast<SRootData *>(pUserData)->iOffset - iMaxContextLength;
+    int iStart = iOffset - iMaxContextLength;
     if(iStart < 0)
       iStart = 0;
 
-    strContext = m_pInterface->GetContext(iStart, static_cast<SRootData *>(pUserData)->iOffset - iStart);
+    strContext = m_pInterface->GetContext(iStart, iOffset - iStart);
     BuildContext(strContext, false, iContext, iSymbol);
 
-    iOffset = static_cast<SRootData *>(pUserData)->iOffset - 1;
+    iOffset = iOffset - 1;
     iColour = m_pNCManager->GetColour(iSymbol, 0);
   }
   else {
     // Create a root node
 
-    if(pUserData)
-      iOffset = static_cast<SRootData *>(pUserData)->iOffset;
-    else
-      iOffset = -1;
     iColour = 7;
 
     strContext = m_pNCManager->GetAlphabet()->GetDefaultContext();
@@ -100,7 +91,6 @@ CDasherNode *CAlphabetManager::GetRoot(CDasherNode *pParent, int iLower, int iUp
 
   // FIXME - Make this a CDasherComponent
 
-
   // Stuff which could in principle be done in the symbol node creation routine
   CDasherNode::SDisplayInfo *pDisplayInfo = new CDasherNode::SDisplayInfo;
   pDisplayInfo->iColour = iColour;
@@ -235,18 +225,18 @@ CDasherNode *CAlphabetManager::CreateSymbolNode(CDasherNode *pParent, symbol iSy
     }
     // TODO: Need to fix fact that this is created even when control mode is switched off
     else if(iSymbol == m_pNCManager->GetControlSymbol()) {
-      pNewNode = m_pNCManager->GetRoot(1, pParent, iLbnd, iHbnd, &(pParentData->iOffset));
+      pNewNode = m_pNCManager->GetCtrlRoot(pParent, iLbnd, iHbnd, pParentData->iOffset); 
 
       // For now, just hack it so we get a normal root node here
       if(!pNewNode) {
-	pNewNode = m_pNCManager->GetRoot(0, pParent, iLbnd, iHbnd, NULL);
+	pNewNode = m_pNCManager->GetAlphRoot(pParent, iLbnd, iHbnd, NULL, -1);
       }
     }
     else if(iSymbol == m_pNCManager->GetStartConversionSymbol()) {
       //  else if(iSymbol == m_pNCManager->GetSpaceSymbol()) {
 
       // TODO: Need to consider the case where there is no compile-time support for this
-      pNewNode = m_pNCManager->GetRoot(2, pParent, iLbnd, iHbnd, &(pParentData->iOffset));
+      pNewNode = m_pNCManager->GetConvRoot(pParent, iLbnd, iHbnd, pParentData->iOffset);
     }
     else {
       int iPhase = (pParentData->iPhase + 1) % 2;
diff --git a/Src/DasherCore/AlphabetManager.h b/Src/DasherCore/AlphabetManager.h
index fd101f6..52ef484 100644
--- a/Src/DasherCore/AlphabetManager.h
+++ b/Src/DasherCore/AlphabetManager.h
@@ -61,8 +61,10 @@ namespace Dasher {
     ///
     /// Get a new root node owned by this manager
     ///
-
-    virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData);
+    // ACL note 12/8/09 - if previously passed in an SRootData (containing a char* and int),
+    //   then pass in the same char* and int here (the char* may be null); if previously passed
+    //   in null SRootData, then pass in szContext==null and iOffset==-1.
+    virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, char *szContext, int iOffset);
 
     ///
     /// Provide children for the supplied node
@@ -84,12 +86,6 @@ namespace Dasher {
 
     virtual void SetFlag(CDasherNode *pNode, int iFlag, bool bValue);
 
-    struct SRootData {
-      char *szContext;
-      int iOffset;
-    };
-
-
     struct SAlphabetData {
       symbol iSymbol;
       int iPhase;
diff --git a/Src/DasherCore/AlphabetManagerFactory.cpp b/Src/DasherCore/AlphabetManagerFactory.cpp
index 3328f0d..a8628c6 100644
--- a/Src/DasherCore/AlphabetManagerFactory.cpp
+++ b/Src/DasherCore/AlphabetManagerFactory.cpp
@@ -119,6 +119,6 @@ CAlphabetManagerFactory::~CAlphabetManagerFactory() {
   delete m_pAlphabetManager;
 }
 
-CDasherNode *CAlphabetManagerFactory::GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData) {
-  return m_pAlphabetManager->GetRoot(pParent, iLower, iUpper, pUserData);
+CDasherNode *CAlphabetManagerFactory::GetRoot(CDasherNode *pParent, int iLower, int iUpper, char *szContext, int iOffset) {
+  return m_pAlphabetManager->GetRoot(pParent, iLower, iUpper, szContext, iOffset);
 }
diff --git a/Src/DasherCore/AlphabetManagerFactory.h b/Src/DasherCore/AlphabetManagerFactory.h
index f93589f..9d19572 100644
--- a/Src/DasherCore/AlphabetManagerFactory.h
+++ b/Src/DasherCore/AlphabetManagerFactory.h
@@ -26,7 +26,7 @@ namespace Dasher {
     //    CAlphabetManagerFactory( CDasherModel *pModel, CLanguageModel *pLanguageModel, bool bGameMode, const std::string &strGameModeText );
     ~CAlphabetManagerFactory();
     
-    virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData);
+    virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, char *szContext, int iOffset);
     
     ///
     /// Functions for backwards compatibility - hopefully these will
diff --git a/Src/DasherCore/ControlManager.cpp b/Src/DasherCore/ControlManager.cpp
index add3b3e..000d63f 100644
--- a/Src/DasherCore/ControlManager.cpp
+++ b/Src/DasherCore/ControlManager.cpp
@@ -267,7 +267,7 @@ void CControlManager::DisconnectNode(int iChild, int iParent) {
 }
 
 
-CDasherNode *CControlManager::GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData) {
+CDasherNode *CControlManager::GetRoot(CDasherNode *pParent, int iLower, int iUpper, int iOffset) {
   CDasherNode *pNewNode;
 
   // TODO: Tie this structure to info contained in control map
@@ -278,8 +278,6 @@ CDasherNode *CControlManager::GetRoot(CDasherNode *pParent, int iLower, int iUpp
   pDisplayInfo->strDisplayText = m_mapControlMap[0]->strLabel;
   
   pNewNode = new CDasherNode(pParent, iLower, iUpper, pDisplayInfo);
-
-  int iOffset = *((int *)pUserData);
  
   // FIXME - handle context properly
 
@@ -316,14 +314,8 @@ void CControlManager::PopulateChildren( CDasherNode *pNode ) {
 
      if( *it == NULL ) {
        // Escape back to alphabet
-       CAlphabetManager::SRootData *pRootData = new CAlphabetManager::SRootData;
-
-       // TODO: Check that these are eventually getting deleted
-
-       pRootData->iOffset = (static_cast<SControlData *>(pNode->m_pUserData))->iOffset;
-       pRootData->szContext = NULL; // TODO: Fix this
 
-       pNewNode = m_pNCManager->GetRoot(0, pNode, iLbnd, iHbnd, pRootData);
+       pNewNode = m_pNCManager->GetAlphRoot(pNode, iLbnd, iHbnd, NULL/*TODO fix this*/, static_cast<SControlData *>(pNode->m_pUserData)->iOffset);
        pNewNode->SetFlag(NF_SEEN, false);
      }
      else {
diff --git a/Src/DasherCore/ControlManager.h b/Src/DasherCore/ControlManager.h
index b873c77..b48053f 100644
--- a/Src/DasherCore/ControlManager.h
+++ b/Src/DasherCore/ControlManager.h
@@ -94,7 +94,7 @@ namespace Dasher {
     /// Get a new root node owned by this manager
     ///
 
-    virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData);
+    virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, int iOffset);
 
     ///
     /// Provide children for the supplied node
diff --git a/Src/DasherCore/ConversionHelper.cpp b/Src/DasherCore/ConversionHelper.cpp
index 41eb624..6d5221a 100644
--- a/Src/DasherCore/ConversionHelper.cpp
+++ b/Src/DasherCore/ConversionHelper.cpp
@@ -52,8 +52,8 @@ CConversionHelper::CConversionHelper(CNodeCreationManager *pNCManager, CAlphabet
 
 }
 
-CDasherNode *CConversionHelper::GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData) {
-  CDasherNode *pNewNode = CConversionManager::GetRoot(pParent, iLower, iUpper, pUserData);
+CDasherNode *CConversionHelper::GetRoot(CDasherNode *pParent, int iLower, int iUpper, int iOffset) {
+  CDasherNode *pNewNode = CConversionManager::GetRoot(pParent, iLower, iUpper, iOffset);
 
   SConversionData *pNodeUserData = static_cast<SConversionData *>(pNewNode->m_pUserData);
 	
@@ -300,11 +300,7 @@ void CConversionHelper::PopulateChildren( CDasherNode *pNode ) {
       int iLbnd(0);
       int iHbnd(m_pNCManager->GetLongParameter(LP_NORMALIZATION));
 
-      CAlphabetManager::SRootData oRootData;
-      oRootData.szContext = NULL;
-      oRootData.iOffset = pCurrentDataNode->iOffset;
-
-      pNewNode = m_pNCManager->GetRoot(0, pNode, iLbnd, iHbnd, &oRootData);
+      pNewNode = m_pNCManager->GetAlphRoot(pNode, iLbnd, iHbnd, NULL, pCurrentDataNode->iOffset);
       pNewNode->SetFlag(NF_SEEN, false);
 
       pNode->Children().push_back(pNewNode);
diff --git a/Src/DasherCore/ConversionHelper.h b/Src/DasherCore/ConversionHelper.h
index 9e4efd7..ad6b593 100644
--- a/Src/DasherCore/ConversionHelper.h
+++ b/Src/DasherCore/ConversionHelper.h
@@ -101,7 +101,7 @@ namespace Dasher{
     /// Get a new root node owned by this manager
     ///
 	
-    virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData);
+    virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, int iOffset);
 	
     ///
     /// Calculate sizes for each of the children - default
diff --git a/Src/DasherCore/ConversionManager.cpp b/Src/DasherCore/ConversionManager.cpp
index 8d757b9..17c5a01 100644
--- a/Src/DasherCore/ConversionManager.cpp
+++ b/Src/DasherCore/ConversionManager.cpp
@@ -56,11 +56,9 @@ CConversionManager::CConversionManager(CNodeCreationManager *pNCManager, CAlphab
   */
 }
 
-CDasherNode *CConversionManager::GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData) {
+CDasherNode *CConversionManager::GetRoot(CDasherNode *pParent, int iLower, int iUpper, int iOffset) {
   CDasherNode *pNewNode;
 
-  int iOffset = *(static_cast<int *>(pUserData));
-
   // TODO: Parameters here are placeholders - need to figure out what's right
 
   CDasherNode::SDisplayInfo *pDisplayInfo = new CDasherNode::SDisplayInfo;
@@ -106,12 +104,7 @@ void CConversionManager::PopulateChildren( CDasherNode *pNode ) {
   int iLbnd(0);
   int iHbnd(m_pNCManager->GetLongParameter(LP_NORMALIZATION));
 
-
-  CAlphabetManager::SRootData oRootData;
-  oRootData.szContext = NULL;
-  oRootData.iOffset = pCurrentDataNode->iOffset + 1;
-
-  pNewNode = m_pNCManager->GetRoot(0, pNode, iLbnd, iHbnd, &oRootData);
+  pNewNode = m_pNCManager->GetAlphRoot(pNode, iLbnd, iHbnd, NULL, pCurrentDataNode->iOffset + 1);
   pNewNode->SetFlag(NF_SEEN, false);
 
   pNode->Children().push_back(pNewNode);
diff --git a/Src/DasherCore/ConversionManager.h b/Src/DasherCore/ConversionManager.h
index 7a1463c..9fea557 100644
--- a/Src/DasherCore/ConversionManager.h
+++ b/Src/DasherCore/ConversionManager.h
@@ -90,7 +90,7 @@ namespace Dasher {
     /// Get a new root node owned by this manager
     ///
 
-    virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData);
+    virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, int iOffset);
 
     ///
     /// Provide children for the supplied node
diff --git a/Src/DasherCore/ConversionManagerFactory.cpp b/Src/DasherCore/ConversionManagerFactory.cpp
index ea9aaa7..f6a7e10 100644
--- a/Src/DasherCore/ConversionManagerFactory.cpp
+++ b/Src/DasherCore/ConversionManagerFactory.cpp
@@ -37,8 +37,8 @@ CConversionManagerFactory::CConversionManagerFactory(Dasher::CEventHandler *pEve
   m_iCMCount = 0; // Unique identifier passed to conversion managers
 }
 
-CDasherNode *CConversionManagerFactory::GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData) {
-  return m_pMgr->GetRoot(pParent, iLower, iUpper, pUserData);
+CDasherNode *CConversionManagerFactory::GetRoot(CDasherNode *pParent, int iLower, int iUpper, int iOffset) {
+  return m_pMgr->GetRoot(pParent, iLower, iUpper, iOffset);
 }
 
 CConversionManagerFactory::~CConversionManagerFactory() {
diff --git a/Src/DasherCore/ConversionManagerFactory.h b/Src/DasherCore/ConversionManagerFactory.h
index a25d197..36cecba 100644
--- a/Src/DasherCore/ConversionManagerFactory.h
+++ b/Src/DasherCore/ConversionManagerFactory.h
@@ -15,7 +15,7 @@ namespace Dasher {
   class CConversionManagerFactory {
   public:
     CConversionManagerFactory(Dasher::CEventHandler *pEventHandler,  CSettingsStore *pSettingsStore, CNodeCreationManager *pNCManager, int iID, Dasher::CAlphIO *pCAlphIO, CAlphabet *pAlphabet);
-    virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData);
+    virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, int iOffset);
     ~CConversionManagerFactory();
 
   private:
diff --git a/Src/DasherCore/DasherModel.cpp b/Src/DasherCore/DasherModel.cpp
index 01c6f00..9379412 100644
--- a/Src/DasherCore/DasherModel.cpp
+++ b/Src/DasherCore/DasherModel.cpp
@@ -323,21 +323,17 @@ void CDasherModel::InitialiseAtOffset(int iOffset, CDasherView *pView) {
   DeleteTree();
 
   if(iOffset == 0)
-    m_Root = m_pNodeCreationManager->GetRoot(0, NULL, 0,GetLongParameter(LP_NORMALIZATION), NULL);
+    m_Root = m_pNodeCreationManager->GetAlphRoot(NULL, 0,GetLongParameter(LP_NORMALIZATION), NULL, -1);
   else {
     // Get the most recent character
     std::string strContext = m_pDasherInterface->GetContext(iOffset - 1, 1);
 
-    CAlphabetManager::SRootData oData;
+    char *szContext = new char[strContext.size() + 1];
+    strcpy(szContext, strContext.c_str());
 
-    oData.szContext = new char[strContext.size() + 1];
-    strcpy(oData.szContext, strContext.c_str());
+    m_Root = m_pNodeCreationManager->GetAlphRoot(NULL, 0, GetLongParameter(LP_NORMALIZATION), szContext, iOffset);
 
-    oData.iOffset = iOffset;
-
-    m_Root = m_pNodeCreationManager->GetRoot(0, NULL, 0, GetLongParameter(LP_NORMALIZATION), &oData);
-
-    delete[] oData.szContext;
+    delete[] szContext;
   }
 
   m_pLastOutput = m_Root;
diff --git a/Src/DasherCore/MandarinAlphMgr.cpp b/Src/DasherCore/MandarinAlphMgr.cpp
index 5f37fc9..feb0399 100644
--- a/Src/DasherCore/MandarinAlphMgr.cpp
+++ b/Src/DasherCore/MandarinAlphMgr.cpp
@@ -49,9 +49,9 @@ CMandarinAlphMgr::CMandarinAlphMgr(CDasherInterfaceBase *pInterface, CNodeCreati
   : CAlphabetManager(pInterface, pNCManager, pLanguageModel, iLearnContext) {
 }
 
-CDasherNode *CMandarinAlphMgr::GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData) {
+CDasherNode *CMandarinAlphMgr::GetRoot(CDasherNode *pParent, int iLower, int iUpper, char *szContext, int iOffset) {
 
-  CDasherNode *pNewNode = CAlphabetManager::GetRoot(pParent, iLower, iUpper, pUserData);
+  CDasherNode *pNewNode = CAlphabetManager::GetRoot(pParent, iLower, iUpper, szContext, iOffset);
   SAlphabetData *pNodeUserData = static_cast<SAlphabetData *>(pNewNode->m_pUserData);
 
   //Override context for Mandarin Dasher
@@ -72,7 +72,7 @@ CDasherNode *CMandarinAlphMgr::CreateSymbolNode(CDasherNode *pParent, symbol iSy
 
     //Modified for Mandarin Dasher
     //The following logic switch allows punctuation nodes in Mandarin to be treated in the same way as English (i.e. display and populate next round) instead of invoking a conversion node
-	  CDasherNode *pNewNode = m_pNCManager->GetRoot(2, pParent, iLbnd, iHbnd, &(pParentData->iOffset));
+	  CDasherNode *pNewNode = m_pNCManager->GetConvRoot(pParent, iLbnd, iHbnd, pParentData->iOffset);
 	  static_cast<SAlphabetData *>(pNewNode->m_pUserData)->iSymbol = iSymbol;
 	  return pNewNode;
   }
diff --git a/Src/DasherCore/MandarinAlphMgr.h b/Src/DasherCore/MandarinAlphMgr.h
index 29dab37..59da8fd 100644
--- a/Src/DasherCore/MandarinAlphMgr.h
+++ b/Src/DasherCore/MandarinAlphMgr.h
@@ -41,7 +41,7 @@ namespace Dasher {
     /// Get a new root node owned by this manager
     ///
 
-    virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData);
+    virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, char *szContext, int iOffset);
 
     virtual void SetFlag(CDasherNode *pNode, int iFlag, bool bValue);
 
diff --git a/Src/DasherCore/NodeCreationManager.cpp b/Src/DasherCore/NodeCreationManager.cpp
index 67a1486..d6498c8 100644
--- a/Src/DasherCore/NodeCreationManager.cpp
+++ b/Src/DasherCore/NodeCreationManager.cpp
@@ -75,26 +75,23 @@ void CNodeCreationManager::DisconnectNode(int iChild, int iParent) {
     m_pControlManager->DisconnectNode(iChild, iParent);
 }
 
-CDasherNode *CNodeCreationManager::GetRoot(int iType, Dasher::CDasherNode *pParent, int iLower, int iUpper, void *pUserData ) {
-
-  switch(iType) {
-  case 0:
-    return m_pAlphabetManagerFactory->GetRoot(pParent, iLower, iUpper, pUserData);
-  case 1:
-    if(m_pControlManager)
-      return m_pControlManager->GetRoot(pParent, iLower, iUpper, pUserData);
-    else
-      return NULL;
-  case 2:
-    if(m_pConversionManagerFactory)
-      return m_pConversionManagerFactory->GetRoot(pParent, iLower, iUpper, pUserData);
-    else
-      return NULL;
-  default:
-    return NULL;
-  }
+CDasherNode *CNodeCreationManager::GetAlphRoot(Dasher::CDasherNode *pParent, int iLower, int iUpper, char *szContext, int iOffset) { 
+ return m_pAlphabetManagerFactory->GetRoot(pParent, iLower, iUpper, szContext, iOffset);
+}
+
+CDasherNode *CNodeCreationManager::GetCtrlRoot(Dasher::CDasherNode *pParent, int iLower, int iUpper, int iOffset) { 
+ if(m_pControlManager)
+ return m_pControlManager->GetRoot(pParent, iLower, iUpper, iOffset);
+ else
+ return NULL;
 }
 
+CDasherNode *CNodeCreationManager::GetConvRoot(Dasher::CDasherNode *pParent, int iLower, int iUpper, int iOffset) { 
+ if(m_pConversionManagerFactory)
+ return m_pConversionManagerFactory->GetRoot(pParent, iLower, iUpper, iOffset);
+ else
+ return NULL;
+}
 
 void CNodeCreationManager::GetProbs(CLanguageModel::Context context, std::vector <symbol >&NewSymbols, std::vector <unsigned int >&Probs, int iNorm) const {
   // Total number of symbols
diff --git a/Src/DasherCore/NodeCreationManager.h b/Src/DasherCore/NodeCreationManager.h
index 5c0a561..9042ae8 100644
--- a/Src/DasherCore/NodeCreationManager.h
+++ b/Src/DasherCore/NodeCreationManager.h
@@ -29,10 +29,12 @@ class CNodeCreationManager : public Dasher::CDasherComponent {
   ~CNodeCreationManager();
   
   ///
-  /// Get a root node of a given type
+  /// Get a root node of a particular type
   ///
 
-  Dasher::CDasherNode *GetRoot(int iType, Dasher::CDasherNode *pParent, int iLower, int iUpper, void *pUserData);
+  Dasher::CDasherNode *GetAlphRoot(Dasher::CDasherNode *pParent, int iLower, int iUpper, char *szContext, int iOffset);
+  Dasher::CDasherNode *GetCtrlRoot(Dasher::CDasherNode *pParent, int iLower, int iUpper, int iOffset);
+  Dasher::CDasherNode *GetConvRoot(Dasher::CDasherNode *pParent, int iLower, int iUpper, int iOffset);
 
   ///
   /// Register a control node
diff --git a/Src/DasherCore/NodeManager.h b/Src/DasherCore/NodeManager.h
index 8902091..a51b169 100644
--- a/Src/DasherCore/NodeManager.h
+++ b/Src/DasherCore/NodeManager.h
@@ -80,10 +80,9 @@ namespace Dasher {
 
     ///
     /// Get a new root node owned by this manager
-    ///
-
-
-    virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData) = 0;
+    /// ACL 12/8/09 this is never called polymorphically;
+    /// hence deleting it so subclasses can each use different types
+    //virtual CDasherNode *GetRoot(CDasherNode *pParent, int iLower, int iUpper, void *pUserData) = 0;
 
     ///
     /// Provide children for the supplied node



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]