/Desktop/MGS-MultithreadedGameServer/Plugins/Games/ChatRoom.h

Vai alla documentazione di questo file.
00001 //
00002 // File: ChatRoom.h
00003 // Created by: <Detro /> aka Ivan De Marino 
00004 // <detro@mandolinux.org, demarino@studenti.unina.it, demarino@na.astro.it>
00005 // Created on: Wed Oct 27 15:37:00 2004
00006 //
00007 
00008 #ifndef _CHATROOM_H_
00009 #define _CHATROOM_H_
00010 
00011 #include <iostream>
00012 #include <list>
00013 #include "Game.h"
00014 #include "Player.h"
00015 
00016 #ifdef  CCXX_NAMESPACES
00017 using namespace std;
00018 using namespace ost;
00019 #endif
00020 
00021 /**
00022  * @class ChatRoom ChatRoom.h
00023  * ChatRoom per MGS: un esempio di implementazione di @c Game.
00024  * Questa classe e' un esempio di implementazione 
00025  * dell'interfaccia <code>Game</code>. <br>
00026  * Permette di gestire una semplice ChatRoom con scambio di 
00027  * messaggi tra gli utenti presenti. <br>
00028  * Per questo <code>Game</code> non e' stato necessario re-implementare
00029  * la classe <code>Player</code> perche' essa risulta sufficiente
00030  * per questo uso. */
00031 class ChatRoom : public Game {
00032    public:
00033       ChatRoom(void);
00034       ChatRoom(Player *);
00035       virtual ~ChatRoom(void);   
00036       void init(void);
00037       void run(void);
00038       void final(void);
00039       void addPlayer (Player *);
00040       bool delPlayer (const string &);
00041       int getNumPlayers (void) const;
00042       void printPlayersList(iostream *);
00043       string getName(void) const;
00044 
00045    protected:
00046       void sayToAll(const string&, Player * = NULL);
00047       void delPlayer (Player *);
00048    
00049    private:
00050       /** Lista dei <code>Player</code> presenti nella ChatRoom. */
00051       list<Player *> playerList;
00052       /** <code>Mutex (Semaforo)</code> utile per le Sezioni Critiche. */
00053       Mutex mutex;
00054       
00055 };
00056 
00057 
00058 #endif   //_CHATROOM_H_

Generato il Sun Nov 28 13:27:03 2004 per MGS - Multithreaded Game Server da doxygen 1.3.4