00001 /***************************************************************************** 00002 * Copyright (C) 1999-2005 Eliot 00003 * Authors: Antoine Fraboulet <antoine.fraboulet@free.fr> 00004 * Olivier Teuliere <ipkiss@via.ecp.fr> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 *****************************************************************************/ 00020 00021 /** 00022 * \file results.h 00023 * \brief Search result storage class 00024 * \author Olivier Teulière & Antoine Fraboulet 00025 * \date 2005 00026 */ 00027 00028 #ifndef _RESULTS_H_ 00029 #define _RESULTS_H_ 00030 00031 #include <vector> 00032 #include "round.h" 00033 00034 using namespace std; 00035 00036 class Board; 00037 class Rack; 00038 typedef struct _Dictionary * Dictionary; 00039 00040 00041 /** 00042 * This class allows to perform a search on the board for a given rack, 00043 * and it offers accessors to the resulting rounds. 00044 * The rounds are sorted by decreasing number of points (but there is no 00045 * other ordering between 2 rounds with the same number of points). 00046 */ 00047 class Results 00048 { 00049 public: 00050 Results() {} 00051 virtual ~Results() {} 00052 00053 int size() const { return m_rounds.size(); } 00054 void clear() { m_rounds.clear(); } 00055 const Round & get(int) const; 00056 00057 // Perform a search on the board 00058 void search(const Dictionary &iDic, Board &iBoard, 00059 const Rack &iRack, int iTurn); 00060 00061 // FIXME: These methods are used to fill the container with the rounds, 00062 // but they should not be part of the public interface 00063 void add(const Round &iRound) { m_rounds.push_back(iRound); } 00064 00065 void sort_by_points(); 00066 private: 00067 vector<Round> m_rounds; 00068 }; 00069 00070 #endif 00071 00072 /****************************************************************/ 00073 /****************************************************************/ 00074 00075 /// Local Variables: 00076 /// mode: c++ 00077 /// mode: hs-minor 00078 /// c-basic-offset: 4 00079 /// indent-tabs-mode: nil 00080 /// End: