BARE2D
BARE2D::LuaContextManager Class Reference

#include <LuaContextManager.hpp>

+ Collaboration diagram for BARE2D::LuaContextManager:

Public Member Functions

void update ()
 Updates all of the context wrappers, pausing, removing (if finished), or resuming them as is correct. More...
 
void addContext (unsigned int id, LuaScriptContextWrapper *context)
 Adds a context wrapper to the map. More...
 
LuaScriptContextWrappergetContext (unsigned int id)
 Gets a context wrapper from the map. More...
 

Static Public Member Functions

static LuaContextManagergetInstance ()
 
static void destroyInstance ()
 

Private Member Functions

 LuaContextManager ()
 
 ~LuaContextManager ()
 
void removeContext (unsigned int id)
 Removes a context wrapper from the map. More...
 

Private Attributes

std::map< unsigned int, LuaScriptContextWrapper * > m_contexts
 

Static Private Attributes

static LuaContextManagerm_instance = nullptr
 

Detailed Description

Definition at line 14 of file LuaContextManager.hpp.

Constructor & Destructor Documentation

◆ LuaContextManager()

BARE2D::LuaContextManager::LuaContextManager ( )
private

Definition at line 11 of file LuaContextManager.cpp.

Referenced by getInstance().

+ Here is the caller graph for this function:

◆ ~LuaContextManager()

BARE2D::LuaContextManager::~LuaContextManager ( )
private

Definition at line 16 of file LuaContextManager.cpp.

Member Function Documentation

◆ addContext()

void BARE2D::LuaContextManager::addContext ( unsigned int  id,
LuaScriptContextWrapper context 
)

Adds a context wrapper to the map.

Parameters
idThe ID that the ScriptQueue gave the script all those cycles ago
contextThe context to insert in the map.

Definition at line 54 of file LuaContextManager.cpp.

References m_contexts.

Referenced by BARE2D::LuaScriptEngine::update().

+ Here is the caller graph for this function:

◆ destroyInstance()

void BARE2D::LuaContextManager::destroyInstance ( )
static

Definition at line 29 of file LuaContextManager.cpp.

References m_instance.

◆ getContext()

LuaScriptContextWrapper * BARE2D::LuaContextManager::getContext ( unsigned int  id)

Gets a context wrapper from the map.

Parameters
idThe ID of the context, given by the LuaScriptQueue::addScript() call.
Returns
A pointer to the wrapper, and a nullptr if it doesn't exist.

Definition at line 80 of file LuaContextManager.cpp.

References m_contexts.

◆ getInstance()

LuaContextManager * BARE2D::LuaContextManager::getInstance ( )
static

Definition at line 21 of file LuaContextManager.cpp.

References LuaContextManager(), and m_instance.

Referenced by BARE2D::LuaScriptEngine::update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeContext()

void BARE2D::LuaContextManager::removeContext ( unsigned int  id)
private

Removes a context wrapper from the map.

Parameters
idThe ID of the context to remove from the map.

Definition at line 60 of file LuaContextManager.cpp.

References BARE2D::LUA_FAILURE, m_contexts, and BARE2D::throwError().

+ Here is the call graph for this function:

◆ update()

void BARE2D::LuaContextManager::update ( )

Updates all of the context wrappers, pausing, removing (if finished), or resuming them as is correct.

Definition at line 33 of file LuaContextManager.cpp.

References m_contexts.

Referenced by BARE2D::LuaScriptEngine::update().

+ Here is the caller graph for this function:

Field Documentation

◆ m_contexts

std::map<unsigned int, LuaScriptContextWrapper*> BARE2D::LuaContextManager::m_contexts
private

Definition at line 52 of file LuaContextManager.hpp.

Referenced by addContext(), getContext(), removeContext(), and update().

◆ m_instance

LuaContextManager * BARE2D::LuaContextManager::m_instance = nullptr
staticprivate

Definition at line 43 of file LuaContextManager.hpp.

Referenced by destroyInstance(), and getInstance().


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