ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/src/Pattern.cc
(Generate patch)

Comparing UserCode/L1RpcTriggerAnalysis/src/Pattern.cc (file contents):
Revision 1.1 by konec, Fri May 17 13:04:54 2013 UTC vs.
Revision 1.2 by konec, Thu May 23 18:24:04 2013 UTC

# Line 21 | Line 21 | bool Pattern::add ( std::pair<uint32_t,
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();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines