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

netmessage.h

Go to the documentation of this file.
00001 /*
00002         $Id: netmessage.h,v 1.5 2001/03/04 17:54:52 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         File purpose:
00015                 Network component header file.
00016 
00017 
00018 */
00019 
00021 
00022 #ifndef header_netmessage
00023 #define header_netmessage
00024 
00025 #include <string>
00026 #include "netcomputer.h"
00027 
00028 class CL_NetMessage
00029 //: CL_NetMessage is used to contain messages sent across the network.
00030 {
00031 public:
00032         CL_NetMessage()
00033         {
00034         }
00035         //: Creates a net message with no contents. (default constructor)
00036 
00037         CL_NetMessage(const CL_NetMessage &copy)
00038         {
00039                 data = copy.data;
00040                 from = copy.from;
00041         }
00042         //: Copy constructor.
00043 
00044         CL_NetMessage(const void *data, int size)
00045         {
00046                 this->data.append((char *) data, size);
00047         }
00048         //: Constructs a Net message using the data given. Please notice that it        
00049         //: doesn't duplicate the data, but only points its data pointer to the 
00050         //: data given.
00053 
00054         CL_NetMessage(std::string data)
00055         {
00056                 this->data = data;
00057         }
00058 
00059         std::string data;
00060         //: Packet data.
00061 
00062         CL_NetComputer from;
00063         //: Computer the message was sent from. You don't have to fill in this
00064         //: if you just want to send a message - it is only used when receiving from
00065         //: a netchannel.
00066 };
00067 
00068 #endif

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