IOFormat 1.12.0
Loading...
Searching...
No Matches
Plugin.h
1#pragma once
2
3#include <string>
4#include <unordered_map>
5#include <unordered_set>
6
7#include <iolink/Logger.h>
8
9#include <ioformat/plugin/PluginVersion.h>
10
11namespace ioformat
12{
13
20class Plugin
21{
22public:
23 using StringSet = std::unordered_set<std::string>;
24 using StringMap = std::unordered_map<std::string, std::string>;
25
26 virtual ~Plugin() = default;
27
34 virtual inline uint64_t api() const = 0;
35
39 virtual const std::string& name() const = 0;
40
44 virtual const PluginVersion& version() const = 0;
45
49 virtual void initLog(iolink::LogLevel level) = 0;
50};
51
52#if defined(_WIN32)
53# define IOFORMAT_PLUGIN_API __declspec(dllexport)
54#else
55# define IOFORMAT_PLUGIN_API __attribute__((visibility("default")))
56#endif
57
64#define IOFORMAT_DECLARE_PLUGIN(PLUGIN_CLASS, PLUGIN_SYMBOL) \
65 extern "C" IOFORMAT_PLUGIN_API PLUGIN_CLASS PLUGIN_SYMBOL; \
66 PLUGIN_CLASS PLUGIN_SYMBOL;
67
68} // namespace ioformat
Base class for all plugins.
Definition Plugin.h:21
virtual void initLog(iolink::LogLevel level)=0
Initialize the plugin's logger.
virtual const std::string & name() const =0
Get the name of the plugin.
virtual uint64_t api() const =0
Get the API version of the plugin.
virtual const PluginVersion & version() const =0
Get the version of the plugin.
Global namespace which contains all methods to encode/decode data from/into different resources (file...
Definition Error.h:6
Hold information about a plugin's version.
Definition PluginVersion.h:15