summaryrefslogtreecommitdiff
path: root/TAO/tests/CSD_Strategy_Tests/TP_Common/StatisticsHelper.cpp
blob: e4b52dcaaae1e56a4db4aa6978b329bf3094b837 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "StatisticsHelper.h"

// swap function for integers
void swap (CORBA::Long& x, CORBA::Long& y)
{
  CORBA::Long temp;
  temp = x;
  x = y;
  y = temp;
}


void sort (LongVector & vector)
{
  unsigned size = vector.size ();

  if (size > 0)
    {
      unsigned indexOfMin;
      unsigned pass;
      unsigned j;

      for (pass = 0; pass < size - 1; pass++ )
      {
        indexOfMin = pass;

        for (j = pass + 1; j < size; j++ )
          if (vector[j] < vector[indexOfMin] )
            indexOfMin = j;

        swap (vector[pass], vector[indexOfMin]);
      }
    }
}