/[projects]/queensgui/src/containerlist.cpp
ViewVC logotype

Diff of /queensgui/src/containerlist.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

queensgui/src/solutionlist.cpp revision 2 by torben, Thu Jul 19 22:26:42 2007 UTC queensgui/src/containerlist.cpp revision 6 by torben, Fri Jul 20 09:54:09 2007 UTC
# Line 17  Line 17 
17   *   Free Software Foundation, Inc.,                                       *   *   Free Software Foundation, Inc.,                                       *
18   *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *   *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19   ***************************************************************************/   ***************************************************************************/
20  #include "solutionlist.h"  #include "containerlist.h"
21    
22  SolutionList::SolutionList(GUIUpdate* update)  ContainerList::ContainerList(GUIUpdate* update)
23   : SolutionContainer(update)   : SolutionContainer(update)
24  {  {
25      total = -1;      total = -1;
26  }  }
27    
28    
29  SolutionList::~SolutionList()  ContainerList::~ContainerList()
30  {  {
31  }  }
32    
33    
34  int SolutionList::numSolutions()  int ContainerList::numSolutions()
35  {  {
36          return solutions.size();          return solutions.size();
37  }  }
38    
39  int SolutionList::totalSolutions()  int ContainerList::totalSolutions()
40  {  {
41          return total;          return total;
42  }  }
43    
44    
45  void SolutionList::uniqueSolutions()  void ContainerList::uniqueSolutions()
46  {  {
47          for (int i=1;i<=4;i++) {          for (int i=1;i<=4;i++) {
48                  if (m_halt)                  if (m_halt)
# Line 53  void SolutionList::uniqueSolutions() Line 53  void SolutionList::uniqueSolutions()
53  }  }
54    
55    
56  void SolutionList::uniqueSolutionsWorker(int rot,bool mirror)  void ContainerList::uniqueSolutionsWorker(int rot,bool mirror)
57  {  {
58          int match_count;          int match_count;
59    
# Line 64  void SolutionList::uniqueSolutionsWorker Line 64  void SolutionList::uniqueSolutionsWorker
64                  if (m_halt)                  if (m_halt)
65                          return;                          return;
66                  match_count = 0;                  match_count = 0;
67                  Solution* tmp = (*i)->copy();                  
68                    std::auto_ptr<Solution> tmp ( (*i)->copy() );
69                  if (mirror)                  if (mirror)
70                          tmp->mirror();                          tmp->mirror();
71                  for (int k=0;k<rot;k++)                  for (int k=0;k<rot;k++)
# Line 87  void SolutionList::uniqueSolutionsWorker Line 88  void SolutionList::uniqueSolutionsWorker
88  }  }
89    
90    
91  void SolutionList::addSolution(Solution* sol)  void ContainerList::addSolution(Solution* sol)
92  {  {
93      solutions.push_back(sol);            solutions.push_back(boost::shared_ptr<Solution>(sol));  
94  }  }
95    
96  Solution* SolutionList::solution(int index)  Solution* ContainerList::solution(int index)
97  {  {
98      int count=0;      int count=0;
99          ListIt it;          ListIt it;
# Line 102  Solution* SolutionList::solution(int ind Line 103  Solution* SolutionList::solution(int ind
103                  break;                  break;
104                  }                  }
105      }      }
106      return *it;      return (*it).get();
107  }  }
108    

Legend:
Removed from v.2  
changed lines
  Added in v.6

  ViewVC Help
Powered by ViewVC 1.1.20