allpix::FilterDelegate
Module: Delegate classes
Delegate for filtering messages using a function. More…
#include <delegates.h>
Inherits from allpix::ModuleDelegate< T >, allpix::BaseDelegate
Public Types
Name | |
---|---|
using bool(T::*)(const std::shared_ptr< R > &) const | FilterFunction |
Public Functions
Name | |
---|---|
FilterDelegate(MsgFlags flags, T * obj, FilterFunction filter) Construct a function delegate for the given module. |
|
virtual void | process(std::shared_ptr< BaseMessage > msg, std::string , DelegateTypes & dest) override Calls the filter function with the supplied message. |
Additional inherited members
Public Functions inherited from allpix::ModuleDelegate< T >
Name | |
---|---|
ModuleDelegate(MsgFlags flags, T * obj) Construct a module delegate for the given module. |
|
virtual std::string | getUniqueName() override Get the unique name of the bound module. |
virtual std::shared_ptr< Detector > | getDetector() const override Get the detector bound to this module. |
Protected Attributes inherited from allpix::ModuleDelegate< T >
Name | |
---|---|
T *const | obj_ |
Public Functions inherited from allpix::BaseDelegate
Name | |
---|---|
BaseDelegate(const BaseDelegate & ) =delete Copying a delegate is not allowed. |
|
BaseDelegate & | operator=(const BaseDelegate & ) =delete Copying a delegate is not allowed. |
BaseDelegate(BaseDelegate && ) =default Enable default move behaviour. |
|
BaseDelegate & | operator=(BaseDelegate && ) =default Enable default move behaviour. |
BaseDelegate(MsgFlags flags) Construct a delegate with the supplied flags. |
|
virtual | ~BaseDelegate() =default Essential virtual destructor. |
bool | isRequired() const Check if delegate has a required message. |
MsgFlags | getFlags() const Get the flags for this delegate. |
virtual std::shared_ptr< Detector > | getDetector() const =0 Get the detector bound to a delegate. |
virtual std::string | getUniqueName() =0 Get the unique identifier for the bound object. |
Protected Attributes inherited from allpix::BaseDelegate
Name | |
---|---|
MsgFlags | flags_ |
Detailed Description
template <typename T ,
typename R >
class allpix::FilterDelegate;
Delegate for filtering messages using a function.
Public Types Documentation
using FilterFunction
using allpix::FilterDelegate< T, R >::FilterFunction = bool (T::*)(const std::shared_ptr<R>&) const;
Public Functions Documentation
function FilterDelegate
inline FilterDelegate(
MsgFlags flags,
T * obj,
FilterFunction filter
)
Construct a function delegate for the given module.
Parameters:
- flags Messenger flags
- obj Module object this delegate should operate on
- filter A filter function receiving a shared_ptr to the message and its name, returning a boolean indicating the filter decision
function process
inline virtual void process(
std::shared_ptr< BaseMessage > msg,
std::string ,
DelegateTypes & dest
) override
Calls the filter function with the supplied message.
Parameters:
- msg Message to process
- dest Destination of the message
Warning: The filter function is called directly from the delegate, no heavy processing should be done in the filter function
Reimplements: allpix::BaseDelegate::process
Updated on 2024-12-13 at 08:31:37 +0000