Changeset 1021 for XIOS/dev/dev_olga/src/object_template_impl.hpp
- Timestamp:
- 01/10/17 14:36:29 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/object_template_impl.hpp
r1009 r1021 164 164 std::map<int, size_t> CObjectTemplate<T>::getMinimumBufferSizeForAttributes() 165 165 { 166 // CContextClient* client = CContext::getCurrent()->client;166 // Use correct context client to send message 167 167 CContext* context = CContext::getCurrent(); 168 169 // Use correct context client to send message170 // CContextClient* contextClientTmp = (0 != context->clientPrimServer) ? context->clientPrimServer : context->client;171 168 int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 172 169 for (int i = 0; i < nbSrvPools; ++i) … … 244 241 245 242 template<typename T> 246 void CObjectTemplate<T>::sendAllAttributesToServer( const int srvPool)243 void CObjectTemplate<T>::sendAllAttributesToServer(CContextClient* client) 247 244 { 248 245 CAttributeMap& attrMap = *this; … … 250 247 for (; it != itE; ++it) 251 248 { 252 if (!(it->second)->isEmpty()) sendAttributToServer(*(it->second), srvPool);249 if (!(it->second)->isEmpty()) sendAttributToServer(*(it->second), client); 253 250 } 254 251 } … … 263 260 264 261 template <class T> 265 void CObjectTemplate<T>::sendAttributToServer(const string& id, const int srvPool)262 void CObjectTemplate<T>::sendAttributToServer(const string& id, CContextClient* client) 266 263 { 267 264 CAttributeMap & attrMap = *this; 268 265 CAttribute* attr=attrMap[id]; 269 sendAttributToServer(*attr, srvPool);266 sendAttributToServer(*attr, client); 270 267 } 271 268 … … 273 270 void CObjectTemplate<T>::sendAttributToServer(CAttribute& attr) 274 271 { 272 // Use correct context client to send message 275 273 CContext* context=CContext::getCurrent(); 276 277 // Use correct context client to send message278 // CContextClient* contextClientTmp = (0 != context->clientPrimServer) ? context->clientPrimServer : context->client;279 274 if (context->hasClient) 280 275 { … … 283 278 { 284 279 CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] : context->client; 285 // CContextClient* contextClientTmp=context->contextClientTmp;286 287 280 CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE); 288 281 if (contextClientTmp->isServerLeader()) 289 282 { 290 283 CMessage msg; 291 // if (context->hasServer) 292 // { 293 // StdString tmp = this->getIdServer() + "_" +boost::lexical_cast<string>(i); 294 // msg<<tmp; 295 // } 296 // else 297 msg<<this->getIdServer(); 298 284 msg<<this->getIdServer(); 299 285 msg << attr.getName(); 300 286 msg << attr; … … 331 317 332 318 template <class T> 333 void CObjectTemplate<T>::sendAttributToServer(CAttribute& attr, const int srvPool)319 void CObjectTemplate<T>::sendAttributToServer(CAttribute& attr, CContextClient* client) 334 320 { 335 CContext* context=CContext::getCurrent();336 CContextClient* contextClientTmp = context->clientPrimServer[srvPool];337 321 CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE); 338 if (c ontextClientTmp->isServerLeader())322 if (client->isServerLeader()) 339 323 { 340 324 CMessage msg; … … 342 326 msg << attr.getName(); 343 327 msg << attr; 344 const std::list<int>& ranks = c ontextClientTmp->getRanksServerLeader();328 const std::list<int>& ranks = client->getRanksServerLeader(); 345 329 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 346 330 event.push(*itRank,1,msg); 347 c ontextClientTmp->sendEvent(event);331 client->sendEvent(event); 348 332 } 349 else c ontextClientTmp->sendEvent(event);333 else client->sendEvent(event); 350 334 } 351 352 335 353 336 /*! … … 364 347 if (context->hasClient) 365 348 { 366 // Use correct context client to send message 367 // CContextClient* contextClientTmp = (0 != context->clientPrimServer) ? context->clientPrimServer : context->client; 349 // Use correct context client to send message 368 350 int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 369 351 for (int i = 0; i < nbSrvPools; ++i) … … 387 369 388 370 template<class T> 389 void CObjectTemplate<T>::sendAddItem(const StdString& id, int itemType, const int srvPool)371 void CObjectTemplate<T>::sendAddItem(const StdString& id, int itemType, CContextClient* client) 390 372 { 391 CContext* context = CContext::getCurrent();392 373 typedef typename T::EEventId ItemType; 393 CContextClient* contextClientTmp = context->clientPrimServer[srvPool];394 374 CEventClient event(this->getType(),ItemType(itemType)); 395 if (c ontextClientTmp->isServerLeader())375 if (client->isServerLeader()) 396 376 { 397 377 CMessage msg; 398 378 msg << this->getId(); 399 379 msg << id; 400 const std::list<int>& ranks = c ontextClientTmp->getRanksServerLeader();380 const std::list<int>& ranks = client->getRanksServerLeader(); 401 381 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 402 382 event.push(*itRank,1,msg); 403 c ontextClientTmp->sendEvent(event);383 client->sendEvent(event); 404 384 } 405 else c ontextClientTmp->sendEvent(event);385 else client->sendEvent(event); 406 386 } 387 407 388 408 389 template <class T>
Note: See TracChangeset
for help on using the changeset viewer.