TECA
teca_table_to_stream.h
1 #ifndef teca_table_to_stream_h
2 #define teca_table_to_stream_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 #include <iostream>
11 
12 TECA_SHARED_OBJECT_FORWARD_DECL(teca_table_to_stream)
13 
17 {
18 public:
19  TECA_ALGORITHM_STATIC_NEW(teca_table_to_stream)
20  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_table_to_stream)
21  TECA_ALGORITHM_CLASS_NAME(teca_table_to_stream)
23 
24  // report/initialize to/from Boost program options
25  // objects.
26  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
27  TECA_SET_ALGORITHM_PROPERTIES()
28 
29  TECA_ALGORITHM_PROPERTY(std::string, header)
30  TECA_ALGORITHM_PROPERTY(std::string, footer)
31 
32  // set the stream object to store the table in.
33  // note that this stream must out live it's use here
34  // as streams are not copy-able and thus we store
35  // a reference to it.
36  void set_stream(std::ostream &s);
37 
38  // set the stream by name. stderr, stdout.
39  void set_stream(const std::string &s);
40  void set_stream_to_stderr();
41  void set_stream_to_stdout();
42 
43 protected:
45 
46 private:
47  const_p_teca_dataset execute(
48  unsigned int port,
49  const std::vector<const_p_teca_dataset> &input_data,
50  const teca_metadata &request) override;
51 
52 private:
53  std::string header;
54  std::string footer;
55  std::ostream *stream;
56 };
57 
58 #endif
teca_metadata
Definition: teca_metadata.h:17
teca_table_to_stream
Definition: teca_table_to_stream.h:17
teca_algorithm
Definition: teca_algorithm.h:25