TECA
The Toolkit for Extreme Climate Analysis
teca_dataset_capture.h
1 #ifndef teca_dataset_capture_h
2 #define teca_dataset_capture_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 TECA_SHARED_OBJECT_FORWARD_DECL(teca_dataset_capture)
11 
12 /** @brief
13  * An algorithm that takes a reference to dataset produced
14  * by the upstream algorithm it is connected to.
15  *
16  * @details
17  * The dataset is passed through so that this can be inserted
18  * anywhere giving one access to the intermediate data.
19  */
21 {
22 public:
23  TECA_ALGORITHM_STATIC_NEW(teca_dataset_capture)
24  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_dataset_capture)
25  TECA_ALGORITHM_CLASS_NAME(teca_dataset_capture)
27 
28  // report/initialize to/from Boost program options
29  // objects.
30  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
31  TECA_SET_ALGORITHM_PROPERTIES()
32 
33  // set/get the dataset from the last pipeline update
34  TECA_ALGORITHM_PROPERTY(const_p_teca_dataset, dataset)
35 
36  template <typename dataset_t = teca_dataset>
37  std::shared_ptr<const dataset_t> get_dataset_as()
38  {
39  return std::dynamic_pointer_cast<const dataset_t>(this->dataset);
40  }
41 
42 protected:
44 
45 private:
46  const_p_teca_dataset execute(unsigned int port,
47  const std::vector<const_p_teca_dataset> &input_data,
48  const teca_metadata &request) override;
49 
50 private:
51  const_p_teca_dataset dataset;
52 };
53 
54 #endif
The interface to TECA pipeline architecture.
Definition: teca_algorithm.h:244
An algorithm that takes a reference to dataset produced by the upstream algorithm it is connected to.
Definition: teca_dataset_capture.h:21
Interface for TECA datasets.
Definition: teca_dataset.h:232
A generic container for meta data in the form of name=value pairs.
Definition: teca_metadata.h:22
p_teca_error_handler error_handler TECA_EXPORT
The global error handler instance.