PythonEntry.h 782 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef PYTHON_PYTHON_ENTRY_H
  2. #define PYTHON_PYTHON_ENTRY_H
  3. #include <boost/noncopyable.hpp>
  4. #include "Base/Marcos.h"
  5. #include "Python/PythonInit.h"
  6. namespace Egametang {
  7. class PythonEntry: private boost::noncopyable
  8. {
  9. private:
  10. PythonInit python_init_;
  11. boost::python::object main_ns_;
  12. boost::unordered_set<std::string> python_paths_;
  13. boost::unordered_set<std::string> python_modules_;
  14. private:
  15. bool PythonEntry::GetExecString(const std::string& main_fun, std::string& exec_string);
  16. public:
  17. PythonEntry();
  18. void ImportPath(std::string& path);
  19. void ImportModule(std::string& module);
  20. template <typename T>
  21. void RegisterObjectPtr(std::string& name, T object_ptr);
  22. void Execute(std::string& main_fun);
  23. };
  24. } // namespace Egametang
  25. #endif // PYTHON_PYTHON_ENTRY_H