Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. std::vector<AggrPacket> PacketParser::getAggrPackets(const string &aggrKey) {
  2.  21
  3.  20     vector<AggrPacket> tmp;
  4.  19
  5.  18     for ( auto &pa : _packets ) {
  6.  17         bool f = false;
  7.  16         for ( auto &p : tmp ) {
  8.  15             if ( p.aggrKeyValue == pa->getAggregationValue(aggrKey) ) {
  9.  14                 p.byteSum += pa->getLength();
  10.  13                 p.packetSum++;
  11.  12                 f = true;
  12.  11                 break;
  13.  10             }
  14.   9         }
  15.   8         if ( !f ) {
  16.   7             tmp.push_back( AggrPacket(pa->getAggregationValue(aggrKey)) );
  17.   6             tmp.back().packetSum = 1;
  18.   5             tmp.back().byteSum = pa->getLength();
  19.   4         }
  20.   3     }
  21.   2
  22.   1     return tmp;
  23. 400 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement