Falaise  4.0.1
SuperNEMO Software Toolkit
Public Member Functions | List of all members
falaise::processing::module< T > Class Template Reference

A DPP module wrapping a simple processing algorithm. More...

#include <falaise/snemo/processing/module.h>

Inheritance diagram for falaise::processing::module< T >:
dpp::base_module datatools::i_tree_dumpable

Public Member Functions

virtual ~module ()
 Destructor. More...
 
void reset () override
 Change module state to unitialized. More...
 
void initialize (datatools::properties const &config, datatools::service_manager &services, dpp::module_handle_dict_type &) override
 Initialize the module. More...
 
status process (datatools::things &data) override
 Process the input data. More...
 
- Public Member Functions inherited from dpp::base_module
 base_module (datatools::logger::priority p_=datatools::logger::PRIO_FATAL)
 
virtual ~base_module ()
 
bool has_name () const
 
void set_name (const std::string &)
 
const std::string & get_name () const
 
bool has_description () const
 
const std::string & get_description () const
 
void set_description (const std::string &description_)
 
bool has_last_error_message () const
 
void set_last_error_message (const std::string &)
 
void append_last_error_message (const std::string &errmsg_)
 
void reset_last_error_message ()
 
const std::string & get_last_error_message () const
 
bool is_initialized () const
 
virtual void initialize_simple ()
 
virtual void initialize_simple_with_service (datatools::service_manager &service_manager_)
 
virtual void initialize_standalone (const datatools::properties &config_)
 
virtual void initialize_with_service (const datatools::properties &config_, datatools::service_manager &service_manager_)
 
virtual void initialize_without_service (const datatools::properties &config, module_handle_dict_type &module_dictionnary_)
 
virtual void tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
 
void print (std::ostream &out_=std::clog) const
 
void set_logging_priority (datatools::logger::priority p_)
 
datatools::logger::priority get_logging_priority () const
 
- Public Member Functions inherited from datatools::i_tree_dumpable
 i_tree_dumpable ()
 
virtual ~i_tree_dumpable ()
 
virtual void print_tree (std::ostream &out_=std::clog, const boost::property_tree::ptree &options_=empty_options()) const
 
void print_tree_json (std::ostream &out_=std::clog, const std::string &json_options_="") const
 
void print_tree_json (std::ostream &out_=std::clog, const char *json_options_=nullptr) const
 
void tree_dump_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="", const bool inherit_=false) const
 
void tree_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="") const
 
void smart_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="") const
 

Additional Inherited Members

- Public Types inherited from dpp::base_module
enum  process_status
 
- Public Types inherited from datatools::i_tree_dumpable
enum  ostream_type
 
- Static Public Member Functions inherited from dpp::base_module
static void common_ocd (datatools::object_configuration_description &ocd_)
 
- Static Public Member Functions inherited from datatools::i_tree_dumpable
static const boost::property_tree::ptree & empty_options ()
 
static boost::property_tree::ptree make_base_print_options (const std::string &title_, const std::string &indent_="", const bool inherit_=false)
 
static std::ostream & last_skip_tag (std::ostream &out_)
 
static std::ostream & skip_tag (std::ostream &out_)
 
static std::ostream & last_tag (std::ostream &out_)
 
static std::ostream & tag (std::ostream &out_)
 
- Public Attributes inherited from dpp::base_module
 PROCESS_OK
 
 PROCESS_SUCCESS
 
 PROCESS_CONTINUE
 
 PROCESS_ERROR
 
 PROCESS_FAILURE
 
 PROCESS_STOP
 
 PROCESS_ERROR_STOP
 
 PROCESS_FATAL
 
 PROCESS_INVALID
 
- Public Attributes inherited from datatools::i_tree_dumpable
 OSTREAM_COUT
 
 OSTREAM_CERR
 
 OSTREAM_CLOG
 
- Protected Member Functions inherited from dpp::base_module
void _set_name (const std::string &name_)
 
void _set_initialized (bool initialized_)
 
void _common_initialize (const datatools::properties &config_)
 
- Protected Attributes inherited from dpp::base_module
std::string _name
 
std::string _description
 
datatools::logger::priority _logging
 
bool _initialized
 
std::string _last_error_message
 

Detailed Description

template<typename T>
class falaise::processing::module< T >

A DPP module wrapping a simple processing algorithm.

Modules in Falaise's DPP pipeline are concrete classes of dpp::base_module. Authors of modules need to write a significant amount of boilerplate code for the initialize/reset/destruction member functions/states required by dpp::base_module. This class template automatically generates these state transitions for the templated type T. This type only needs to implement constructors for initialization (via configuration properties) and a process member function in which the event data will be processed.

The type to be wrapped must meet the requirements:

For example:

class MyModule
{
MyModule(); // ideally this is =default
MyModule(falaise::config::property_set const& config, datatools::service_manager& services);
};

The user defined constructor must throw if initialization fails.

The class is wrapped and registered with Falaise's DPP plugin system by calling the macro FALAISE_REGISTER_MODULE(T) in the module's implementation file, e.g.

// This is MyModule.cpp
class MyModule
{
... as above ...
};

The module will be registered with a string key equal to the typename so that use in pipeline scripts is transparent, e.g.

[name="theLabel" type="MyModule"]
... config ...
See also
dpp::base_module

Constructor & Destructor Documentation

◆ ~module()

template<typename T >
virtual falaise::processing::module< T >::~module ( )
inlinevirtual

Destructor.

Moves state to uninitialized as required by dpp::base_module

Member Function Documentation

◆ initialize()

template<typename T >
void falaise::processing::module< T >::initialize ( datatools::properties const config,
datatools::service_manager services,
dpp::module_handle_dict_type  
)
inlineoverridevirtual

Initialize the module.

Constructs an instance of T using its user defined constructor, passing it the module configuration, and services parameters.

Parameters
configParameters passed to configure the module
servicesReference to running service provider

Implements dpp::base_module.

◆ process()

template<typename T >
status falaise::processing::module< T >::process ( datatools::things data)
inlineoverridevirtual

Process the input data.

The data is passed to the process member function of the wrapped type

Parameters
dataReference to the input data
Returns
An enum reflecting the success/failure/other of the processing

Implements dpp::base_module.

◆ reset()

template<typename T >
void falaise::processing::module< T >::reset ( )
inlineoverridevirtual

Change module state to unitialized.

Implements dpp::base_module.


The documentation for this class was generated from the following file: