正在显示
1 个修改的文件
包含
62 行增加
和
0 行删除
src/server/python/dmppythonutils.h
0 → 100644
1 | +/************************************************************************** | |
2 | +* file: dmppythonutils.h | |
3 | + | |
4 | +* Author: wanzhongping | |
5 | +* Date: 2021-02-20 16:20:53 | |
6 | +* Email: zhongpingw@chinadci.com | |
7 | +* copyright: 广州城市信息研究所有限公司 | |
8 | +***************************************************************************/ | |
9 | + | |
10 | +#ifndef __dmppythonutils_h__ | |
11 | +#define __dmppythonutils_h__ | |
12 | + | |
13 | +#define BOOST_BIND_GLOBAL_PLACEHOLDERS | |
14 | +#include <boost/python.hpp> | |
15 | +#include "dmpconfig.h" | |
16 | +#include <boost/dll/shared_library.hpp> | |
17 | +#include "dmap_server.h" | |
18 | +#include "../dmpserverinterface.h" | |
19 | +#include <string> | |
20 | +#include <vector> | |
21 | + | |
22 | +class SERVER_EXPORT DmpPythonUtils | |
23 | +{ | |
24 | + public: | |
25 | + DmpPythonUtils(); | |
26 | + ~DmpPythonUtils(); | |
27 | + | |
28 | + void InitServerPython( DmpServerInterface *iface ); | |
29 | + bool StartServerPlugin( std::string package_name ); | |
30 | + void ExitPython(); | |
31 | + bool LoadPlugin(const std::string &package_name); | |
32 | + std::vector<std::string> PluginList(); | |
33 | + bool RunString(const std::string &command, bool single = true); | |
34 | + bool EvalString(const std::string &command, std::string &result); | |
35 | + std::string GetPluginMetadata(const std::string &pluginName, const std::string &function); | |
36 | + | |
37 | + bool IsEnabled(); | |
38 | + | |
39 | + std::vector<std::string> ExtraPluginsPaths() const; | |
40 | + std::string PythonPath() const; | |
41 | + std::string PluginsPath() const; | |
42 | + std::string HomePythonPath() const; | |
43 | + std::string HomePluginsPath() const; | |
44 | + | |
45 | +protected: | |
46 | + void Init(); | |
47 | + bool CheckSystemImports(); | |
48 | + void UninstallErrorHook(); | |
49 | + | |
50 | + boost::python::object main_module_; | |
51 | + boost::python::object main_namespace_; | |
52 | + | |
53 | + bool python_enabled_ = false; | |
54 | + | |
55 | + //! cleanup Python context | |
56 | + void Finish(); | |
57 | + | |
58 | +private: | |
59 | + bool error_hook_installed_ = false; | |
60 | + | |
61 | +}; | |
62 | +#endif //__dmppythonutils_h__ | ... | ... |
请
注册
或
登录
后发表评论