6#include <asio/executor_work_guard.hpp>
7#include <asio/ip/udp.hpp>
8#include <asio/signal_set.hpp>
9#include <asio/steady_timer.hpp>
10#include <asio/strand.hpp>
11#include <asio/thread_pool.hpp>
20#include <system_error>
149 void read_data(
bool is_non_stop =
true);
157 void start_workflow();
170 config_.fec_data_receive_ports = port_nums;
186 void set_output_filenames(
const std::vector<std::string>& filenames, std::size_t n_lines = 1);
198 void exit_and_switch_off();
213 void action_after_destructor();
216 using udp = asio::ip::udp;
292 template <
typename T>
The primary interface class of SRS-Control.
asio::executor_work_guard< io_context_type::executor_type > io_work_guard_
Asio io_context work guard.
void set_fec_data_receiv_ports(const std::vector< int > &port_nums)
Set the local listen port numbers for the communications to FEC devices.
void init()
Initialization of internal members.
SwitchFutureType switch_on_future_
App & operator=(const App &)=delete
uint16_t channel_address_
void add_remote_fec_endpoint(std::string_view remote_ip, int port_number)
auto get_config() const -> const auto &
asio::signal_set signal_set_
User signal handler for interrupts.
std::vector< udp::endpoint > remote_fec_endpoints_
Remote endpoints of FEC devices.
auto get_workflow_handler() const -> const auto &
std::jthread working_thread_
Main working thread.
asio::steady_timer cancel_timer_
Cancelling timer.
auto get_channel_address() const -> uint16_t
std::vector< std::shared_ptr< connection::DataSocket > > data_sockets_
Communication to the main input data stream.
App & operator=(App &&)=delete
auto get_report() -> AppReport &
std::unique_ptr< AppReport > report_
std::unique_ptr< workflow::AnalysisHandle > workflow_handler_
The handler to the analysis working flow.
internal::AppExitHelper exit_helper_
Exit helper for App class. This is called after calling the destructor.
auto get_fec_strand() -> auto &
asio::strand< io_context_type::executor_type > fec_strand_
FEC communication strand for synchronous communications.
auto check_port_number_validity() -> bool
auto get_io_context() -> auto &
void set_options(Config options)
Set the configuration values.
void set_remote_fec_endpoints()
static auto wait_for_switch_action(const SwitchFutureType &switch_future) -> SwitchFutureStatusType
SwitchFutureType switch_off_future_
void add_fec_data_receiv_port(int port_num)
Add a local listen port number for the communications to FEC devices.
io_context_type io_context_
Asio io_context that manages the task scheduling and network IO.
void print_statistics() const
std::jthread workflow_thread_
Main thread to run workflow.
void set_runtime_sec(std::size_t runtime_sec)
Set the runtime in seconds.
auto get_config_ref() -> auto &
App(Config config)
Constructor of the App class.
std::size_t runtime_sec_
Time duration (seconds) to stop the application. If value is zero, the application is in non-stop mod...
auto switch_FECs(std::string_view connection_name) -> SwitchFutureType
std::expected< std::future< void >, std::error_code > SwitchFutureType
void wait_for_reading_finish()
void wait_for_workflow()
Wait for the workflow process to finish.
std::expected< std::future_status, std::error_code > SwitchFutureStatusType
Socket class for reading main data stream.
An internal exit helper for App class.
AppExitHelper & operator=(const AppExitHelper &)=default
~AppExitHelper() noexcept
Destructor calling srs::App::end_of_work method.
AppExitHelper & operator=(AppExitHelper &&)=delete
AppExitHelper(const AppExitHelper &)=default
AppExitHelper(AppExitHelper &&)=delete
AppExitHelper(App *app)
Constructor with pointer to srs::App instance.
constexpr auto DEFAULT_CHANNEL_ADDRE
DataPrintMode
Print mode of the status line.
asio::thread_pool io_context_type
Main configuration struct.