PythonInit.h 399 B

123456789101112131415161718192021222324252627282930
  1. #ifndef PYTHON_PYTHON_INIT_H
  2. #define PYTHON_PYTHON_INIT_H
  3. #include <boost/noncopyable.hpp>
  4. #include <boost/python.hpp>
  5. namespace Egametang {
  6. class PythonInit: private boost::noncopyable
  7. {
  8. public:
  9. PythonInit()
  10. {
  11. Py_InitializeEx(0);
  12. }
  13. ~PythonInit()
  14. {
  15. Py_Finalize();
  16. }
  17. bool IsInitialized()
  18. {
  19. return Py_IsInitialized();
  20. }
  21. };
  22. } // namespace Egametang
  23. #endif // PYTHON_PYTHON_INIT_H