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

Diff of /queensgui/src/containervector.cpp

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

revision 5 by torben, Thu Jul 19 23:44:01 2007 UTC revision 6 by torben, Fri Jul 20 09:54:09 2007 UTC
# Line 19  Line 19 
19   ***************************************************************************/   ***************************************************************************/
20  #include "containervector.h"  #include "containervector.h"
21    
22    #include <memory>
23    
24    
25  ContainerVector::ContainerVector(GUIUpdate* update) : SolutionContainer(update)  ContainerVector::ContainerVector(GUIUpdate* update) : SolutionContainer(update)
# Line 59  void ContainerVector::uniqueSolutionsWor Line 60  void ContainerVector::uniqueSolutionsWor
60          if (total == -1)          if (total == -1)
61                  total = solutions.size();                  total = solutions.size();
62                    
63          std::vector<Solution*> buf;          std::vector<boost::shared_ptr<Solution> > buf;
64          for (unsigned int i=0; i<solutions.size(); i++) {          for (unsigned int i=0; i<solutions.size(); i++) {
65                  if (m_halt)                  if (m_halt)
66                          return;                          return;
67                  match_count = 0;                  match_count = 0;
68                  Solution* tmp = solutions[i]->copy();                  
69                    std::auto_ptr<Solution> tmp ( solutions[i]->copy());
70                  if (mirror)                  if (mirror)
71                          tmp->mirror();                          tmp->mirror();
72                  for (int k=0;k<rot;k++)                  for (int k=0;k<rot;k++)
# Line 79  void ContainerVector::uniqueSolutionsWor Line 81  void ContainerVector::uniqueSolutionsWor
81                  }                  }
82                  if (match_count < 1)                  if (match_count < 1)
83                  {                  {
84                          buf.push_back(tmp);                          buf.push_back( boost::shared_ptr<Solution>(tmp->copy()) );
85                          m_uniqueRemoved ++;                          m_uniqueRemoved ++;
86                          m_update->duplicateRemoved();                          m_update->duplicateRemoved();
87                  }                  }
# Line 91  void ContainerVector::uniqueSolutionsWor Line 93  void ContainerVector::uniqueSolutionsWor
93    
94  void ContainerVector::addSolution(Solution* sol)  void ContainerVector::addSolution(Solution* sol)
95  {  {
96      solutions.push_back(sol);        solutions.push_back( boost::shared_ptr<Solution>(sol) );  
97  }  }
98    
99  Solution* ContainerVector::solution(int index)  Solution* ContainerVector::solution(int index)
100  {  {
101      return solutions[index] ;      return solutions[index].get() ;
102  }  }
103    

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

  ViewVC Help
Powered by ViewVC 1.1.20