MCUNode.cpp
上传用户:popouu88
上传日期:2013-02-11
资源大小:2894k
文件大小:2k
源码类别:

IP电话/视频会议

开发平台:

Visual C++

  1. // MCUNode.cpp: implementation of the CMCUNode class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "MCUNode.h"
  5. //////////////////////////////////////////////////////////////////////
  6. // Construction/Destruction
  7. //////////////////////////////////////////////////////////////////////
  8. CMCUNode::CMCUNode()
  9. {
  10. this->cmdTCP = NULL;
  11. this->mcu_id = 0;
  12. this->mcu_name = "";
  13. }
  14. CMCUNode::~CMCUNode()
  15. {
  16. INT_PTR_MAP::iterator itr;
  17. while( this->online_map.empty( ) )
  18. {
  19. itr = this->online_map.begin( );
  20. CClientNode * node = ( CClientNode * )itr->second;
  21. this->online_map.erase( itr );
  22. delete node;
  23. }
  24. }
  25. CClientNode * CMCUNode::AddClientNode( int user_id , const char * user_name , const char * data_name , bool isCharement )
  26. {
  27. if( this->online_map.find( user_id ) != this->online_map.end( ) )
  28. return NULL;
  29. CClientNode * node = new CClientNode( );
  30. node->user_id = user_id;
  31. node->user_name = user_name;
  32. node->data_name = data_name;
  33. node->isCharement = isCharement;
  34. this->online_map[ node->user_id ] = node;
  35. return node;
  36. }
  37. void CMCUNode::RemoveClientNode( int user_id )
  38. {
  39. INT_PTR_MAP::iterator itr = this->online_map.find( user_id );
  40. if( itr != this->online_map.end( ) )
  41. {
  42. CClientNode * node = ( CClientNode * )itr->second;
  43. this->online_map.erase( itr );
  44. delete node;
  45. }
  46. }
  47. CClientNode * CMCUNode::GetClientNode( int user_id )
  48. {
  49. INT_PTR_MAP::iterator itr = this->online_map.find( user_id );
  50. if( itr != this->online_map.end( ) )
  51. return ( CClientNode * )itr->second;
  52. return NULL;
  53. }