Advanced Strategic Command
networkinterface.h
Go to the documentation of this file.
1 /*
2  This file is part of Advanced Strategic Command; http://www.asc-hq.de
3  Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; see the file COPYING. If not, write to the
17  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  Boston, MA 02111-1307 USA
19 */
20 
21 
22 
23 #ifndef networkinterfaceH
24 #define networkinterfaceH
25 
26 #include "loki/Singleton.h"
27 #include "util/factory.h"
28 
29 #include "basestrm.h"
30 
31 class GameMap;
32 
34  protected:
35  virtual void readChildData ( tnstream& stream ) = 0;
36  virtual void writeChildData ( tnstream& stream ) const = 0;
37  public:
38  virtual void setup() = 0;
39  virtual void send( const GameMap* map, int lastPlayer, int lastturn ) = 0;
40  virtual GameMap* receive() = 0;
41  static GameTransferMechanism* read ( tnstream& stream );
42  void write ( tnstream& stream ) const;
43  virtual ASCString getMechanismID() const = 0;
44  virtual ~GameTransferMechanism() {};
45 };
46 
47 typedef Loki::SingletonHolder< Factory< GameTransferMechanism, ASCString > > networkTransferMechanismFactory;
48 
49 
50 #endif
virtual ~GameTransferMechanism()
The interface for all kinds of IO stream.
The ASCString class provides an abstract way to manipulate strings.
Definition: ascstring.h:14
virtual GameMap * receive()=0
Loki::SingletonHolder< Factory< GameTransferMechanism, ASCString > > networkTransferMechanismFactory
virtual ASCString getMechanismID() const =0
The interface for the various streams that ASC offers, like file and memory streams.
virtual void readChildData(tnstream &stream)=0
virtual void writeChildData(tnstream &stream) const =0
virtual void send(const GameMap *map, int lastPlayer, int lastturn)=0
static GameTransferMechanism * read(tnstream &stream)
virtual void setup()=0
void write(tnstream &stream) const
The map. THE central structure of ASC, which holds everything not globally available together...
Definition: gamemap.h:182