2 #ifndef FALAISE_SNEMO_PROCESSING_MODULE_H 3 #define FALAISE_SNEMO_PROCESSING_MODULE_H 15 namespace processing {
21 using std::logic_error::logic_error;
26 using std::logic_error::logic_error;
90 static_assert(std::is_default_constructible<T>::value,
"T must be default constructible");
92 std::is_constructible<T, falaise::config::property_set const&, datatools::service_manager&>::value,
93 "T must have a constructor T(datatools::properties const&, " 94 "datatools::services const&)");
116 if (config.
has_key(
"module_label")) {
119 if (config.
has_key(
"module_type")) {
124 module_config.put(
"module_label",
get_name());
125 module_config.put(
"module_type", factory.
get_type_id());
128 wrappedModule = T(module_config, services);
131 std::ostringstream oss{};
132 oss <<
"initialization of module '" <<
get_name() <<
"' (type '" << factory.
get_type_id() <<
"') failed with exception:\n" 133 <<
"- missing_key_error: " << e.what() <<
"\n";
138 std::ostringstream oss{};
139 oss <<
"initialization of module '" <<
get_name() <<
"' (type '" << factory.
get_type_id() <<
"') failed with exception:\n" 140 <<
"- wrong_type_error: " << e.what() <<
"\n";
144 catch (
const std::exception& e) {
145 std::ostringstream oss{};
146 oss <<
"initialization of module '" <<
get_name() <<
"' (type '" << factory.
get_type_id() <<
"') failed with exception:\n" 147 <<
"- <unknown>: " << e.what() <<
"\n";
169 static WrapperFactory factory;
179 #define FALAISE_REGISTER_MODULE(T) \ 180 namespace falaise { \ 181 namespace processing { \ 183 module<T>::WrapperFactory module<T>::factory{#T}; \ 187 #endif // FALAISE_SNEMO_PROCESSING_MODULE_H
Exception thrown if module fails configuration.
Definition: module.h:25
Definition: property_set.h:28
Exception thrown when requesting a key that is not in the property_set.
Definition: property_set.h:17
void _set_initialized(bool initialized_)
A DPP module wrapping a simple processing algorithm.
Definition: module.h:89
const std::string & get_name() const
void reset() override
Change module state to unitialized.
Definition: module.h:104
std::map< std::string, module_entry_type > module_handle_dict_type
Definition: metadata_utils.h:35
Exception thrown if configuration overwrites reserved keys.
Definition: module.h:20
Class holding a set of key-value properties.
Definition: property_set.h:189
status process(datatools::things &data) override
Process the input data.
Definition: module.h:161
void initialize(datatools::properties const &config, datatools::service_manager &services, dpp::module_handle_dict_type &) override
Initialize the module.
Definition: module.h:113
virtual ~module()
Destructor.
Definition: module.h:101