Class ApplicationManager
Defined in File ApplicationManager.h
Inheritance Relationships
Base Type
public ska::pst::common::StateModel
(Class StateModel)
Derived Types
public ska::pst::dsp::DiskManager
(Class DiskManager)public ska::pst::dsp::DiskMonitor
(Class DiskMonitor)public ska::pst::dsp::FlowThroughManager
(Class FlowThroughManager)public ska::pst::dsp::StreamWriter
(Class StreamWriter)public ska::pst::recv::Receiver
(Class Receiver)public ska::pst::smrb::DataBlockManager
(Class DataBlockManager)public ska::pst::stat::StatApplicationManager
(Class StatApplicationManager)
Class Documentation
-
class ApplicationManager : public ska::pst::common::StateModel
The ApplicationManager.
Subclassed by ska::pst::dsp::DiskManager, ska::pst::dsp::DiskMonitor, ska::pst::dsp::FlowThroughManager, ska::pst::dsp::StreamWriter, ska::pst::recv::Receiver, ska::pst::smrb::DataBlockManager, ska::pst::stat::StatApplicationManager
Public Functions
-
ApplicationManager(const std::string &entity)
Construct a new ApplicationManager object, initialising the State to Unknown.
-
~ApplicationManager()
Destroy the ApplicationManager object.
-
void main()
Main thread of control for the implementing class, and uses UpdateCommands to transistion intermediate states to steady states. Intended to be called in a separate std::thread from the LmcService that controls this state.
-
void quit()
Issue the commands on the ApplicationManager required to terminate the main method.
-
bool is_idle() const
Return true if Application state model is Idle.
- Returns
true if application state is Idle
- Returns
false if application state is not Idle
-
bool is_beam_configured() const
Return true if Application beam resources are currently assigned.
- Returns
true if state is one of the following: BeamConfigured, ScanConfigured, Scanning
- Returns
false beam not configured
-
bool is_scan_configured() const
Return true if the Application has been configured for scan.
- Returns
true Application has been configured for scan
- Returns
false Application has not been configured for scan
-
bool is_scanning() const
Return true if the Application is Scanning.
- Returns
true Application is in a Scanning state
- Returns
false Application is not in a Scanning state
-
State get_previous_state() const
Get the previous state before being in a RuntimeError state.
- Returns
State
-
void enforce(bool required, const std::string &contextual_message) const
Utility method to enforce that required is true or else an exception is thrown.
- Parameters
required – boolean value that must be true.
contextual_message – Runtime error message describing the calling context.
- Throws
std::runtime_error – if required is false
-
void enforce_state(ska::pst::common::State required_state, const std::string &contextual_message) const
Mandate the application manager is in the required state.
- Parameters
required_state – required state for the state model
contextual_message – Runtime error message describing the calling context
- Throws
std::runtime_error – if the state does not match the required_state
-
void go_to_runtime_error(std::exception_ptr exception)
Utility method to move application manager to RuntimeError state.
This method is used by the gRPC interface to make sure that the application is in a faulted state, this could be because an error from the LMC.
- Parameters
exception – an exception pointer to store as most recently received exception.
Protected Functions
-
virtual void perform_initialise() = 0
Initialisation callback to be implemented in the child class. The method should wait for the Unknown state and transition the state model to the Initialised.
-
virtual void perform_configure_beam() = 0
Beam configuration callback that is called by main to transition the state from Idle to BeamConfigured.
-
virtual void perform_configure_scan() = 0
Scan configuration callback that is called by main to transition the state from BeamConfigured to ScanConfigured.
-
virtual void perform_scan() = 0
Scan callback that is called by main to spawn a child thread that calls perform_start_scan. This method is expected to block until the scan is complete.
-
void perform_scan_safely()
Calls the perform_scan method wrapped in a try/catch statement for a std::exception. This method is run by the main in a std::thread, and so the try/catch wrapper ensures that any std::exception thrown by the child class’ perform_scan method is caught and used to transition to the RuntimeError state. Note that the child class can additionally wrap its’ perform_scan method in a try/catch statement, allowing it to perform any necessary releasing of resources.
-
virtual void perform_start_scan() = 0
Scan callback that is called by main to transition the state from StartingScan to Scanning. This method is expected to block until the scan is complete.
-
virtual void perform_stop_scan() = 0
StopScan callback that is called by main to transition the state from Scanning to ScanConfigured. This method is expected to block until state transitions to ScanConfigured.
-
virtual void perform_deconfigure_scan() = 0
Scan callback that is called by main to transition the state from ScanConfigured to BeamConfigured. This method is expected to block until state transitions to BeamConfigured.
-
virtual void perform_deconfigure_beam() = 0
Scan callback that is called by main to transition the state from BeamConfigured to Idle. This method is expected to block until state transitions to Idle.
-
virtual void perform_reset()
Reset callback that is called by main to transition the state from RuntimeError to Idle. This method is expected to block until state transitions to Idle.
-
ApplicationManager(const std::string &entity)