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

Public Member Functions | |
| App () | |
| 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_finish () |
| Manually wait for the working thread to finish. | |
| void | wait_for_workflow () |
| void | set_fec_data_receiv_port (int port_num) |
| Set the 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 | 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 & |
| void | action_after_destructor () |
Private Types | |
| using | udp = asio::ip::udp |
| using | SwitchFutureType = std::expected<std::future<void>, boost::system::error_code> |
| using | SwitchFutureStatusType = std::expected<std::future_status, boost::system::error_code> |
Private Member Functions | |
| void | wait_for_reading_finish () |
| void | set_remote_fec_endpoints () |
| 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 |
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_ |
| io_context_type | io_context_ { 4 } |
| Asio io_context that manages the task scheduling and network IO. | |
| 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::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::Handler > | workflow_handler_ |
| The handler to the analysis working flow. | |
| std::shared_ptr< connection::DataSocket > | data_socket_ |
| 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 80 of file Application.hpp.
|
private |
Definition at line 208 of file Application.hpp.
|
private |
Definition at line 207 of file Application.hpp.
|
private |
Definition at line 206 of file Application.hpp.
| srs::App::App | ( | ) |
Constructor of the App class.
The constructor contains following actions:
Definition at line 32 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 74 of file Application.cpp.
| void srs::App::action_after_destructor | ( | ) |
Definition at line 41 of file Application.cpp.
|
private |
Definition at line 162 of file Application.cpp.
|
inline |
Definition at line 128 of file Application.hpp.
| void srs::App::exit_and_switch_off | ( | ) |
Definition at line 124 of file Application.cpp.
|
inlinenodiscard |
Definition at line 195 of file Application.hpp.
|
inlinenodiscard |
Definition at line 199 of file Application.hpp.
|
inlinenodiscard |
Definition at line 200 of file Application.hpp.
|
inlinenodiscard |
Definition at line 197 of file Application.hpp.
|
inlinenodiscard |
Definition at line 196 of file Application.hpp.
|
inlinenodiscard |
Definition at line 198 of file Application.hpp.
| void srs::App::init | ( | ) |
Initialization of internal members.
Definition at line 82 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 208 of file Application.cpp.
|
inline |
Set the local listen port number for the communications to FEC devices.
Definition at line 172 of file Application.hpp.
|
inline |
Set the configuration values.
Definition at line 187 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 156 of file Application.cpp.
| void srs::App::set_print_mode | ( | common::DataPrintMode | mode | ) |
Set the print mode.
Definition at line 155 of file Application.cpp.
|
private |
Definition at line 255 of file Application.cpp.
| void srs::App::start_workflow | ( | ) |
Start data analysis workflow, triggering data conversions.
This function call is executed in the main thread.
Definition at line 226 of file Application.cpp.
|
private |
Definition at line 177 of file Application.cpp.
| void srs::App::switch_off | ( | ) |
Establish the communications to the available FECs to stop the data acquisition.
Definition at line 202 of file Application.cpp.
| void srs::App::switch_on | ( | ) |
Establish the communications to the available FECs to start the data acquisition.
Definition at line 196 of file Application.cpp.
| void srs::App::wait_for_finish | ( | ) |
Manually wait for the working thread to finish.
This method is called automatically in the destructor and shouldn't be called if not necessary. It blocks the program until the working thread exits.
Definition at line 236 of file Application.cpp.
|
private |
Definition at line 109 of file Application.cpp.
|
staticprivate |
Definition at line 238 of file Application.cpp.
|
inline |
Definition at line 166 of file Application.hpp.
|
private |
Definition at line 210 of file Application.hpp.
|
private |
Definition at line 211 of file Application.hpp.
|
private |
Communication to the main input data stream.
Definition at line 261 of file Application.hpp.
|
private |
Exit helper for App class. This is called after calling the destructor.
Definition at line 251 of file Application.hpp.
|
private |
FEC communication strand for synchronous communications.
Definition at line 233 of file Application.hpp.
|
private |
Asio io_context that manages the task scheduling and network IO.
Definition at line 217 of file Application.hpp.
|
private |
Asio io_context work guard.
Definition at line 221 of file Application.hpp.
|
private |
Remote endpoints of FEC devices.
Definition at line 225 of file Application.hpp.
|
private |
User signal handler for interrupts.
Definition at line 229 of file Application.hpp.
|
private |
Definition at line 245 of file Application.hpp.
|
private |
Definition at line 243 of file Application.hpp.
|
private |
The handler to the analysis working flow.
Definition at line 255 of file Application.hpp.
|
private |
Main thread to run workflow.
Definition at line 241 of file Application.hpp.
|
private |
Main working thread.
Definition at line 237 of file Application.hpp.