REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
|
A recoverable error, inspired from https://abseil.io/docs/cpp/guides/status and https://github.com/abseil/abseil-cpp/blob/master/absl/status/status.h. More...
#include <error.h>

Public Member Functions | |
status (int code, std::string msg) | |
status () | |
Empty means success. See also success() method for more verbosity in code. | |
status (int code) | |
0 means success, anything else not success. | |
status (bool code) | |
True means success, false not success. | |
status (std::string msg) | |
Generic failure (without code) | |
status (const char *msg) | |
template<typename... Args> | |
status (const char *format, Args... args) | |
Usage like status("Foo %d bar %s baz", 3, "bling");. | |
template<typename... Args> | |
status (int code, const char *format, Args... args) | |
status & | attach (const status &other, const char *description="") |
Attach another error message to this one. Is chainable, returns self. | |
status & | attach_to (status &other, const char *description="") |
Attach this error message to another one. Is chainable, returns self. | |
status & | attach (int _code, const char *_msg) |
Attach a "raw" message to this one. | |
status & | attach (const char *_msg) |
bool | is_ok () const |
operator bool () const | |
Class instances cast to bool where true means success and false means failure. | |
Static Public Member Functions | |
static status | success () |
Syntactic sugar for success. | |
static status | failure () |
Syntactic sugar for failure. | |
Public Attributes | |
int | code |
Status code. 0 means success. | |
std::string | msg |
Human readable error string. | |
Detailed Description
A recoverable error, inspired from https://abseil.io/docs/cpp/guides/status and https://github.com/abseil/abseil-cpp/blob/master/absl/status/status.h.
This class should be used as immutable.
For making the success path cheap, use status::success.
Constructor & Destructor Documentation
◆ status() [1/8]
|
inline |
Definition at line 40 of file error.h.
References code, LOG4, and LOG_ALWAYS.
◆ status() [2/8]
|
inline |
◆ status() [3/8]
|
inlineexplicit |
◆ status() [4/8]
|
inlineexplicit |
◆ status() [5/8]
|
inlineexplicit |
◆ status() [6/8]
◆ status() [7/8]
|
inline |
◆ status() [8/8]
|
inline |
Member Function Documentation
◆ attach() [1/3]
◆ attach() [2/3]
Attach another error message to this one. Is chainable, returns self.
Definition at line 72 of file error.h.
References code, is_ok(), and msg.
Referenced by attach_to(), blocks::Router::route_carrier(), blocks::Router::route_stack(), platform::LUCIDAC::write_to_hardware(), and platform::LUCIDACFrontPanel::write_to_hardware().
◆ attach() [3/3]
|
inline |
◆ attach_to()
Attach this error message to another one. Is chainable, returns self.
Definition at line 81 of file error.h.
References attach().
Referenced by platform::LUCIDAC::write_to_hardware().
◆ failure()
|
inlinestatic |
Syntactic sugar for failure.
Definition at line 107 of file error.h.
References status().
Referenced by blocks::Router::route_carrier(), blocks::MIntBlock_V_1_1_X::write_calibration_to_hardware(), blocks::CBlock::write_to_hardware(), blocks::UBlock::write_to_hardware(), and platform::Cluster::write_to_hardware().
◆ is_ok()
|
inline |
Definition at line 98 of file error.h.
References code.
Referenced by attach(), and operator bool().
◆ operator bool()
|
inline |
◆ success()
|
inlinestatic |
Syntactic sugar for success.
Definition at line 104 of file error.h.
References status().
Referenced by blocks::UBlock::_config_constants_from_json(), blocks::CBlock::_config_elements_form_json(), blocks::MIntBlock::_config_elements_from_json(), blocks::MMulBlock::_config_elements_from_json(), platform::LUCIDACFrontPanel::_config_leds_from_json(), blocks::IBlock::_config_outputs_from_json(), blocks::UBlock::_config_outputs_from_json(), platform::LUCIDACFrontPanel::_config_signal_generator_from_json(), blocks::IBlock::_config_upscaling_from_json(), blocks::IBlock::_connect_from_json(), daq::calibrate(), entities::Entity::config_children_from_json(), entities::Entity::config_from_json(), blocks::CBlock::config_self_from_json(), blocks::CTRLBlock::config_self_from_json(), blocks::EmptyMBlock::config_self_from_json(), blocks::IBlock::config_self_from_json(), blocks::MIntBlock::config_self_from_json(), blocks::MMulBlock::config_self_from_json(), blocks::TBlock::config_self_from_json(), blocks::UBlock::config_self_from_json(), carrier::Carrier::config_self_from_json(), platform::Cluster::config_self_from_json(), platform::LUCIDAC::config_self_from_json(), platform::LUCIDACFrontPanel::config_self_from_json(), platform::REDACBackPanel::config_self_from_json(), blocks::TBlock::connect(), daq::init(), daq::stream::process(), blocks::Router::route_carrier(), blocks::Router::route_stack(), daq::stream::start(), daq::stream::stop(), entities::Entity::user_get_config(), carrier::Carrier::user_get_overload_status(), entities::Entity::user_reset_config(), entities::Entity::user_set_config(), carrier::Carrier::user_set_extended_config(), blocks::MIntBlock_V_1_1_X::write_calibration_to_hardware(), blocks::MMulBlock::write_calibration_to_hardware(), blocks::MMulBlock_FullAutoCalibration::write_calibration_to_hardware(), blocks::CBlock::write_to_hardware(), blocks::EmptyMBlock::write_to_hardware(), blocks::MIntBlock::write_to_hardware(), blocks::SHBlock::write_to_hardware(), blocks::TBlock::write_to_hardware(), blocks::UBlock::write_to_hardware(), entities::Entity::write_to_hardware(), platform::Cluster::write_to_hardware(), platform::LUCIDACFrontPanel::SignalGenerator::write_to_hardware(), and platform::REDAC::write_to_hardware().
Member Data Documentation
◆ code
int utils::status::code |
Status code. 0 means success.
Definition at line 37 of file error.h.
Referenced by attach(), attach(), msg::handlers::GetConfigMessageHandler::handle(), msg::handlers::GetOverloadStatusHandler::handle(), msg::handlers::ResetRequestHandler::handle(), msg::handlers::SetConfigMessageHandler::handle(), is_ok(), status(), and carrier::Carrier::write_to_hardware().
◆ msg
std::string utils::status::msg |
Human readable error string.
Definition at line 38 of file error.h.
Referenced by attach(), msg::handlers::GetConfigMessageHandler::handle(), msg::handlers::GetOverloadStatusHandler::handle(), msg::handlers::ResetRequestHandler::handle(), msg::handlers::SetConfigMessageHandler::handle(), and carrier::Carrier::write_to_hardware().
The documentation for this class was generated from the following file:
- lib/controller/src/utils/error.h