|
srs-control 0.2.2
|
The primary interface class of SRS-Control. More...
#include <Application.hpp>

Public Member Functions | |
| App (Config config) | |
| Constructor of the App class. | |
| App (const App &)=delete | |
| App (App &&)=delete | |
| App & | operator= (const App &)=delete |
| App & | operator= (App &&)=delete |
| ~App () noexcept | |
| Destructor of the App class. | |
| void | init () |
| Initialization of internal members. | |
| void | configure_fec () |
| void | switch_on () |
| Establish the communications to the available FECs to start the data acquisition. | |
| void | switch_off () |
| Establish the communications to the available FECs to stop the data acquisition. | |
| void | read_data (bool is_non_stop=true) |
| Start reading the input data stream from the port specified by srs::Config::fec_data_receive_port. If is_non_stop is true, the reading process will not be stopped until an interrupt happens, such as pressing "Ctrl-C" from users. If is_non_stop is false, the reading process will be stopped after one frame of data is read. | |
| void | start_workflow () |
| Start data analysis workflow, triggering data conversions. | |
| void | wait_for_workflow () |
| Wait for the workflow process to finish. | |
| 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 | add_fec_data_receiv_port (int port_num) |
| Add a local listen port number for the communications to FEC devices. | |
| void | set_print_mode (common::DataPrintMode mode) |
| Set the print mode. | |
| void | set_output_filenames (const std::vector< std::string > &filenames, std::size_t n_lines=1) |
| Set the output filenames. | |
| void | set_options (Config options) |
| Set the configuration values. | |
| void | set_runtime_sec (std::size_t runtime_sec) |
| Set the runtime in seconds. | |
| void | exit_and_switch_off () |
| auto | get_channel_address () const -> uint16_t |
| auto | get_io_context () -> auto & |
| auto | get_fec_strand () -> auto & |
| auto | get_workflow_handler () const -> const auto & |
| auto | get_config () const -> const auto & |
| auto | get_config_ref () -> auto & |
| auto | get_report () -> AppReport & |
| void | action_after_destructor () |
Private Types | |
| using | udp = asio::ip::udp |
| using | SwitchFutureType = std::expected<std::future<void>, std::error_code> |
| using | SwitchFutureStatusType = std::expected<std::future_status, std::error_code> |
Private Member Functions | |
| void | print_statistics () const |
| void | init_spdlog () |
| void | wait_for_reading_finish () |
| void | set_remote_fec_endpoints () |
| void | set_cancel_method () |
| void | add_remote_fec_endpoint (std::string_view remote_ip, int port_number) |
| template<typename T> | |
| auto | switch_FECs (std::string_view connection_name) -> SwitchFutureType |
| auto | check_port_number_validity () -> bool |
Static Private Member Functions | |
| static auto | wait_for_switch_action (const SwitchFutureType &switch_future) -> SwitchFutureStatusType |
Private Attributes | |
| uint16_t | channel_address_ = common::DEFAULT_CHANNEL_ADDRE |
| Config | config_ |
| std::unique_ptr< AppReport > | report_ |
| io_context_type | io_context_ { 4 } |
| Asio io_context that manages the task scheduling and network IO. | |
| std::size_t | runtime_sec_ {} |
| Time duration (seconds) to stop the application. If value is zero, the application is in non-stop mode and must be stopped by pressing Ctrl-C. | |
| asio::executor_work_guard< io_context_type::executor_type > | io_work_guard_ |
| Asio io_context work guard. | |
| std::vector< udp::endpoint > | remote_fec_endpoints_ |
| Remote endpoints of FEC devices. | |
| asio::signal_set | signal_set_ { io_context_, SIGINT, SIGTERM } |
| User signal handler for interrupts. | |
| asio::steady_timer | cancel_timer_ { io_context_ } |
| Cancelling timer. | |
| asio::strand< io_context_type::executor_type > | fec_strand_ |
| FEC communication strand for synchronous communications. | |
| std::jthread | working_thread_ |
| Main working thread. | |
| std::jthread | workflow_thread_ |
| Main thread to run workflow. | |
| SwitchFutureType | switch_on_future_ |
| SwitchFutureType | switch_off_future_ |
| internal::AppExitHelper | exit_helper_ { this } |
| Exit helper for App class. This is called after calling the destructor. | |
| std::unique_ptr< workflow::AnalysisHandle > | workflow_handler_ |
| The handler to the analysis working flow. | |
| std::vector< std::shared_ptr< connection::DataSocket > > | data_sockets_ |
| Communication to the main input data stream. | |
The primary interface class of SRS-Control.
Application class should be instantiated only once during the whole program. Public setter methods should be called before calling the init() method.
Definition at line 81 of file Application.hpp.
|
private |
Definition at line 218 of file Application.hpp.
|
private |
Definition at line 217 of file Application.hpp.
|
private |
Definition at line 216 of file Application.hpp.
| srs::App::App | ( | Config | config | ) |
Constructor of the App class.
The constructor contains following actions:
Definition at line 83 of file Application.cpp.
|
delete |
|
delete |
|
noexcept |
Destructor of the App class.
This destructor is called before the destruction of each members. The destructor contains following actions:
The exit process of App class also contains the destruction of its member variables. The following order must be kept:
Definition at line 125 of file Application.cpp.
| void srs::App::action_after_destructor | ( | ) |
Definition at line 92 of file Application.cpp.
|
inline |
Add a local listen port number for the communications to FEC devices.
Definition at line 176 of file Application.hpp.
|
private |
Definition at line 271 of file Application.cpp.
|
private |
Definition at line 315 of file Application.cpp.
|
inline |
Definition at line 129 of file Application.hpp.
| void srs::App::exit_and_switch_off | ( | ) |
Definition at line 223 of file Application.cpp.
|
inlinenodiscard |
Definition at line 204 of file Application.hpp.
|
inlinenodiscard |
Definition at line 208 of file Application.hpp.
|
inlinenodiscard |
Definition at line 209 of file Application.hpp.
|
inlinenodiscard |
Definition at line 206 of file Application.hpp.
|
inlinenodiscard |
Definition at line 205 of file Application.hpp.
|
inlinenodiscard |
Definition at line 210 of file Application.hpp.
|
inlinenodiscard |
Definition at line 207 of file Application.hpp.
| void srs::App::init | ( | ) |
Initialization of internal members.
Definition at line 175 of file Application.cpp.
|
private |
Definition at line 48 of file Application.cpp.
|
private |
Definition at line 132 of file Application.cpp.
| void srs::App::read_data | ( | bool | is_non_stop = true | ) |
Start reading the input data stream from the port specified by srs::Config::fec_data_receive_port. If is_non_stop is true, the reading process will not be stopped until an interrupt happens, such as pressing "Ctrl-C" from users. If is_non_stop is false, the reading process will be stopped after one frame of data is read.
| is_non_stop | Flag to set non-stop mode. |
Definition at line 330 of file Application.cpp.
|
private |
Definition at line 140 of file Application.cpp.
|
inline |
Set the local listen port numbers for the communications to FEC devices.
Definition at line 168 of file Application.hpp.
|
inline |
Set the configuration values.
Definition at line 191 of file Application.hpp.
| void srs::App::set_output_filenames | ( | const std::vector< std::string > & | filenames, |
| std::size_t | n_lines = 1 ) |
Set the output filenames.
Definition at line 265 of file Application.cpp.
| void srs::App::set_print_mode | ( | common::DataPrintMode | mode | ) |
Set the print mode.
Definition at line 264 of file Application.cpp.
|
private |
Definition at line 384 of file Application.cpp.
|
inline |
Set the runtime in seconds.
Definition at line 196 of file Application.hpp.
| void srs::App::start_workflow | ( | ) |
Start data analysis workflow, triggering data conversions.
This function call is executed in the main thread.
Definition at line 357 of file Application.cpp.
|
private |
Definition at line 286 of file Application.cpp.
| void srs::App::switch_off | ( | ) |
Establish the communications to the available FECs to stop the data acquisition.
Definition at line 309 of file Application.cpp.
| void srs::App::switch_on | ( | ) |
Establish the communications to the available FECs to start the data acquisition.
Definition at line 307 of file Application.cpp.
|
private |
Definition at line 203 of file Application.cpp.
|
staticprivate |
Definition at line 367 of file Application.cpp.
|
inline |
Wait for the workflow process to finish.
Definition at line 162 of file Application.hpp.
|
private |
Cancelling timer.
Definition at line 250 of file Application.hpp.
|
private |
Definition at line 220 of file Application.hpp.
|
private |
Definition at line 221 of file Application.hpp.
|
private |
Communication to the main input data stream.
Definition at line 282 of file Application.hpp.
|
private |
Exit helper for App class. This is called after calling the destructor.
Definition at line 272 of file Application.hpp.
|
private |
FEC communication strand for synchronous communications.
Definition at line 254 of file Application.hpp.
|
private |
Asio io_context that manages the task scheduling and network IO.
Definition at line 229 of file Application.hpp.
|
private |
Asio io_context work guard.
Definition at line 238 of file Application.hpp.
|
private |
Remote endpoints of FEC devices.
Definition at line 242 of file Application.hpp.
|
private |
Definition at line 225 of file Application.hpp.
|
private |
Time duration (seconds) to stop the application. If value is zero, the application is in non-stop mode and must be stopped by pressing Ctrl-C.
Definition at line 234 of file Application.hpp.
|
private |
User signal handler for interrupts.
Definition at line 246 of file Application.hpp.
|
private |
Definition at line 266 of file Application.hpp.
|
private |
Definition at line 264 of file Application.hpp.
|
private |
The handler to the analysis working flow.
Definition at line 276 of file Application.hpp.
|
private |
Main thread to run workflow.
Definition at line 262 of file Application.hpp.
|
private |
Main working thread.
Definition at line 258 of file Application.hpp.