Cleaned up CrazyhouseMove.
[tagua/yd.git] / src / serverinfo.h
blob1ab08fb69d33469aa918e86898ab67841fe6732a
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
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