Sorter.h
Go to the documentation of this file.
1 /*
2  * File: Sorter.h
3  * Author: denis
4  *
5  * Class to sort indeces by numbers that one assignes the numbers for
6  * Accending order.
7  *
8  * Created on February 13, 2012, 10:09 AM
9  */
10 
11 #ifndef _SORTER_H
12 #define _SORTER_H
13 
14 #include <vector>
15 #include <stdint.h>
16 
17 // using unsigned long long rather than uint64_t to ensure consisent behavior on OSX and LINUX
18 
19 namespace mcdatadaq {
20 
21  typedef std::pair < unsigned long long, uint32_t > number_index_pair_t;
22  typedef std::vector< number_index_pair_t > number_index_pair_vector_t;
23 
24  class Sorter {
25 
26  public:
27  Sorter();
28  ~Sorter();
29 
30  /// Add number. The index assigned to the number is the order in which the number is added
31  bool addNumber(const unsigned long long);
32 
33  /// Sorting the indeces by numbers
34  bool sort();
35 
36  /// Get indeces
37  std::vector <uint32_t> getIndeces() const;
38  bool getIndeces(std::vector <uint32_t>&) const;
39 
40  /// Print the numbers and current order of indeces
41  bool print() const;
42 
43  private:
44 
45  number_index_pair_vector_t _numberIndexPair; // vector of indeces and numbers
46 
47  };
48 }// end of namespace mcdatadaq
49 #endif /* _SORTER_H */
50 
std::pair< unsigned long long, uint32_t > number_index_pair_t
Definition: Sorter.h:21
number_index_pair_vector_t _numberIndexPair
Definition: Sorter.h:45
bool addNumber(const unsigned long long)
Add number. The index assigned to the number is the order in which the number is added.
Definition: Sorter.cpp:29
Something conflicts with RandomNumberGenerator. Keep DAQSimulator.h include below Art Framework inclu...
std::vector< uint32_t > getIndeces() const
Get indeces.
Definition: Sorter.cpp:59
std::vector< number_index_pair_t > number_index_pair_vector_t
Definition: Sorter.h:22
bool sort()
Sorting the indeces by numbers.
Definition: Sorter.cpp:39
bool print() const
Print the numbers and current order of indeces.
Definition: Sorter.cpp:68