TECA
The Toolkit for Extreme Climate Analysis
teca_table_sort.h
1 #ifndef teca_table_sort_h
2 #define teca_table_sort_h
3 
4 #include "teca_config.h"
5 #include "teca_shared_object.h"
6 #include "teca_algorithm.h"
7 #include "teca_metadata.h"
8 
9 #include <string>
10 #include <vector>
11 
12 TECA_SHARED_OBJECT_FORWARD_DECL(teca_table_sort)
13 
14 /// an algorithm that sorts a table in ascending order
16 {
17 public:
18  TECA_ALGORITHM_STATIC_NEW(teca_table_sort)
19  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_table_sort)
20  TECA_ALGORITHM_CLASS_NAME(teca_table_sort)
21  ~teca_table_sort();
22 
23  // report/initialize to/from Boost program options
24  // objects.
25  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
26  TECA_SET_ALGORITHM_PROPERTIES()
27 
28  // set the column to sort by
29  TECA_ALGORITHM_PROPERTY(std::string, index_column)
30  TECA_ALGORITHM_PROPERTY(int, index_column_id)
31 
32  // enable/disable stable sorting. default 0
33  TECA_ALGORITHM_PROPERTY(int, stable_sort)
34 
35  void enable_stable_sort(){ set_stable_sort(1); }
36  void disable_stable_sort(){ set_stable_sort(0); }
37 
38 protected:
40 
41 private:
42  const_p_teca_dataset execute(
43  unsigned int port,
44  const std::vector<const_p_teca_dataset> &input_data,
45  const teca_metadata &request) override;
46 
47 private:
48  std::string index_column;
49  int index_column_id;
50  int stable_sort;
51 };
52 
53 #endif
teca_metadata
A generic container for meta data in the form of name=value pairs.
Definition: teca_metadata.h:21
teca_shared_object.h
teca_table_sort
an algorithm that sorts a table in ascending order
Definition: teca_table_sort.h:15
teca_error::TECA_EXPORT
p_teca_error_handler error_handler TECA_EXPORT
The global error handler instance.
teca_algorithm
The interface to TECA pipeline architecture.
Definition: teca_algorithm.h:237