Tentative MiniShogi implementation over move generator.
[tagua/yd.git] / src / serverinfo.h
bloba63d7e4e51aa3b5acd90dc37fc3dacc2e0e92e18
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
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 */
11 #ifndef SERVERINFO_H
12 #define SERVERINFO_H
14 #include <boost/shared_ptr.hpp>
15 #ifdef Q_CC_MSVC
16 #pragma warning( push )
17 #pragma warning( disable : 4100 )
18 #include <boost/variant.hpp>
19 #pragma warning( pop )
20 #else
21 #include <boost/variant.hpp>
22 #endif
23 #include "varianttraits.h"
26 template <typename Pos>
27 class ChessServerInfo {
28 public:
29 boost::shared_ptr<Pos> position;
30 ChessServerInfo(const boost::shared_ptr<Pos> position)
31 : position(position) { }
34 template <typename Pos>
35 class PoolServerInfo {
36 public:
37 typename PoolArray<
38 typename PoolTraits<Pos>::type,
39 PoolTraits<Pos>::number>::type pools;
42 template <typename Pos>
43 struct ServerInfo {
44 typedef boost::variant<ChessServerInfo<Pos>, PoolServerInfo<Pos> > type;
47 #if 0
50 template <typename Pos> class ServerInfoVisitor;
52 template <typename Pos>
53 class ServerInfo {
54 public:
55 virtual void apply(ServerInfoVisitor<Pos>& visitor) const = 0;
58 template<typename Pos> class ChessServerInfo;
59 template<typename Pos> class PoolServerInfo;
61 template <typename Pos>
62 class ServerInfoVisitor {
63 public:
64 virtual void visit(const ChessServerInfo<Pos>& info) = 0;
65 virtual void visit(const PoolServerInfo<Pos>& info) = 0;
69 template <typename Pos>
70 class ChessServerInfo : public ServerInfo<Pos> {
71 public:
72 boost::shared_ptr<Pos> position;
73 virtual void apply(ServerInfoVisitor<Pos>& visitor) const {
74 visitor.visit(*this);
76 ChessServerInfo(const boost::shared_ptr<Pos> position)
77 : position(position) { }
80 template <typename Pos>
81 class PoolServerInfo : public ServerInfo<Pos> {
82 public:
83 typename PoolTraits<Pos>::type pools[PoolTraits<Pos>::number];
84 virtual void apply(ServerInfoVisitor<Pos>& visitor) const {
85 visitor.visit(*this);
89 #endif // 0
91 #endif // SERVERINFO_H