Index: /vtcross/trunk/src/cognitive_engines/DSA_CE/DSA_CognitiveEngine.cpp
===================================================================
--- /vtcross/trunk/src/cognitive_engines/DSA_CE/DSA_CognitiveEngine.cpp	(revision 469)
+++ /vtcross/trunk/src/cognitive_engines/DSA_CE/DSA_CognitiveEngine.cpp	(revision 475)
@@ -19,4 +19,5 @@
 #include <stdint.h>
 #include <cmath>
+#include <string>
 
 #include "vtcross/cbr.h"
@@ -124,7 +125,7 @@
     float valList[numberColumns];
     float obsVals[numberColumns];
-    char *nameList[numberColumns];
-    char *obsList[obsColumns];
-    char *searchNames[1];
+    string nameList[numberColumns];
+    string obsList[obsColumns];
+    string searchNames[1];
     float searchVals[1];
     int searchOps[1];
@@ -133,14 +134,14 @@
     size_t columnObsIndex = 0;
     for (size_t i = 0; i < radioInfo->numObservables; i++){
-        obsList[columnObsIndex] = (char*)observables[i].name.c_str();
+        obsList[columnObsIndex] = observables[i].name;
         columnObsIndex++;
     }  
    
     std::string utility_name = "utility"; 
-    obsList[columnObsIndex] = (char*) utility_name.c_str();
+    obsList[columnObsIndex] = utility_name;
 
     size_t columnIndex = 0;
     for (size_t i = 0; i < radioInfo->numParameters; i++){
-        nameList[columnIndex] = (char*)parameters[i].name.c_str();
+        nameList[columnIndex] = parameters[i].name;
         columnIndex++;
     }   
@@ -154,5 +155,5 @@
     /* Make sure we do not return any entries for the current channel */
     std::string channel_name = "channel";
-    searchNames[0] = (char *) channel_name.c_str();
+    searchNames[0] = channel_name;
     searchOps[0] = 0;
     searchVals[0] = parameters[0].value; 
@@ -671,12 +672,11 @@
 
     uint32_t channel = 0;
-    char *searchNames[1];
-    char *sumSearchName;
+    string searchNames[1];
+    string sumSearchName;
     float searchVals[1];
     float utilArray[(int)pList[0].max];
     int searchOps[1];
-    uint32_t numberColumns = radioInfo->numUtilities +
-        			radioInfo->numParameters +
-        			radioInfo->numObservables + 1;
+    uint32_t numberColumns = radioInfo->numUtilities + radioInfo->numParameters + \
+                             radioInfo->numObservables + 1;
 
     float returnValues[numberColumns];
@@ -685,10 +685,9 @@
     // Total sum of utilities in sumRetVals[0]
 
-    std::string channel_name = "channel";
-    std::string utility_name = "utility";
-
-    for( int i = 0 ; i < pList[0].max ; i++ ) {
-
-        searchNames[0] = (char*) pList[0].name.c_str();
+    string channel_name = "channel";
+    string utility_name = "utility";
+
+    for(int32_t i = 0 ; i < pList[0].max ; i++ ) {
+        searchNames[0] = pList[0].name;
         searchOps[0] = 0;
         searchVals[0] = i+1; 
@@ -700,12 +699,12 @@
 		// No entry - must add
 		
-    		char *rowNames[numberColumns];
+    		string rowNames[numberColumns];
     		size_t rowIndex = 0;
     		for(size_t j = 0; j < radioInfo->numUtilities; j++) {
-        		rowNames[rowIndex] = (char*)uList[j].name.c_str();
+        		rowNames[rowIndex] = uList[j].name;
         		rowIndex++;
     		}
     		for(size_t j = 0; j < radioInfo->numParameters; j++) {
-        		rowNames[rowIndex] = (char*)pList[j].name.c_str();
+        		rowNames[rowIndex] = pList[j].name;
 			if(pList[j].name == "channel")
 				returnValues[rowIndex] = i+1;
@@ -713,9 +712,9 @@
     		}
     		for(size_t j = 0; j < radioInfo->numObservables; j++) {
-        		rowNames[rowIndex] = (char*)oList[j].name.c_str();
+        		rowNames[rowIndex] = oList[j].name;
         		rowIndex++;
     		}
    
-    		rowNames[rowIndex] = (char *) utility_name.c_str();
+    		rowNames[rowIndex] = utility_name;
 		returnValues[rowIndex] = 500;
 
@@ -730,5 +729,5 @@
         printf("1: %f\t2: %f\t3: %f\t4: %f\n",utilArray[0],utilArray[1],utilArray[2],utilArray[3]);    
     // Get sum of all the channel utilities.
-    sumSearchName = (char *) utility_name.c_str();
+    sumSearchName = utility_name;
     uint32_t rc = myCBR->SearchSum(sumSearchName, sumRetVals);
 
@@ -745,5 +744,5 @@
     }
         
-    searchNames[0] = (char*) pList[0].name.c_str();
+    searchNames[0] = pList[0].name;
     searchOps[0] = 0;
     searchVals[0] = channel; 
@@ -774,22 +773,22 @@
     //returnValues[returnValueIndex] = 0;
 
-    char *allNames[numberColumns];
+    string allNames[numberColumns];
     size_t allNameIndex = 0;
     for(size_t i = 0; i < radioInfo->numUtilities; i++) {
-        allNames[allNameIndex] = (char*)uList[i].name.c_str();
+        allNames[allNameIndex] = uList[i].name;
         returnValues[allNameIndex] = uList[i].target;
         allNameIndex++;
     }
     for(size_t i = 0; i < radioInfo->numParameters; i++) {
-        allNames[allNameIndex] = (char*)pList[i].name.c_str();
+        allNames[allNameIndex] = pList[i].name;
         allNameIndex++;
     }
     for(size_t i = 0; i < radioInfo->numObservables; i++) {
-        allNames[allNameIndex] = (char*)oList[i].name.c_str();
+        allNames[allNameIndex] = oList[i].name;
     //    returnValues[allNameIndex] = 0;
         allNameIndex++;
     }
    
-    allNames[allNameIndex] = (char *) utility_name.c_str();
+    allNames[allNameIndex] = utility_name;
 
     /* Add the new optimized set to the CBR database */
@@ -823,26 +822,24 @@
 CognitiveEngine::BuildCognitiveEngine()
 {
-    char filename[] = {"ex1"};
-    char tablename[] = {"data"};
-
-    uint32_t numberColumns = 
-        radioInfo->numUtilities +
-        radioInfo->numParameters +
-        radioInfo->numObservables + 1;
-
-    char *cols[numberColumns];
+    string filename = "ex1";
+    string tablename = "data";
+
+    uint32_t numberColumns = radioInfo->numUtilities + radioInfo->numParameters + \
+                             radioInfo->numObservables + 1;
+
+    string cols[numberColumns];
 
     size_t columnIndex = 0;
     for (size_t i = 0; i < radioInfo->numUtilities; i++){
-        cols[columnIndex] = (char*)uList[i].name.c_str();
+        cols[columnIndex] = uList[i].name;
         columnIndex++;
     }   
 
-    char *paramCols[radioInfo->numParameters];
+    string paramCols[radioInfo->numParameters];
     size_t paramColumnIndex = 0;
     // Also need to make parameters the unique key 
     for (size_t i = 0; i < radioInfo->numParameters; i++){
-        cols[columnIndex] = (char*)pList[i].name.c_str();
-        paramCols[paramColumnIndex] = (char*)pList[i].name.c_str();
+        cols[columnIndex] = pList[i].name;
+        paramCols[paramColumnIndex] = pList[i].name;
         columnIndex++;
         paramColumnIndex++;
@@ -850,10 +847,10 @@
 
     for (size_t i = 0; i < radioInfo->numObservables; i++){
-        cols[columnIndex] = (char*)oList[i].name.c_str();
+        cols[columnIndex] = oList[i].name;
         columnIndex++;
     }   
    
     std::string utility_name = "utility"; 
-    cols[columnIndex] = (char *)utility_name.c_str();
+    cols[columnIndex] = utility_name;
 
     myCBR = new CBR(filename, tablename, cols, paramCols, numberColumns, radioInfo->numParameters);
