SRS-control 0.1.4
Loading...
Searching...
No Matches
TaskDiagram.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <expected>
4#include <tbb/concurrent_queue.h>
5
12
13namespace srs::workflow
14{
16 {
17 public:
18 explicit TaskDiagram(Handler* data_processor, asio::thread_pool& thread_pool);
19
20 // rule of 5
22 TaskDiagram(const TaskDiagram&) = delete;
26
28 using StartingCoroType = asio::experimental::coro<std::string_view(bool)>;
29
30 auto analysis_one(tbb::concurrent_bounded_queue<process::SerializableMsgBuffer>& data_queue, bool is_blocking)
31 -> bool;
32 void set_output_filenames(const std::vector<std::string>& filenames);
33 void reset();
34 // void stop() { run_processes(true); }
35
36 // Getters:
37 template <process::DataConvertOptions option>
38 auto get_data() -> std::string_view;
39
40 auto get_struct_data() -> const auto& { return struct_deserializer_.data(); }
41
42 private:
49
51
53
54 auto generate_starting_coro(asio::any_io_executor /*unused*/) -> StartingCoroType;
55 [[maybe_unused]] auto run_processes(bool is_stopped) -> std::expected<void, std::string_view>;
56 };
57
58 template <process::DataConvertOptions option>
59 auto TaskDiagram::get_data() -> std::string_view
60 {
61 if constexpr (option == raw)
62 {
63 return binary_data_.data();
64 }
65 else if constexpr (option == proto)
66 {
67 return proto_serializer_.data();
68 }
69 else
70 {
71 static_assert(false, "Cannot get the data from this option!");
72 }
73 };
74} // namespace srs::workflow
TaskDiagram(Handler *data_processor, asio::thread_pool &thread_pool)
process::Raw2DelimRawConverter raw_to_delim_raw_converter_
process::ProtoSerializer proto_serializer_
process::StructDeserializer struct_deserializer_
auto get_struct_data() -> const auto &
process::SerializableMsgBuffer binary_data_
void set_output_filenames(const std::vector< std::string > &filenames)
auto generate_starting_coro(asio::any_io_executor) -> StartingCoroType
process::Struct2ProtoConverter struct_proto_converter_
TaskDiagram(TaskDiagram &&)=delete
auto get_data() -> std::string_view
TaskDiagram & operator=(const TaskDiagram &)=delete
TaskDiagram & operator=(TaskDiagram &&)=delete
auto analysis_one(tbb::concurrent_bounded_queue< process::SerializableMsgBuffer > &data_queue, bool is_blocking) -> bool
asio::experimental::coro< std::string_view(bool)> StartingCoroType
TaskDiagram(const TaskDiagram &)=delete
process::ProtoDelimSerializer proto_delim_serializer_
auto run_processes(bool is_stopped) -> std::expected< void, std::string_view >