Game Develop C++ Platform: CodeExecutionEngine.h Source File

| Game Develop C++ Platform Platform for developing native games based on OpenGL and SFML with Game Develop

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
CodeExecutionEngine.h
Go to the documentation of this file.
1
6 #ifndef CODEEXECUTIONENGINE_H
7 #define CODEEXECUTIONENGINE_H
8 #include "GDCpp/DynamicLibrariesTools.h"
9 #include "GDCpp/RuntimeContext.h"
10 #include <vector>
11 #include <string>
12
27 class GD_API CodeExecutionEngine
28 {
29 public:
30
34 CodeExecutionEngine();
35
39 CodeExecutionEngine(const CodeExecutionEngine & other) : runtimeContext(other.runtimeContext) { Init(other); };
40
44 CodeExecutionEngine& operator=(const CodeExecutionEngine & other) {if( (this) != &other ) Init(other); return *this; }
45
49 virtual ~CodeExecutionEngine();
50
56 void Execute() { ((void(*)(RuntimeContext *))function)(&runtimeContext); };
57
61 bool Ready() const { return loaded; };
62
68 void Unload();
69
78 bool LoadFromDynamicLibrary(const std::string & filename, const std::string & mainFunctionName);
79
80 RuntimeContext runtimeContext;
81
82 private:
83
84 bool loaded;
85 std::string dynamicLibraryFilename;
86 Handle dynamicLibrary;
87 std::string functionName;
88 void * function;
89
90 void Init(const CodeExecutionEngine & other);
91 };
92
93
94 #endif // CODEEXECUTIONENGINE_H
95