00001 /* 00002 $Id: netgroup.cpp,v 1.3 2001/02/28 15:06:03 sphair Exp $ 00003 00004 ------------------------------------------------------------------------ 00005 ClanLib, the platform independent game SDK. 00006 00007 This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE 00008 version 2. See COPYING for details. 00009 00010 For a total list of contributers see CREDITS. 00011 00012 ------------------------------------------------------------------------ 00013 */ 00014 00015 #include "API/Network/netgroup.h" 00016 00018 // CL_NetGroup_Generic: 00019 00020 class CL_NetGroup_Generic 00021 { 00022 public: 00023 std::list<CL_NetComputer> computers; 00024 }; 00025 00027 // CL_NetGroup construction: 00028 00029 CL_NetGroup::CL_NetGroup() 00030 : impl(NULL) 00031 { 00032 impl = new CL_NetGroup_Generic; 00033 } 00034 00035 CL_NetGroup::CL_NetGroup(const CL_NetComputer &computer) 00036 : impl(NULL) 00037 { 00038 impl = new CL_NetGroup_Generic; 00039 add(computer); 00040 } 00041 00042 CL_NetGroup::~CL_NetGroup() 00043 { 00044 delete impl; 00045 } 00046 00048 // CL_NetGroup attributes: 00049 00050 std::list<CL_NetComputer> &CL_NetGroup::get_computers() const 00051 { 00052 return impl->computers; 00053 } 00054 00056 // CL_NetGroup operations: 00057 00058 void CL_NetGroup::add(const CL_NetComputer &computer) 00059 { 00060 impl->computers.push_back(computer); 00061 } 00062 00063 void CL_NetGroup::remove(const CL_NetComputer &computer) 00064 { 00065 impl->computers.remove(computer); 00066 } 00067 00068 void CL_NetGroup::disconnect() 00069 { 00070 std::list<CL_NetComputer>::iterator it; 00071 00072 for ( 00073 it = impl->computers.begin(); 00074 it != impl->computers.end(); 00075 it++) 00076 { 00077 CL_NetComputer &cur = *it; 00078 cur.disconnect(); 00079 } 00080 } 00081 00083 // CL_NetGroup implementation:
1.2.6 written by Dimitri van Heesch,
© 1997-2001