[dasher: 10/27] CDasherNode::GetContext takes CAlphabet* to use, rather than get from DashIntf



commit 82825d338871a48986a0fe0e49bea2e3c35950cb
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Thu Aug 5 23:03:18 2010 +0100

    CDasherNode::GetContext takes CAlphabet* to use, rather than get from DashIntf

 Src/DasherCore/AlphabetManager.cpp   |    8 ++++----
 Src/DasherCore/AlphabetManager.h     |    2 +-
 Src/DasherCore/ConversionManager.cpp |    6 +++---
 Src/DasherCore/ConversionManager.h   |    2 +-
 Src/DasherCore/DasherNode.cpp        |    6 +++---
 Src/DasherCore/DasherNode.h          |    2 +-
 6 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/Src/DasherCore/AlphabetManager.cpp b/Src/DasherCore/AlphabetManager.cpp
index 81372de..4317dd2 100644
--- a/Src/DasherCore/AlphabetManager.cpp
+++ b/Src/DasherCore/AlphabetManager.cpp
@@ -93,7 +93,7 @@ CAlphabetManager::CAlphNode *CAlphabetManager::GetRoot(CDasherNode *pParent, uns
   int iStart = max(0, iNewOffset - m_pLanguageModel->GetContextLength());
   
   if(pParent) {
-    pParent->GetContext(m_pInterface, vContextSymbols, iStart, iNewOffset+1 - iStart);
+    pParent->GetContext(m_pInterface, m_pAlphabet, vContextSymbols, iStart, iNewOffset+1 - iStart);
   } else {
     std::string strContext = (iNewOffset == -1) 
       ? m_pAlphabet->GetDefaultContext()
@@ -163,12 +163,12 @@ CLanguageModel::Context CAlphabetManager::CAlphNode::CloneAlphContext(CLanguageM
   return CDasherNode::CloneAlphContext(pLanguageModel);
 }
 
-void CAlphabetManager::CSymbolNode::GetContext(CDasherInterfaceBase *pInterface, vector<symbol> &vContextSymbols, int iOffset, int iLength) {
+void CAlphabetManager::CSymbolNode::GetContext(CDasherInterfaceBase *pInterface, const CAlphabet *pAlphabet, vector<symbol> &vContextSymbols, int iOffset, int iLength) {
   if (!GetFlag(NF_SEEN) && iOffset+iLength-1 == offset()) {
-    if (iLength > 1) Parent()->GetContext(pInterface, vContextSymbols, iOffset, iLength-1);
+    if (iLength > 1) Parent()->GetContext(pInterface, pAlphabet, vContextSymbols, iOffset, iLength-1);
     vContextSymbols.push_back(iSymbol);
   } else {
-    CDasherNode::GetContext(pInterface, vContextSymbols, iOffset, iLength);
+    CDasherNode::GetContext(pInterface, pAlphabet, vContextSymbols, iOffset, iLength);
   }
 }
 
diff --git a/Src/DasherCore/AlphabetManager.h b/Src/DasherCore/AlphabetManager.h
index 6ab9c82..598646e 100644
--- a/Src/DasherCore/AlphabetManager.h
+++ b/Src/DasherCore/AlphabetManager.h
@@ -87,7 +87,7 @@ namespace Dasher {
       virtual void SetFlag(int iFlag, bool bValue);
 
       virtual bool GameSearchNode(std::string strTargetUtf8Char);
-      virtual void GetContext(CDasherInterfaceBase *pInterface, std::vector<symbol> &vContextSymbols, int iOffset, int iLength);
+      virtual void GetContext(CDasherInterfaceBase *pInterface, const CAlphabet *pAlphabet, std::vector<symbol> &vContextSymbols, int iOffset, int iLength);
       virtual symbol GetAlphSymbol();
       const symbol iSymbol;
       virtual CDasherNode *RebuildSymbol(CAlphNode *pParent, symbol iSymbol, unsigned int iLbnd, unsigned int iHbnd);
diff --git a/Src/DasherCore/ConversionManager.cpp b/Src/DasherCore/ConversionManager.cpp
index 406d589..1fbeeaa 100644
--- a/Src/DasherCore/ConversionManager.cpp
+++ b/Src/DasherCore/ConversionManager.cpp
@@ -121,7 +121,7 @@ void CConversionManager::RecursiveDumpTree(SCENode *pCurrent, unsigned int iDept
   }
 }
 
-void CConversionManager::CConvNode::GetContext(CDasherInterfaceBase *pInterface, std::vector<symbol> &vContextSymbols, int iOffset, int iLength) {
+void CConversionManager::CConvNode::GetContext(CDasherInterfaceBase *pInterface, const CAlphabet *pAlphabet, std::vector<symbol> &vContextSymbols, int iOffset, int iLength) {
   if (!GetFlag(NF_SEEN) && iOffset+iLength-1 == offset()) {
     //ACL I'm extrapolating from PinYinConversionHelper (in which root nodes have their
     // Symbol set by SetConvSymbol, and child nodes are created in PopulateChildren
@@ -131,12 +131,12 @@ void CConversionManager::CConvNode::GetContext(CDasherInterfaceBase *pInterface,
     // everywhere!)
     DASHER_ASSERT(bisRoot || pSCENode);
     if (bisRoot || pSCENode->Symbol!=-1) {
-      if (iLength>1) Parent()->GetContext(pInterface, vContextSymbols, iOffset, iLength-1);
+      if (iLength>1) Parent()->GetContext(pInterface, pAlphabet, vContextSymbols, iOffset, iLength-1);
       vContextSymbols.push_back(bisRoot ? iSymbol : pSCENode->Symbol);
       return;
     } //else, non-root with pSCENode->Symbol==-1 => fallthrough back to superclass code
   }
-  CDasherNode::GetContext(pInterface, vContextSymbols, iOffset, iLength);
+  CDasherNode::GetContext(pInterface, pAlphabet, vContextSymbols, iOffset, iLength);
 }
 
 void CConversionManager::CConvNode::Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, int iNormalization) {
diff --git a/Src/DasherCore/ConversionManager.h b/Src/DasherCore/ConversionManager.h
index ff2c1ed..a72f54c 100644
--- a/Src/DasherCore/ConversionManager.h
+++ b/Src/DasherCore/ConversionManager.h
@@ -93,7 +93,7 @@ namespace Dasher {
     ~CConvNode();
 
     ///Attempts to fill vContextSymbols with the context that would exist _after_ this node has been entered
-    void GetContext(CDasherInterfaceBase *pInterface, std::vector<symbol> &vContextSymbols, int iOffset, int iLength);
+    void GetContext(CDasherInterfaceBase *pInterface, const CAlphabet *pAlphabet, std::vector<symbol> &vContextSymbols, int iOffset, int iLength);
 
     ///
     /// Called whenever a node belonging to this manager first 
diff --git a/Src/DasherCore/DasherNode.cpp b/Src/DasherCore/DasherNode.cpp
index 0fb1ab6..cb0f00c 100644
--- a/Src/DasherCore/DasherNode.cpp
+++ b/Src/DasherCore/DasherNode.cpp
@@ -96,13 +96,13 @@ void CDasherNode::Trace() const {
    */
 }
 
-void CDasherNode::GetContext(CDasherInterfaceBase *pInterface, vector<symbol> &vContextSymbols, int iOffset, int iLength) {
+void CDasherNode::GetContext(CDasherInterfaceBase *pInterface, const CAlphabet *pAlphabet, vector<symbol> &vContextSymbols, int iOffset, int iLength) {
   if (!GetFlag(NF_SEEN)) {
     DASHER_ASSERT(m_pParent);
-    if (m_pParent) m_pParent->GetContext(pInterface, vContextSymbols, iOffset,iLength);
+    if (m_pParent) m_pParent->GetContext(pInterface, pAlphabet, vContextSymbols, iOffset,iLength);
   } else {
     std::string strContext = pInterface->GetContext(iOffset, iLength);
-    pInterface->GetAlphabet()->GetSymbols(vContextSymbols, strContext);
+    pAlphabet->GetSymbols(vContextSymbols, strContext);
   }
 }
 
diff --git a/Src/DasherCore/DasherNode.h b/Src/DasherCore/DasherNode.h
index 9c7265b..9523014 100644
--- a/Src/DasherCore/DasherNode.h
+++ b/Src/DasherCore/DasherNode.h
@@ -246,7 +246,7 @@ class Dasher::CDasherNode:private NoClones {
   /// Get as many symbols of context, up to the _end_ of the specified range,
   /// as possible from this node and its uncommitted ancestors
   ///
-  virtual void GetContext(CDasherInterfaceBase *pInterface, std::vector<symbol> &vContextSymbols, int iOffset, int iLength);
+  virtual void GetContext(CDasherInterfaceBase *pInterface, const CAlphabet *pAlphabet, std::vector<symbol> &vContextSymbols, int iOffset, int iLength);
   
   ///
   /// See if this node represents the specified alphanumeric character; if so, set it's NF_GAME flag and



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