forked from micro-manager/micro-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PluginManager.h
79 lines (63 loc) · 2.7 KB
/
PluginManager.h
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
75
76
77
78
79
///////////////////////////////////////////////////////////////////////////////
// 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, [email protected], 08/10/2005
#ifndef _PLUGIN_MANAGER_H_
#define _PLUGIN_MANAGER_H_
#include "../MMDevice/DeviceThreads.h"
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <map>
#include <string>
#include <vector>
class LoadedDeviceAdapter;
class CPluginManager /* final */
{
public:
CPluginManager();
~CPluginManager();
void UnloadPluginLibrary(const char* moduleName);
// Device adapter search paths (there are two sets of search paths; see
// CMMCore method documentation)
template <typename TStringIter>
void SetSearchPaths(TStringIter begin, TStringIter end)
{ preferredSearchPaths_.assign(begin, end); }
std::vector<std::string> GetSearchPaths() const { return preferredSearchPaths_; }
std::vector<std::string> GetAvailableDeviceAdapters();
// Legacy search path support
static void AddLegacyFallbackSearchPath(const std::string& path);
static std::vector<std::string> GetModulesInLegacyFallbackSearchPaths();
/**
* Return a device adapter module, loading it if necessary
*/
boost::shared_ptr<LoadedDeviceAdapter>
GetDeviceAdapter(const std::string& moduleName);
boost::shared_ptr<LoadedDeviceAdapter>
GetDeviceAdapter(const char* moduleName);
private:
static std::vector<std::string> GetDefaultSearchPaths();
std::vector<std::string> GetActualSearchPaths() const;
static void GetModules(std::vector<std::string> &modules, const char *path);
std::string FindInSearchPath(std::string filename);
std::vector<std::string> preferredSearchPaths_;
static std::vector<std::string> fallbackSearchPaths_;
std::map< std::string, boost::shared_ptr<LoadedDeviceAdapter> > moduleMap_;
};
#endif //_PLUGIN_MANAGER_H_