Game Develop C++ Platform: CodeExecutionEngine Class Reference

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

- Main Page
- Modules
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Public Member Functions | Public Attributes | List of all members
CodeExecutionEngine Class Reference

Wrapper allowing to load a dynamic library and launch a specific function ( See the full description ). More...

`#include <CodeExecutionEngine.h>`

Collaboration diagram for CodeExecutionEngine:
[legend]

## Public Member Functions

| CodeExecutionEngine ()
| CodeExecutionEngine (const CodeExecutionEngine &other)
CodeExecutionEngine & | operator= (const CodeExecutionEngine &other)
virtual | ~CodeExecutionEngine ()
void | Execute ()
bool | Ready () const
void | Unload ()
bool | LoadFromDynamicLibrary (const std::string &filename, const std::string &mainFunctionName)

## Public Attributes

RuntimeContext | runtimeContext
| The object passed as parameter to the function of the dynamic library.

## Detailed Description

Wrapper allowing to load a dynamic library and launch a specific function ( See the full description ).

RuntimeScene uses this class to launch compiled events. In particular, the signature of the function of the dynamic library must be :

void functionName(RuntimeContext *);

See Also
  CodeCompilationHelpers
  CodeCompiler

## Constructor & Destructor Documentation

CodeExecutionEngine::CodeExecutionEngine | ( | ) |  |

Construct an empty engine.

CodeExecutionEngine::CodeExecutionEngine | ( | const CodeExecutionEngine & | other) |  |

inline

Create an engine from another: The new execution engine will load the same library as the source execution engine.

CodeExecutionEngine::~CodeExecutionEngine | ( | ) |  |

virtual

Destructor: Unload if necessary the dynamic library.

Here is the call graph for this function:

## Member Function Documentation

void CodeExecutionEngine::Execute | ( | ) |  |

inline

Execute the function specified during the call to LoadFromDynamicLibrary

Warning
  Beware, there is no protection against calling Execute on an CodeExecutionEngine that is not ( or badly ) initialized.

bool CodeExecutionEngine::LoadFromDynamicLibrary | ( | const std::string & | filename,
|  | const std::string & | mainFunctionName
| ) |  |

Initialize the engine from a dynamic library, which is kept loaded in memory.

Parameters

  filename | The dynamic library to be loaded
  mainFunctionName | The name of the function to be executed when Execute() is called. The function signature must be void functionName(RuntimeContext *);

Returns
  true if the CodeExecutionEngine is successfully initialized and Execute() can be called.

Here is the call graph for this function:

CodeExecutionEngine& CodeExecutionEngine::operator= | ( | const CodeExecutionEngine & | other) |  |

inline

Create an engine from another: The new execution engine will load the same library as the source execution engine.

bool CodeExecutionEngine::Ready | ( | ) |  | const

inline

Return true if an initialization from a dynamic library has been made successfully and if Execute can be called.

void CodeExecutionEngine::Unload | ( | ) |  |

Unload the dynamic library from memory.

Warning
  Of course, Execute() can not be called after Unload() is called.

The documentation for this class was generated from the following files:

- CodeExecutionEngine.h
- CodeExecutionEngine.cpp