TECA
The Toolkit for Extreme Climate Analysis
teca_dataset_source.h
1 #ifndef teca_dataset_source_h
2 #define teca_dataset_source_h
3 
4 #include "teca_config.h"
5 #include "teca_algorithm.h"
6 #include "teca_metadata.h"
7 #include "teca_dataset.h"
8 #include "teca_shared_object.h"
9 
10 #include <vector>
11 
12 TECA_SHARED_OBJECT_FORWARD_DECL(teca_dataset_source)
13 
14 /// An algorithm that serves up user provided data and metadata.
15 /**
16  * This algorithm can be used to inject a dataset constructed
17  * on outside of TECA into a TECA pipeline.
18  */
20 {
21 public:
22  TECA_ALGORITHM_STATIC_NEW(teca_dataset_source)
23  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_dataset_source)
24  TECA_ALGORITHM_CLASS_NAME(teca_dataset_source)
26 
27  // report/initialize to/from Boost program options
28  // objects.
29  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
30  TECA_SET_ALGORITHM_PROPERTIES()
31 
32  // set/get the dataset to insert into the pipeline
33  TECA_ALGORITHM_VECTOR_PROPERTY(p_teca_dataset, dataset)
34 
35  void set_dataset(const p_teca_dataset &ds)
36  { this->set_datasets({ds}); }
37 
38  // set/get the metadata to insert into the pipeline
39  TECA_ALGORITHM_PROPERTY(teca_metadata, metadata)
40 
41 protected:
43 
44 private:
46 
47  teca_metadata get_output_metadata(unsigned int port,
48  const std::vector<teca_metadata> &input_md) override;
49 
50  const_p_teca_dataset execute(unsigned int port,
51  const std::vector<const_p_teca_dataset> &input_data,
52  const teca_metadata &request) override;
53 
54 private:
55  std::vector<p_teca_dataset> datasets;
56  teca_metadata metadata;
57 };
58 
59 #endif
teca_metadata
A generic container for meta data in the form of name=value pairs.
Definition: teca_metadata.h:21
teca_algorithm::get_output_metadata
virtual teca_metadata get_output_metadata(unsigned int port, const std::vector< teca_metadata > &input_md)
teca_dataset_source
An algorithm that serves up user provided data and metadata.
Definition: teca_dataset_source.h:19
teca_shared_object.h
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