Blender V2.61 - r43446

NG_NetworkDeviceInterface.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00034 #ifndef NG_NETWORKDEVICEINTERFACE_H
00035 #define NG_NETWORKDEVICEINTERFACE_H
00036 
00037 #include "NG_NetworkMessage.h"
00038 #include <vector>
00039 
00040 class NG_NetworkDeviceInterface
00041 {
00042 private:
00043     // candidates for shared/common implementation class
00044     bool m_online;
00045 public:
00046     NG_NetworkDeviceInterface() {};
00047     virtual ~NG_NetworkDeviceInterface() {};
00048 
00049     virtual void NextFrame()=0;
00050 
00054     void Online(void) { m_online = true; }
00058     void Offline(void) { m_online = false; }
00062     bool IsOnline(void) { return m_online; }
00063 
00064     virtual bool Connect(char *address, unsigned int port, char *password,
00065                          unsigned int localport, unsigned int timeout)=0;
00066     virtual bool Disconnect(void)=0;
00067 
00068     virtual void SendNetworkMessage(NG_NetworkMessage* msg)=0;
00074     virtual std::vector<NG_NetworkMessage*> RetrieveNetworkMessages()=0;
00075     
00076     
00077 #ifdef WITH_CXX_GUARDEDALLOC
00078 public:
00079     void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:NG_NetworkDeviceInterface"); }
00080     void operator delete( void *mem ) { MEM_freeN(mem); }
00081 #endif
00082 };
00083 
00084 #endif //NG_NETWORKDEVICEINTERFACE_H
00085