diff options
Diffstat (limited to 'TAO/tests/CSD_Strategy_Tests/TP_Common/StatisticsHelper.cpp')
-rw-r--r-- | TAO/tests/CSD_Strategy_Tests/TP_Common/StatisticsHelper.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/TAO/tests/CSD_Strategy_Tests/TP_Common/StatisticsHelper.cpp b/TAO/tests/CSD_Strategy_Tests/TP_Common/StatisticsHelper.cpp new file mode 100644 index 00000000000..456d7025478 --- /dev/null +++ b/TAO/tests/CSD_Strategy_Tests/TP_Common/StatisticsHelper.cpp @@ -0,0 +1,35 @@ +// $Id$ +#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] ); + } + } +} |