Shadowrun: Awakened 29 September 2011 - Build 871
SraBaseMessage.h
Go to the documentation of this file.
00001 /*
00002  * SraBaseMessage - Server-side abstract base class for all messages.
00003  *
00004 * @Author Michael <Tharbas> Matzen
00005  *
00006  * This program is free software; you can redistribute it and/or modify it
00007  * under the terms of the GNU General Public License as published by the Free
00008  * Software Foundation; either version 2 of the License, or (at your option)
00009  * any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful, but WITHOUT
00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
00014  * more details.
00015  *
00016  * You should have received a copy of the GNU General Public License along with
00017  * this program; if not, write to the Free Software Foundation, Inc., 51
00018  * Franklin St, Fifth Floor, Boston, MA 02110, USA
00019  * 
00020  */
00021 #pragma once
00022 
00023 #include "RakNetTypes.h"
00024 
00025 #include "WindowsIncludes.h"
00026 #include <tbb_thread.h>
00027 #include <task_scheduler_init.h>
00028 #include <concurrent_hash_map.h>
00029 #include <concurrent_vector.h>
00030 #include <task.h>
00031 #include <stdio.h>
00032 #include <string>
00033 
00034 #include "SraNetworkShared.h"
00035 #include "SraPacket.h"
00036 #include "BitStream.h"
00037 
00038 namespace SraNetwork
00039 {
00040     struct MessageData
00041     {
00042     public:
00043         RakNet::BitStream stream;
00044         RakNet::SystemAddress address;
00045 
00046         MessageData()
00047         {
00048         }
00049 
00050         MessageData( const MessageData& other)
00051         {
00052             address = other.address;
00053             stream = other.stream;
00054         }
00055     };
00056 
00057     class SraBaseMessage
00058     {
00059 
00060     public:
00061         virtual void process(MessageData* message) = 0;
00062 
00063         //The list of message to be processed.
00064         static tbb::concurrent_vector<SraBaseMessage> messagePump;      
00065 
00066         virtual SraPacket* createPacketFromData(const unsigned char* data) = 0;
00067     };
00068 }

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net