[dasher] Remove SControlData structure and use its single member directly.



commit a1537bb551eea95d55c840e3ed6ad6e091b8df1f
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Sat Aug 22 14:04:02 2009 +0100

    Remove SControlData structure and use its single member directly.

 ChangeLog                         |    1 +
 Src/DasherCore/ControlManager.cpp |   18 +++---------------
 Src/DasherCore/ControlManager.h   |    4 ----
 3 files changed, 4 insertions(+), 19 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5222f47..ee63085 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2009-08-22  Alan Lawrence <acl33 inf phy cam ac uk>
 
 	* Move iOffset field into DasherNode (now m_iOffset).
+	* Remove SControlData structure and use its single member directly.
 
 2009-08-21  Alan Lawrence <acl33 inf phy cam ac uk>
 
diff --git a/Src/DasherCore/ControlManager.cpp b/Src/DasherCore/ControlManager.cpp
index 9a444df..a769ab8 100644
--- a/Src/DasherCore/ControlManager.cpp
+++ b/Src/DasherCore/ControlManager.cpp
@@ -285,13 +285,9 @@ CDasherNode *CControlManager::GetRoot(CDasherNode *pParent, int iLower, int iUpp
 
   pNewNode->m_pNodeManager = this;
 
-  SControlData *pNodeUserData = new SControlData;
-
-  pNodeUserData->pControlNode = m_mapControlMap[0];
+  pNewNode->m_pUserData = m_mapControlMap[0];
   pNewNode->m_iOffset = iOffset;
 
-  pNewNode->m_pUserData = pNodeUserData;
-
   return pNewNode;
 }
 
@@ -299,7 +295,7 @@ void CControlManager::PopulateChildren( CDasherNode *pNode ) {
   
   CDasherNode *pNewNode;
 
-   CControlNode *pControlNode((static_cast<SControlData *>(pNode->m_pUserData))->pControlNode);
+   CControlNode *pControlNode(static_cast<CControlNode *>(pNode->m_pUserData));
 
    int iNChildren( pControlNode->vChildren.size() );
 
@@ -336,14 +332,7 @@ void CControlManager::PopulateChildren( CDasherNode *pNode ) {
 
        pNewNode->m_pNodeManager = this;
        pNewNode->m_pUserData = *it;
-
-       SControlData *pNodeUserData = new SControlData;
-
-       pNodeUserData->pControlNode = *it;
        pNewNode->m_iOffset = pNode->m_iOffset;
-
-       pNewNode->m_pUserData = pNodeUserData;
-
      }
      pNode->Children().push_back(pNewNode);
      ++iIdx;
@@ -351,12 +340,11 @@ void CControlManager::PopulateChildren( CDasherNode *pNode ) {
 }
 
 void CControlManager::ClearNode( CDasherNode *pNode ) {
-  delete (static_cast<SControlData *>(pNode->m_pUserData));
 }
 
 void CControlManager::Output( CDasherNode *pNode, Dasher::VECTOR_SYMBOL_PROB* pAdded, int iNormalization ) {
 
-  CControlNode *pControlNode((static_cast<SControlData *>(pNode->m_pUserData))->pControlNode);
+  CControlNode *pControlNode(static_cast<CControlNode *>(pNode->m_pUserData));
 
   CControlEvent oEvent(pControlNode->iID);
   // TODO: Need to reimplement this
diff --git a/Src/DasherCore/ControlManager.h b/Src/DasherCore/ControlManager.h
index 63bf858..172f112 100644
--- a/Src/DasherCore/ControlManager.h
+++ b/Src/DasherCore/ControlManager.h
@@ -135,10 +135,6 @@ namespace Dasher {
     CLanguageModel *m_pLanguageModel;
     std::map<int,CControlNode*> m_mapControlMap;
 
-    struct SControlData {
-      CControlNode *pControlNode;
-    };
-
     ///Whether we'd temporarily disabled Automatic Speed Control
     ///(if _and only if_ so, should re-enable it when leaving a node)
     bool bDisabledSpeedControl;



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