Changeset 2418 for code/branches/presentation
- Timestamp:
- Dec 12, 2008, 11:04:12 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/network/TrafficControl.cc
r2416 r2418 93 93 SetConfigValue ( targetSize, 5000 ); 94 94 } 95 96 /**97 *eigener sortieralgorithmus98 */99 // bool TrafficControl::priodiffer(obj i, obj j)100 // {101 // std::map<unsigned int, objInfo>::iterator iti;102 // std::map<unsigned int, objInfo>::iterator itj;103 // iti=listToProcess_.find(i.objID);104 // itj=listToProcess_.find(j.objID);105 // return iti->second.objValuePerm < itj->second.objValuePerm;106 // }107 95 108 96 /** … … 138 126 currentGamestateID=gamestateID; 139 127 evaluateList(clientID, list); 140 //list hatte vorher ja vielmehr elemente, nach zuweisung nicht mehr... speicherplatz??141 // *list=copiedVector;142 //später wird copiedVector ja überschrieben, ist das ein problem für list-dh. für gamestatemanager?143 128 return; 144 129 } … … 182 167 *Definition of private members 183 168 */ 184 185 186 /** 187 *copyList gets list of Gamestate Manager and turns it to *listToProcess 188 */ 189 // void TrafficControl::copyList(std::list<obj> *list) 190 // { 191 // std::list<obj>::iterator itvec; 192 // for(itvec = (*list).begin(); itvec != (*list).end(); itvec++) 193 // { 194 // objInfo objectA; 195 // objectA.objCreatorID=(*itvec).objCreatorID; 196 // objectA.objSize = (*itvec).objSize; 197 // listToProcess_.insert(std::pair<currentClientID, map<(*itvec).objID,objectA>>);//unsicher: ob map<...> so richtig ist 198 // } 199 // } 200 /** 201 *updateReferenceList compares the sent list by GSmanager with the current *reference list and updates it. 202 *returns void 203 */ 204 // void TrafficControl::updateReferenceList(std::map<unsigned int, objInfo> *list) 205 // { 206 // std::map<unsigned int, Synchronisable*>::iterator itref; 207 // std::map<unsigned int, objInfo>::iterator itproc; 208 // for(itproc=listToProcess_.begin(); itproc != listToProcess_.end(); itproc++) 209 // { 210 // //itproc->first=objectid that is looked for 211 // if(referenceList_->find(itproc->first)) 212 // { 213 // continue; 214 // } 215 // else 216 // { 217 // (*referenceList_).insert(pair<unsigned int, Synchronisable*>((*itproc).first,Synchronisable::getSynchronisable((*itproc).first)));//important: how to get adress of an object! 218 // insertinClientListPerm(currentClientID,itproc->first,itproc->second); 219 // } 220 // } 221 // } 169 222 170 /** 223 171 *updateClientListPerm … … 242 190 { 243 191 clientListTemp_[currentClientID][currentGamestateID] = std::list<obj>(*list); 244 // std::list<obj>::iterator itvec;245 // std::map<unsigned int,std::map<unsigned int, obj> >::iterator ittemp;246 // std::map<unsigned int, obj>::iterator ittempgs;247 // ittemp = clientListTemp_.find(currentClientID);248 // ittempgs = (*ittemp).find(currentGamestateID);249 // for(itvec = list.begin(); itvec!=list.end(), itvec++)250 // {251 // ittempgs.insert(itvec);static252 // }253 192 } 254 193 … … 286 225 void TrafficControl::evaluateList(unsigned int clientID, std::list<obj> *list) 287 226 { 288 //copyList(list);289 227 290 228 //now the sorting … … 292 230 //compare listToProcess vs clientListPerm 293 231 //if listToProcess contains new Objects, add them to clientListPerm 294 // std::map<unsigned int, objInfo>::iterator itproc;295 232 std::list<obj>::iterator itvec; 296 // std::map<unsigned int, std::map<unsigned int, objInfo> >::iterator itperm;297 // std::map<unsigned int, objInfo>::iterator itpermobj;298 233 for( itvec=list->begin(); itvec != list->end(); itvec++) 299 234 { 300 // itperm = clientListPerm_.find(clientID);301 235 if ( clientListPerm_[clientID].find( (*itvec).objID) != clientListPerm_[clientID].end() ) 302 236 { … … 304 238 //obj bleibt in liste und permanente prio wird berechnet 305 239 clientListPerm_[clientID][(*itvec).objID].objDiffGS = currentGamestateID - clientListPerm_[clientID][(*itvec).objID].objCurGS; 306 // ((*itpermobj).second).objDiffGS = ((*itpermobj).second).objCurGS - currentGamestateID;307 // permprio = clientListPerm_[clientID][(*itproc).first].objValuePerm;308 // itpermprio = (permObjPrio_).find((*itproc).first);309 // ((*itpermobj).second).objValuePerm = ((*itpermobj).second).objDiffGS * (*itpermprio).second;310 240 continue;//check next objId 311 241 } … … 314 244 // insert the object into clientListPerm 315 245 insertinClientListPerm(clientID,*itvec); 316 // itpermobj=(*itperm).find((*itproc).first)317 // ((*itpermobj).second).objDiffGS = ((*itpermobj).second).objCurGS - currentGamestateID;318 // itpermprio = (permObjPrio_).find((*itproc).first);319 // ((*itpermobj).second).objValuePerm = ((*itpermobj).second).objDiffGS * (*itpermprio).second;320 246 continue;//check next objId 321 247 } 322 248 } 323 249 //end compare listToProcess vs clientListPerm 324 325 //listToProc vs clientListTemp 326 //TODO: uncomment it again and change some things 327 /* 328 std::map<unsigned int, std::map<unsigned int, unsigned int> >::iterator ittemp; 329 std::map<unsigned int, unsigned int>::iterator ittempgs; 330 for( itproc=listToProcess_.begin(); itproc != listToProcess_.end();itproc++) 250 251 if( bActive_ ) 331 252 { 332 ittemp = clientListTemp_->find(currentClientID); 333 if( ittempgs = (*ittemp).find(currentGamestateID)) 334 { 335 if((*itproc).first == (*ittempgs).find((*itproc).first))//ja, dann ist objekt schon in der zu sendenden liste-muss nicht nochmal gesendet werden 336 { 337 (listToProcess_).erase (itproc); 338 } 339 else 340 continue; 341 } 342 else 343 continue; 344 }*/ 345 //end listToProc vs clientListTemp 346 347 //TODO: check whether we need this, cause i don't think so. 348 //listToProcess contains obj to send now, and since we give gsmanager the copiedlist and not listToProcess shorten copiedlist therefor too. 349 /*std::list<obj>::iterator itvec; 350 for(itvec = copiedVector.begin(); itvec != copiedVector.end(); itvec++) 351 { 352 if ( listToProcess_.find(itvec->objID) ) 353 { 354 continue;//therefore object wasnt thrown out yet and has to be sent back to gsmanager 355 } 356 else 357 { 358 copiedVector.remove(itvec); 359 } 360 }*/ 361 //sort copied list aufgrund der objprioperm in clientlistperm 362 // use boost bind here because we need to pass a memberfunction to stl sort 363 list->sort(boost::bind(&TrafficControl::prioritySort, this, clientID, _1, _2) ); 364 365 //now we check, that the creator of an object always exists on a client 366 // printList(list, clientID); 367 std::list<obj>::iterator itcreator; 368 for(itvec = list->begin(); itvec != list->end(); itvec++) 369 { 370 fixCreatorDependencies(itvec, list, clientID); 253 //sort copied list according to priorities 254 // use boost bind here because we need to pass a memberfunction to stl sort 255 list->sort(boost::bind(&TrafficControl::prioritySort, this, clientID, _1, _2) ); 256 257 //now we check, that the creator of an object always exists on a client 258 std::list<obj>::iterator itcreator; 259 for(itvec = list->begin(); itvec != list->end(); itvec++) 260 { 261 fixCreatorDependencies(itvec, list, clientID); 262 } 263 //end of sorting 264 //now the cutting, work the same obj out in processobjectlist and copiedlist, compression rate muss noch festgelegt werden. 265 cut(list, targetSize); 266 267 //now sort again after objDataOffset 268 list->sort(boost::bind(&TrafficControl::dataSort, this, _1, _2) ); 371 269 } 372 //end of sorting373 //now the cutting, work the same obj out in processobjectlist and copiedlist, compression rate muss noch festgelegt werden.374 cut(list, targetSize);375 376 //now sort again after objDataOffset377 list->sort(boost::bind(&TrafficControl::dataSort, this, _1, _2) );378 // printList(list, clientID);379 270 //diese Funktion updateClientList muss noch gemacht werden 380 271 updateClientListTemp(list); … … 418 309 } 419 310 420 /*421 void bvlabla(list *a){422 //sort a423 list *cache;424 cache = new list<unsigned int>(*a);425 return a;426 }427 */428 429 311 430 312 }//namespace network
Note: See TracChangeset
for help on using the changeset viewer.