00001 /* 00002 $Id: netcomputer.cpp,v 1.5 2001/03/21 07:28:40 mbn 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/netcomputer.h" 00016 #include "API/Core/System/error.h" 00017 #include "netcomputer_generic.h" 00018 00020 // CL_NetComputer construction: 00021 00022 CL_NetComputer::CL_NetComputer(const CL_NetComputer ©) 00023 : impl(NULL) 00024 { 00025 impl = copy.impl; 00026 if (impl != NULL) impl->add_ref(); 00027 } 00028 00029 CL_NetComputer::CL_NetComputer() 00030 : impl(NULL) 00031 { 00032 } 00033 00034 CL_NetComputer::~CL_NetComputer() 00035 { 00036 if (impl) impl->release_ref(); 00037 } 00038 00040 // CL_NetComputer attributes: 00041 00042 unsigned long CL_NetComputer::get_address() const 00043 { 00044 if (impl == NULL) throw CL_Error("CL_NetComputer object isn't attached!"); 00045 return impl->get_address(); 00046 } 00047 00048 CL_NetSession CL_NetComputer::get_session() 00049 { 00050 if (impl == NULL) throw CL_Error("CL_NetComputer object isn't attached!"); 00051 return CL_NetSession(impl->get_session()); 00052 } 00053 00054 bool CL_NetComputer::operator == (const CL_NetComputer &other) 00055 { 00056 return impl == other.impl; 00057 } 00058 00060 // CL_NetComputer operations: 00061 00062 void CL_NetComputer::disconnect() 00063 { 00064 if (impl == NULL) throw CL_Error("CL_NetComputer object isn't attached!"); 00065 impl->disconnect(); 00066 } 00067 00068 CL_NetComputer &CL_NetComputer::operator = (const CL_NetComputer &other_instance) 00069 { 00070 if (impl != NULL) impl->release_ref(); 00071 impl = other_instance.impl; 00072 if (impl != NULL) impl->add_ref(); 00073 00074 return *this; 00075 } 00076 00078 // CL_NetComputer implementation: 00079 00080 CL_NetComputer::CL_NetComputer(class CL_NetComputer_Generic *impl) 00081 : impl(impl) 00082 { 00083 if (impl != NULL) impl->add_ref(); 00084 }
1.2.6 written by Dimitri van Heesch,
© 1997-2001