21 |
|
return true; |
22 |
|
} |
23 |
|
|
24 |
+ |
bool Pattern::add ( std::vector<Pattern> & vpat, std::pair<uint32_t, unsigned int > aData) |
25 |
+ |
{ |
26 |
+ |
bool allOK = true; |
27 |
+ |
std::vector<Pattern> copied; |
28 |
+ |
for (std::vector<Pattern>::iterator ip = vpat.begin(); ip != vpat.end(); ++ip) { |
29 |
+ |
if (! ip->add(aData) ) { |
30 |
+ |
allOK = false; |
31 |
+ |
Pattern modified = *ip; |
32 |
+ |
for (auto ic =modified.theData.begin(); ic!=modified.theData.end(); ic++) { |
33 |
+ |
if (ic->first==aData.first) {ic->second = aData.second; break; } |
34 |
+ |
} |
35 |
+ |
copied.push_back(modified); |
36 |
+ |
} |
37 |
+ |
} |
38 |
+ |
if (copied.size() != 0) vpat.insert(vpat.end(), copied.begin(), copied.end()); |
39 |
+ |
return allOK; |
40 |
+ |
} |
41 |
+ |
|
42 |
+ |
|
43 |
+ |
|
44 |
|
std::ostream & operator << (std::ostream &out, const Pattern &o) |
45 |
|
{ |
46 |
|
out <<" Pattern: size: "<<o.size(); |