SatDump 2.0.0-alpha-76a915210
Loading...
Searching...
No Matches
flowgraph_processor.h
1#pragma once
2
3#include "flowgraph/flowgraph.h"
4#include "processor.h"
5
6namespace satdump
7{
8 namespace handlers
9 {
10 class Flowgraph_DatasetProductProcessor : public DatasetProductProcessor
11 {
12 private:
13 Flowgraph flowgraph;
14
15 private: // TODOREWORK?
16 class DatasetProductSource_Node : public NodeInternal
17 {
18 private:
19 Flowgraph_DatasetProductProcessor *proc;
20 std::string product_id;
21 int product_index = 0;
22
23 public:
24 DatasetProductSource_Node(Flowgraph_DatasetProductProcessor *proc) : NodeInternal("Dataset Product Source"), proc(proc) { outputs.push_back({"Product"}); }
25
26 void process()
27 {
28 outputs[0].ptr = std::shared_ptr<products::Product>(proc->get_instrument_products(product_id, product_index), [](products::Product *) {}); // No Deleter
29 has_run = true;
30 }
31
32 void render()
33 {
34 ImGui::SetNextItemWidth(200 * ui_scale);
35 ImGui::InputText("ID", &product_id);
36 ImGui::SetNextItemWidth(200 * ui_scale);
37 ImGui::InputInt("Index", &product_index);
38 }
39
40 nlohmann::json to_json()
41 {
42 nlohmann::json j;
43 j["id"] = product_id;
44 j["index"] = product_index;
45 return j;
46 }
47
48 void from_json(nlohmann::json j)
49 {
50 product_id = j["id"];
51 product_index = j["index"];
52 }
53 };
54
55 public:
56 Flowgraph_DatasetProductProcessor(DatasetHandler *dh, Handler *dp, nlohmann::json p);
57
58 nlohmann::json getCfg();
59
60 bool can_process();
61 void process(float *progress = nullptr);
62 void renderUI();
63 };
64 } // namespace handlers
65} // namespace satdump
Definition flowgraph.h:71
Definition flowgraph.h:18
Dataset handler.
Definition dataset_handler.h:29
SatDump's handler base class.
Definition handler.h:32
Core SatDump product class.
Definition product.h:33