Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

netobject_generic.cpp

Go to the documentation of this file.
00001 /*
00002         $Id: netobject_generic.cpp,v 1.4 2001/03/17 07:29:34 vaidhy 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 #ifdef WIN32
00016 #pragma warning (disable:4786)
00017 #endif
00018 
00019 #include "API/Network/netobject_channel.h"
00020 #include "netobject_generic.h"
00021 #include "netobject_channel_generic.h"
00022 
00023 CL_NetObject_Generic::CL_NetObject_Generic(class CL_NetObjectChannel_Generic *_obj_channel)
00024 : obj_channel(_obj_channel), obj_id(_obj_channel->id_counter++), ref(0)
00025 {
00026         obj_channel->objects[obj_id] = this;
00027 }
00028 
00029 CL_NetObject_Generic::CL_NetObject_Generic(int _obj_id, class CL_NetObjectChannel_Generic *_obj_channel)
00030 : obj_channel(_obj_channel), obj_id(_obj_id), ref(0)
00031 {
00032         obj_channel->objects[obj_id] = this;
00033 }
00034 
00035 CL_NetObject_Generic::~CL_NetObject_Generic()
00036 {
00037         obj_channel->objects.erase(obj_channel->objects.find(obj_id));
00038 }
00039 
00040 CL_Slot CL_NetObject_Generic::connect(int msg_type, CL_Slot_v1<CL_InputSource &> *slot)
00041 {
00042         return msg_signals[msg_type].connect(slot);
00043 }
00044 
00045 CL_Slot CL_NetObject_Generic::connect(int talkback_type, CL_Slot_v2<const class CL_NetComputer &, class CL_InputSource &> *slot)
00046 {
00047         return talkback_signals[talkback_type].connect(slot);
00048 }
00049 
00050 void CL_NetObject_Generic::send(int msg_type, const std::string &message)
00051 {
00052         obj_channel->send(obj_id, msg_type, message);
00053 }
00054 
00055 void CL_NetObject_Generic::talkback(int talkback_type, const std::string &message)
00056 {
00057         obj_channel->talkback(obj_id, talkback_type, message);
00058 }
00059 
00060 int CL_NetObject_Generic::add_ref()
00061 {
00062         return ++ref;
00063 }
00064 
00065 int CL_NetObject_Generic::release_ref()
00066 {
00067         return --ref;
00068 }

Generated at Wed Apr 4 19:54:02 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001