MaCh3  2.6.1
Reference Guide
Classes | Namespaces | Macros | Typedefs
plugin.hpp File Reference

Plugin interface and registration macros for MaCh3. More...

#include <memory>
#include "CLI/API/m3argparse.hpp"
Include dependency graph for plugin.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  M3::IPlugin
 Interface for MaCh3 plugins and modules. More...
 
class  M3::PluginBase
 

Namespaces

 M3
 Main namespace for MaCh3 software.
 

Macros

#define MACH3_REGISTER_PLUGIN(PluginClass)
 Macro to register a plugin class with MaCh3. More...
 

Typedefs

typedef IPlugin M3::IModule
 Alias for IPlugin, used for core modules. More...
 
typedef PluginBase M3::IModuleBase
 Alias for IPluginBase, used for core modules. More...
 
typedef M3::IPlugin *(* create_plugin_t) ()
 Function pointer type for plugin factory function. More...
 
typedef void(* destroy_plugin_t) (M3::IPlugin *)
 Function pointer type for plugin destructor function. More...
 

Detailed Description

Plugin interface and registration macros for MaCh3.

Definition in file plugin.hpp.

Macro Definition Documentation

◆ MACH3_REGISTER_PLUGIN

#define MACH3_REGISTER_PLUGIN (   PluginClass)
Value:
static_assert(std::is_base_of<M3::IPlugin, PluginClass>::value, "PluginClass must derive from M3::IPlugin"); \
extern "C" M3::IPlugin* create_plugin() { \
return new PluginClass(); \
} \
extern "C" void destroy_plugin(M3::IPlugin* p) { \
delete p; \
}
Interface for MaCh3 plugins and modules.
Definition: plugin.hpp:16

Macro to register a plugin class with MaCh3.

This macro generates the required factory and destructor functions for a plugin class. Use it in your plugin implementation file.

Parameters
PluginClassThe plugin class that implements M3::IPlugin

Example usage:

class MyPlugin : public M3::IPlugin {
// ... implementation
};
#define MACH3_REGISTER_PLUGIN(PluginClass)
Macro to register a plugin class with MaCh3.
Definition: plugin.hpp:80

Definition at line 80 of file plugin.hpp.

Typedef Documentation

◆ create_plugin_t

create_plugin_t

Function pointer type for plugin factory function.

Definition at line 58 of file plugin.hpp.

◆ destroy_plugin_t

destroy_plugin_t

Function pointer type for plugin destructor function.

Definition at line 62 of file plugin.hpp.