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) |
26 |
{ |
{ |
27 |
total = -1; |
total = 0; |
28 |
} |
} |
29 |
|
|
30 |
|
|
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++) |
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 |
} |
} |
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 |
|
total++; |
98 |
} |
} |
99 |
|
|
100 |
Solution* ContainerVector::solution(int index) |
Solution* ContainerVector::solution(int index) |
101 |
{ |
{ |
102 |
return solutions[index] ; |
return solutions[index].get() ; |
103 |
} |
} |
104 |
|
|