-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPluginInterface.h
More file actions
62 lines (42 loc) · 1.43 KB
/
PluginInterface.h
File metadata and controls
62 lines (42 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#pragma once
#include <string>
#include <functional>
#include <memory>
#include <span>
#include <filesystem>
#ifdef BUILD_DLL
#define DLLAPI __declspec(dllexport)
#else
#define DLLAPI
#endif
// This file is shared by Plugin and User
// - Plugin: Only C-Functions to create and release the PluginInterface
// - User: A single function that loads the DLL and returns a pointer to the created PluginInterface. The pointer manages the lifetime of both PluginInterface and loaded DLL.
class PluginInterface
{
public:
virtual ~PluginInterface() {};
virtual const std::string& getName() = 0;
using LinescanDeleter = std::function<void(std::span<unsigned char>*)>;
using LinescanPtr = std::unique_ptr<std::span<unsigned char>, LinescanDeleter>;
virtual LinescanPtr getLinescan() const = 0;
class ExampleClass
{
public:
virtual ~ExampleClass() {};
virtual const std::string& getName() const = 0;
};
using ExampleClassPtr = std::unique_ptr<ExampleClass>;
virtual ExampleClassPtr createExampleClass(std::string_view sName) const = 0;
};
#ifdef BUILD_DLL
extern "C"
{
DLLAPI PluginInterface* createPluginInterface();
DLLAPI void releasePluginInterface(PluginInterface* pPluginInterface);
}
#else
using PluginInterfaceDeleter = std::function<void(PluginInterface*)>;
using PluginInterfacePtr = std::unique_ptr<PluginInterface, PluginInterfaceDeleter>;
PluginInterfacePtr createPluginInterface(const std::filesystem::path& DllPath);
#endif