多数据源中间件标准版1.0

StrategyLoop.cpp 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include "StdAfx.h"
  2. #include "StrategyLoop.h"
  3. #include "Agent.h"
  4. #include "AgentGroup.h"
  5. CStrategyLoop::CStrategyLoop(void) : m_Index(0)
  6. {
  7. }
  8. CStrategyLoop::~CStrategyLoop(void)
  9. {
  10. }
  11. /*****************************************************************
  12. **【函数名称】 _locateAgent
  13. **【函数功能】 得到当前排队策略下可用座席
  14. **【参数】
  15. **【返回值】
  16. ****************************************************************/
  17. CAgent* CStrategyLoop::_locateAgent( CAgentGroup& AgentGroup )
  18. {
  19. CAgent* pAgent = NULL;
  20. bool t_b_has_jump = false;
  21. pAgent = AgentGroup.GetFreeAgentForLoop();
  22. return pAgent;
  23. /*
  24. for(int i=0; i<AgentGroup.GetCount(); ++i) // 保证遍历一轮
  25. {
  26. if(m_Index >= AgentGroup.GetCount())
  27. m_Index = 0;
  28. pAgent = AgentGroup[m_Index++];
  29. if (pAgent->queueJump()) {
  30. t_b_has_jump = true;
  31. continue;
  32. }
  33. if(pAgent->isFree())
  34. return pAgent;
  35. } // end if
  36. if (t_b_has_jump == true) {
  37. for (int i = 0; i<AgentGroup.GetCount(); ++i) // 保证遍历一轮
  38. {
  39. if (m_Index >= AgentGroup.GetCount())
  40. m_Index = 0;
  41. pAgent = AgentGroup[m_Index++];
  42. if (pAgent->isFree())
  43. return pAgent;
  44. } // end if
  45. }
  46. return NULL;
  47. */
  48. }