Shadowrun: Awakened 29 September 2011 - Build 871
MessagePump.h
Go to the documentation of this file.
00001 /*
00002 * MessagePump - Message pump class. Will receive async messages from
00003 *               and store them. The messages are forwared
00004 *               to the handling classes by this class too.
00005 *
00006 * @Author Michael <Tharbas> Matzen
00007 *
00008 * This program is free software; you can redistribute it and/or modify it
00009 * under the terms of the GNU General Public License as published by the Free
00010 * Software Foundation; either version 2 of the License, or (at your option)
00011 * any later version.
00012 *
00013 * This program is distributed in the hope that it will be useful, but WITHOUT
00014 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00015 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
00016 * more details.
00017 *
00018 * You should have received a copy of the GNU General Public License along with
00019 * this program; if not, write to the Free Software Foundation, Inc., 51
00020 * Franklin St, Fifth Floor, Boston, MA 02110, USA
00021 * 
00022 */
00023 
00024 #pragma once
00025 
00026 #include "WindowsIncludes.h"
00027 #include <tbb_thread.h>
00028 #include <task_scheduler_init.h>
00029 #include <concurrent_hash_map.h>
00030 #include <concurrent_queue.h>
00031 #include <task.h>
00032 #include <stdio.h>
00033 #include <string>
00034 
00035 #include "Utils.h"
00036 #include "SraNetworkShared.h"
00037 #include "SraBaseMessage.h"
00038 #include "SraPacket.h"
00039 
00040 namespace SraNetwork
00041 {
00042     class MessagePump
00043     {
00044     public:
00045         static MessagePump* Instance;
00046 
00047         void AddMessage(RakNet::Packet* packet);
00048 
00049         void Shutdown();
00050 
00051         
00052         static void Run();
00053 
00054     private:
00055         MessagePump(void);
00056         ~MessagePump(void);
00057 
00058         static tbb::concurrent_queue<MessageData> messageList;
00059 
00060         static bool isRunning;
00061         // A map of SraNetwork::MessageIdentifier->BaseMessageImpl
00062         static tbb::concurrent_hash_map<int, SraBaseMessage*>  messageProcessorTable;
00063 
00064     };
00065 }

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