Changeset 2019 for XIOS/dev/dev_trunk_graph/src/group_template_impl.hpp
- Timestamp:
- 01/22/21 12:00:29 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_trunk_graph/src/group_template_impl.hpp
r1542 r2019 369 369 } 370 370 371 372 template <class U, class V, class W> 373 void CGroupTemplate<U, V, W>::sendCreateChild(const string& id) 374 { 375 CContext* context=CContext::getCurrent() ; 376 377 if (context->hasClient) 378 // if (!context->hasServer ) 379 { 380 // Use correct context client to send message 381 // CContextClient* contextClientTmp = (0 != context->clientPrimServer) ? context->clientPrimServer : context->client; 382 int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 383 for (int i = 0; i < nbSrvPools; ++i) 384 { 385 CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] : context->client; 386 387 CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD) ; 388 if (contextClientTmp->isServerLeader()) 389 { 390 CMessage msg ; 391 msg<<this->getId() ; 392 msg<<id ; 393 const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 394 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 395 event.push(*itRank,1,msg) ; 396 contextClientTmp->sendEvent(event) ; 397 } 398 else contextClientTmp->sendEvent(event) ; 399 } 400 } 401 402 } 403 404 template <class U, class V, class W> 405 void CGroupTemplate<U, V, W>::sendCreateChild(const string& id, CContextClient* client) 371 template <class U, class V, class W> 372 void CGroupTemplate<U, V, W>::sendCreateChild(const string& id, CContextClient* client, const string& objectId) 406 373 { 407 374 … … 410 377 { 411 378 CMessage msg ; 412 msg<<this->getId() ; 379 if (objectId.empty()) msg << this->getId(); 380 else msg << objectId; 413 381 msg<<id ; 414 382 const std::list<int>& ranks = client->getRanksServerLeader(); … … 420 388 } 421 389 422 423 template <class U, class V, class W> 424 void CGroupTemplate<U, V, W>::sendCreateChildGroup(const string& id) 425 { 426 CContext* context=CContext::getCurrent() ; 427 if (context->hasClient) 428 { 429 // Use correct context client to send message 430 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 431 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 432 for (int i = 0; i < nbSrvPools; ++i) 433 { 434 CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] : context->client; 435 CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD_GROUP) ; 436 if (contextClientTmp->isServerLeader()) 437 { 438 CMessage msg ; 439 msg<<this->getId() ; 440 msg<<id ; 441 const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 442 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 443 event.push(*itRank,1,msg) ; 444 contextClientTmp->sendEvent(event) ; 445 } 446 else contextClientTmp->sendEvent(event) ; 447 } 448 } 449 } 450 390 template <class U, class V, class W> 391 void CGroupTemplate<U, V, W>::sendCreateChildGroup(const string& id, CContextClient* client, const string& objectId) 392 { 393 CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD_GROUP) ; 394 if (client->isServerLeader()) 395 { 396 CMessage msg ; 397 if (objectId.empty()) msg << this->getId(); 398 else msg << objectId; 399 msg<<id ; 400 const std::list<int>& ranks = client->getRanksServerLeader(); 401 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 402 event.push(*itRank,1,msg) ; 403 client->sendEvent(event) ; 404 } 405 else client->sendEvent(event) ; 406 } 407 408 451 409 template <class U, class V, class W> 452 410 void CGroupTemplate<U, V, W>::recvCreateChild(CEventServer& event)
Note: See TracChangeset
for help on using the changeset viewer.