satdump/src-core/core/plugin.h

39 lines
1.1 KiB
C
Raw Permalink Normal View History

#pragma once
#include "dll_export.h"
#include <memory>
#include <map>
2025-01-03 12:05:46 -05:00
2025-05-26 19:42:16 +01:00
#include "utils/event_bus.h"
2025-05-26 19:21:10 +01:00
#include "utils/task_scheduler.h"
#define PLUGIN_LOADER(constructor) \
extern "C" \
{ \
satdump::Plugin *loader() \
{ \
return (satdump::Plugin *)new constructor(); \
} \
}
namespace satdump
{
struct SatDumpStartedEvent
{
};
class Plugin
{
public:
Plugin() {}
virtual std::string getID() = 0;
virtual void init() = 0;
virtual ~Plugin(){};
};
SATDUMP_DLL extern std::map<std::string, std::shared_ptr<satdump::Plugin>> loaded_plugins;
2022-05-13 23:40:35 +02:00
SATDUMP_DLL extern std::shared_ptr<EventBus> eventBus;
2025-01-03 12:05:46 -05:00
SATDUMP_DLL extern std::shared_ptr<TaskScheduler> taskScheduler;
}; // namespace satdump
2022-05-12 18:19:01 +02:00
void loadPlugins(std::map<std::string, std::shared_ptr<satdump::Plugin>> &loaded_plugins = satdump::loaded_plugins);