Changeset 469 for vtcross/trunk/src/cognitive_engines/DSA_CE
- Timestamp:
- 09/07/09 17:28:20 (15 years ago)
- Location:
- vtcross/trunk/src/cognitive_engines/DSA_CE
- Files:
-
- 1 removed
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
vtcross/trunk/src/cognitive_engines/DSA_CE/DSA_CognitiveEngine.cpp
r465 r469 18 18 #include <cstring> 19 19 #include <stdint.h> 20 #include <math.h> 21 20 #include <cmath> 21 22 #include "vtcross/cbr.h" 22 23 #include "vtcross/cognitive_engine.h" 23 24 #include "vtcross/common.h" … … 27 28 #include "vtcross/error.h" 28 29 #include "vtcross/socketcomm.h" 29 #include "vtcross/cbr.h" 30 31 // TODO this is really bad; need to move to a proper cbr.h 32 #include "cbr.c" 33 34 #include "sqlite3.h" 35 #include "sqlite3ext.h" 30 36 31 37 32 #define INTERFERENCE 0 … … 45 40 46 41 47 48 static cbr myCBR; 42 static CBR *myCBR; 49 43 50 44 … … 60 54 CognitiveEngine::~CognitiveEngine() 61 55 { 62 cbr_free(myCBR);56 delete myCBR; 63 57 delete [] pList; 64 58 delete [] oList; … … 161 155 std::string channel_name = "channel"; 162 156 searchNames[0] = (char *) channel_name.c_str(); 163 searchOps[0] = EQ;157 searchOps[0] = 0; 164 158 searchVals[0] = parameters[0].value; 165 159 166 160 /* Execute CBR search and put output into returnValues */ 167 cbr_search(myCBR,searchNames, searchOps, searchVals,161 myCBR->Search(searchNames, searchOps, searchVals, 168 162 1, returnValues); 169 163 … … 197 191 } 198 192 199 cbr_update(myCBR,nameList, obsList, valList, obsVals,193 myCBR->Update(nameList, obsList, valList, obsVals, 200 194 numberColumns, obsColumns); 201 195 } … … 697 691 698 692 searchNames[0] = (char*) pList[0].name.c_str(); 699 searchOps[0] = EQ;693 searchOps[0] = 0; 700 694 searchVals[0] = i+1; 701 695 702 uint32_t rc = cbr_search(myCBR,searchNames, searchOps, searchVals,696 uint32_t rc = myCBR->Search(searchNames, searchOps, searchVals, 703 697 1, returnValues); 704 698 … … 728 722 /* Add the new optimized set to the CBR database */ 729 723 730 cbr_add_row(myCBR,rowNames, returnValues, numberColumns);724 myCBR->AddRow(rowNames, returnValues, numberColumns); 731 725 } 732 726 … … 737 731 // Get sum of all the channel utilities. 738 732 sumSearchName = (char *) utility_name.c_str(); 739 uint32_t rc = cbr_search_sum(myCBR,sumSearchName, sumRetVals);733 uint32_t rc = myCBR->SearchSum(sumSearchName, sumRetVals); 740 734 741 735 // Psuedo random channel selection based upon utility. … … 752 746 753 747 searchNames[0] = (char*) pList[0].name.c_str(); 754 searchOps[0] = EQ;748 searchOps[0] = 0; 755 749 searchVals[0] = channel; 756 750 757 rc = cbr_search(myCBR,searchNames, searchOps, searchVals,751 rc = myCBR->Search(searchNames, searchOps, searchVals, 758 752 1, returnValues); 759 753 … … 800 794 801 795 /* Add the new optimized set to the CBR database */ 802 cbr_add_row(myCBR,allNames, returnValues, returnValueIndex+1);796 myCBR->AddRow(allNames, returnValues, returnValueIndex+1); 803 797 804 798 … … 863 857 cols[columnIndex] = (char *)utility_name.c_str(); 864 858 865 myCBR = cbr_create_with_primary(filename, tablename, cols, paramCols, numberColumns, radioInfo->numParameters);866 } 867 859 myCBR = new CBR(filename, tablename, cols, paramCols, numberColumns, radioInfo->numParameters); 860 } 861 -
vtcross/trunk/src/cognitive_engines/DSA_CE/Makefile.am
r411 r469 20 20 21 21 bin_PROGRAMS = DSA_Demo 22 include_HEADERS = cbr.c23 22 24 23 DSA_Demo_SOURCES = DSA_CognitiveEngine.cpp DSA_Demo.cpp