TECA
teca_table_sort.h
1 #ifndef teca_table_sort_h
2 #define teca_table_sort_h
3 
4 #include "teca_shared_object.h"
5 #include "teca_algorithm.h"
6 #include "teca_metadata.h"
7 
8 #include <string>
9 #include <vector>
10 
11 TECA_SHARED_OBJECT_FORWARD_DECL(teca_table_sort)
12 
13 class teca_table_sort : public teca_algorithm
15 {
16 public:
17  TECA_ALGORITHM_STATIC_NEW(teca_table_sort)
18  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_table_sort)
19  TECA_ALGORITHM_CLASS_NAME(teca_table_sort)
20  ~teca_table_sort();
21 
22  // report/initialize to/from Boost program options
23  // objects.
24  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
25  TECA_SET_ALGORITHM_PROPERTIES()
26 
27  // set the column to sort by
28  TECA_ALGORITHM_PROPERTY(std::string, index_column)
29  TECA_ALGORITHM_PROPERTY(int, index_column_id)
30 
31  // enable/disable stable sorting. default 0
32  TECA_ALGORITHM_PROPERTY(int, stable_sort)
33 
34  void enable_stable_sort(){ set_stable_sort(1); }
35  void disable_stable_sort(){ set_stable_sort(0); }
36 
37 protected:
39 
40 private:
41  const_p_teca_dataset execute(
42  unsigned int port,
43  const std::vector<const_p_teca_dataset> &input_data,
44  const teca_metadata &request) override;
45 
46 private:
47  std::string index_column;
48  int index_column_id;
49  int stable_sort;
50 };
51 
52 #endif
teca_metadata
Definition: teca_metadata.h:17
teca_table_sort
an algorithm that sorts a table in ascending order
Definition: teca_table_sort.h:15
teca_algorithm
Definition: teca_algorithm.h:25