fourdst_plugin 0.0.1a
C++ Plugin Manager
Loading...
Searching...
No Matches
fourdst::plugin::templates::FunctorPlugin_T< T > Class Template Referenceabstract

Template base class for functor-style plugins. More...

#include <functor.h>

Inheritance diagram for fourdst::plugin::templates::FunctorPlugin_T< T >:
fourdst::plugin::PluginBase fourdst::plugin::IPluginBase fourdst::plugin::IPlugin

Public Member Functions

virtual T operator() (const T &input) const =0
 Function call operator for processing input data.
 
- Public Member Functions inherited from fourdst::plugin::PluginBase
 IPluginBase (const char *plugin_name, const char *plugin_version)
 
- Public Member Functions inherited from fourdst::plugin::IPluginBase
 IPluginBase (const char *plugin_name, const char *plugin_version)
 
const char * get_name () const override
 Get the plugin name from the global variable.
 
const char * get_version () const override
 Get the plugin version from the global variable.
 
- Public Member Functions inherited from fourdst::plugin::IPlugin
virtual ~IPlugin ()=default
 Virtual destructor to ensure proper cleanup of derived classes.
 

Detailed Description

template<typename T>
class fourdst::plugin::templates::FunctorPlugin_T< T >

Template base class for functor-style plugins.

This template provides a convenient base class for plugins that implement functor-like behavior - they take an input of type T and return an output of the same type T. This is particularly useful for data processing, filtering, or transformation plugins.

The template inherits from PluginBase to automatically provide plugin identification functionality while adding the functor interface.

Template Parameters
TThe type of data that this functor plugin processes. Must be copyable and should typically be movable for performance.
Note
Implementations should ensure the operator() is thread-safe if the plugin may be used concurrently
The input parameter is passed by const reference to avoid unnecessary copying, while the return is by value to ensure proper ownership

Example usage:

class DoublePlugin : public FunctorPlugin_T<int> {
public:
int operator()(const int& input) const override {
return input * 2;
}
};
Template base class for functor-style plugins.
Definition functor.h:45
virtual T operator()(const T &input) const =0
Function call operator for processing input data.

Member Function Documentation

◆ operator()()

template<typename T>
virtual T fourdst::plugin::templates::FunctorPlugin_T< T >::operator() ( const T & input) const
pure virtual

Function call operator for processing input data.

This pure virtual method must be implemented by derived classes to define the specific transformation or processing logic. The method takes input data and returns processed output of the same type.

Parameters
inputThe input data to process, passed by const reference to avoid unnecessary copying
Returns
T The processed output data. The type is the same as the input to maintain type consistency in the functor interface
Exceptions
Implementation-dependent.Derived classes should document any exceptions they may throw during processing.
Note
Implementations should be const-correct since this method is const
Consider noexcept specification in derived classes if the operation cannot throw exceptions
For expensive-to-copy types, consider returning by move when possible

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