-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPluginManager.h
More file actions
74 lines (59 loc) · 2.34 KB
/
PluginManager.h
File metadata and controls
74 lines (59 loc) · 2.34 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
63
64
65
66
67
68
69
70
71
72
73
74
///////////////////////////////////////////////////////////////////////////////
// FILE: PluginManager.h
// PROJECT: Micro-Manager
// SUBSYSTEM: MMCore
//-----------------------------------------------------------------------------
// DESCRIPTION: Loading/unloading of device adapter modules
//
// COPYRIGHT: University of California, San Francisco, 2006-2014
//
// LICENSE: This file is distributed under the "Lesser GPL" (LGPL) license.
// License text is included with the source distribution.
//
// This file is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES.
//
// AUTHOR: Nenad Amodaj, nenad@amodaj.com, 08/10/2005
#pragma once
#include "MockDeviceAdapter.h"
#include <map>
#include <memory>
#include <string>
#include <vector>
namespace mmcore {
namespace internal {
class LoadedDeviceAdapter;
class CPluginManager /* final */
{
public:
CPluginManager();
~CPluginManager();
void UnloadPluginLibrary(const char* moduleName);
// Device adapter search paths
template <typename TStringIter>
void SetSearchPaths(TStringIter begin, TStringIter end)
{ searchPaths_.assign(begin, end); }
std::vector<std::string> GetSearchPaths() const { return searchPaths_; }
std::vector<std::string> GetAvailableDeviceAdapters();
/**
* Return a device adapter module, loading it if necessary
*/
std::shared_ptr<LoadedDeviceAdapter>
GetDeviceAdapter(const std::string& moduleName);
std::shared_ptr<LoadedDeviceAdapter>
GetDeviceAdapter(const char* moduleName);
void LoadMockAdapter(const std::string& name, MockDeviceAdapter* impl);
private:
static std::vector<std::string> GetDefaultSearchPaths();
static void GetModules(std::vector<std::string> &modules, const char *path);
std::string FindInSearchPath(std::string filename);
std::vector<std::string> searchPaths_;
std::map< std::string, std::shared_ptr<LoadedDeviceAdapter> > moduleMap_;
};
} // namespace internal
} // namespace mmcore