Changeset 2340 for code/branches/network/src
- Timestamp:
- Dec 3, 2008, 6:56:58 PM (16 years ago)
- Location:
- code/branches/network/src/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/TrafficControl.cc
r2334 r2340 51 51 permObjPrio_ = new std::map<unsigned int, unsigned int> ; 52 52 schedObjPrio_ = new std::map<unsigned int, unsigned int> schedObjPrio_; 53 copiedVector = new std::vector<obj>; 54 targetSize = 5000;//5000bytes 53 55 } 54 56 … … 180 182 assert(itperm != clientListPerm_.end() ); 181 183 (*itperm).insert(pair<unsigned int, objInfo>(objid,objinf)); 182 } 183 184 184 (permObjPrio_).insert(objid,objinf.objValuePerm); 185 } 186 187 /** 188 *updateClientListTemp 189 *takes the shortened vector which will be sent to the gsmanager and puts the *info into clientListTemp 190 */ 191 TrafficControl::updateClientListTemp(std::vector<obj> *list) 192 { 193 vector<obj>::iterator itvec; 194 map<unsigned int,std::map<unsigned int, obj>>::iterator ittemp; 195 map<unsigned int, obj>::iterator ittempgs; 196 ittemp = (clientListTemp_).find(currentClientID); 197 ittempgs = (*ittemp).find(currentGamestateID); 198 for(itvec=list.begin();itvec!=list.end(),itvec++) 199 { 200 ittempgs.insert(itvec); 201 } 202 } 203 204 /** 205 *cut 206 *takes the current vector that has to be returned to the gsmanager and shortens it in criteria of bandwidth of clientID(XY) 207 */ 208 TrafficControl::cut(std::vector<obj> *list,int targetsize) 209 { 210 unsigned int size=0; 211 vector<obj>::iterator itvec; 212 itvec = list.begin(); 213 unsigned int i=0; 214 while(size<targetsize && (itvec!=list.end())) 215 { 216 size = size + (*itvec).objSize;//objSize is given in bytes!?? 217 i++; 218 itvec = list.begin()+i; 219 } 220 list.erase(itvec, list.end()); 221 } 222 223 185 224 /** 186 225 *evaluateList evaluates whether new obj are there, whether there are things to be updatet and manipulates all this. 187 226 */ 188 void TrafficControl::evaluateList(std:: map<obj> *list)227 void TrafficControl::evaluateList(std::vector<obj> *list) 189 228 { 190 229 copyList(list); … … 194 233 195 234 //compare listToProcess vs clientListPerm 235 //if listToProcess contains new Objects, add them to clientListPerm 196 236 std::map<unsigned int, objInfo>::iterator itproc; 197 237 std::map<unsigned int, std::map<unsigned int, objInfo>>::iterator itperm; 198 238 std::map<unsigned int, objInfo>::iterator itpermobj; 199 239 std::map<unsigned int, unsigned int>::iterator itpermprio; 200 for((*itproc =listToProcess_).begin(); itproc != (*listToProcess_).end();it++)240 for((*itproc)=(listToProcess_).begin(); itproc != (listToProcess_).end();it++) 201 241 { 202 242 itperm=(clientListPerm_).find(currentClientID); 203 itpermobj=(*itperm).find((*itproc).first); 204 if(currentGamestateID < ((*itpermobj).second).objCurGS) 243 if(itpermobj=(*itperm).find((*itproc).first)) 244 { 245 if(currentGamestateID > ((*itpermobj).second).objCurGS) 205 246 { 206 247 //obj bleibt in liste und permanente prio wird berechnet … … 214 255 (listToProcess_).erase(itproc); 215 256 } 216 } 257 } 258 else 259 { 260 insertinClientListPerm(currentClientID,(*itproc).first,(*itproc).second); 261 itpermobj=(*itperm).find((*itproc).first) 262 ((*itpermobj).second).objDiffGS = ((*itpermobj).second).objCurGS - currentGamestateID; 263 itpermprio = (permObjPrio_).find((*itproc).first); 264 ((*itpermobj).second).objValuePerm = ((*itpermobj).second).objDiffGS * (*itpermprio).second; 265 continue;//check next objId 266 } 267 } 217 268 //end compare listToProcess vs clientListPerm 218 269 … … 235 286 //end listToProc vs clientListTemp 236 287 237 //listToProcess contains obj to send now, shorten copiedvector therefor too.288 //listToProcess contains obj to send now, and since we give gsmanager the copiedvector and not listToProcess shorten copiedvector therefor too. 238 289 vector<obj>::iterator itvec; 239 290 for(itvec = copiedVector.begin(); itvec < copiedVector.end(); itvec++) … … 264 315 //end of sorting 265 316 //now the cutting, work the same obj out in processobjectlist and copiedvector, compression rate muss noch festgelegt werden. 266 cut(copiedVector, currentClientID???bandWidth);317 cut(copiedVector,targetSize); 267 318 //diese Funktion updateClientList muss noch gemacht werden 268 319 updateClientListTemp(copiedVector); -
code/branches/network/src/network/TrafficControl.h
r2334 r2340 110 110 unsigned int currentGamestateID; 111 111 unsigned int currentClientID; 112 unsigned int targetSize; 112 113 /** 113 114 *copiedVector is a copy of the given Vector by the GSmanager, on this vector all manipulations are performed … … 116 117 117 118 void updateReferenceList(std::map<unsigned int, objInfo> *list);//done 118 void insertinClientListPerm(unsigned int objid, objInfo objinf);//done119 void insertinClientListPerm(unsigned int clientid, unsigned int objid, objInfo objinf);//done 119 120 /** 120 121 *creates listToProcess, which can be easialy compared with other lists … … 122 123 void copyList(std::vector<obj> *list);//done 123 124 124 void cut( vector<obj> *list,int bandwidth);125 void updateClientListTemp( vector<obj> *list);125 void cut(std::vector<obj> *list,int targetsize); 126 void updateClientListTemp(std::vector<obj> *list);//done 126 127 /** 127 128 *evaluates Data given (vector) and produces result(->Data to be updated) 128 129 */ 129 void evaluateList(std:: map<obj> *list);130 void evaluateList(std::vector<obj> *list);//done 130 131 131 132 protected:
Note: See TracChangeset
for help on using the changeset viewer.