BARE2D
BARE2D::LuaScriptQueue Class Reference

#include <LuaScriptQueue.hpp>

+ Collaboration diagram for BARE2D::LuaScriptQueue:

Public Member Functions

unsigned int addLuaScript (LuaScript &script)
 Adds a script to the queue to be run. More...
 
unsigned int addLuaScript (std::string script)
 Adds a script to the queue to be run by its source code. More...
 
std::map< unsigned int, LuaScript * > & getQueue ()
 Returns the queue of scripts to activate. More...
 
void clearQueue ()
 Clears the stored script queue - for regular use by tbe Script Engine. Deallocates memory that was in use in the m_scripts map. More...
 

Static Public Member Functions

static LuaScriptQueuegetInstance ()
 Returns a pointer to the singleton object - creates the object if one doesn't already exist. More...
 
static void destroyInstance ()
 Destroys the singleton. More...
 

Private Member Functions

 LuaScriptQueue ()
 
 ~LuaScriptQueue ()
 

Private Attributes

std::map< unsigned int, LuaScript * > m_scripts
 
unsigned int m_lastUUID = -1
 

Static Private Attributes

static LuaScriptQueuem_instance = nullptr
 

Detailed Description

Definition at line 15 of file LuaScriptQueue.hpp.

Constructor & Destructor Documentation

◆ LuaScriptQueue()

BARE2D::LuaScriptQueue::LuaScriptQueue ( )
private

Definition at line 9 of file LuaScriptQueue.cpp.

Referenced by getInstance().

+ Here is the caller graph for this function:

◆ ~LuaScriptQueue()

BARE2D::LuaScriptQueue::~LuaScriptQueue ( )
private

Definition at line 14 of file LuaScriptQueue.cpp.

Member Function Documentation

◆ addLuaScript() [1/2]

unsigned int BARE2D::LuaScriptQueue::addLuaScript ( LuaScript script)

Adds a script to the queue to be run.

Parameters
scriptA reference to the LuaScript to add to the queue.
Returns
An unsigned int which represents the UUID of the script added. This UUID will persist throughout all of the pipeline.

Definition at line 31 of file LuaScriptQueue.cpp.

References m_lastUUID, and m_scripts.

Referenced by addLuaScript().

+ Here is the caller graph for this function:

◆ addLuaScript() [2/2]

unsigned int BARE2D::LuaScriptQueue::addLuaScript ( std::string  script)

Adds a script to the queue to be run by its source code.

Parameters
scriptThe code to run.
Returns
An unsigned int which represents the UUID of the script added. This UUID will persist throughout all of the pipeline

Definition at line 42 of file LuaScriptQueue.cpp.

References addLuaScript(), BARE2D::LuaScript::inited, and BARE2D::LuaScript::m_script.

+ Here is the call graph for this function:

◆ clearQueue()

void BARE2D::LuaScriptQueue::clearQueue ( )

Clears the stored script queue - for regular use by tbe Script Engine. Deallocates memory that was in use in the m_scripts map.

Definition at line 56 of file LuaScriptQueue.cpp.

References m_scripts.

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

+ Here is the caller graph for this function:

◆ destroyInstance()

void BARE2D::LuaScriptQueue::destroyInstance ( )
static

Destroys the singleton.

Definition at line 27 of file LuaScriptQueue.cpp.

References m_instance.

◆ getInstance()

LuaScriptQueue * BARE2D::LuaScriptQueue::getInstance ( )
static

Returns a pointer to the singleton object - creates the object if one doesn't already exist.

Returns
A pointer to the LuaScriptQueue.

Definition at line 19 of file LuaScriptQueue.cpp.

References LuaScriptQueue(), and m_instance.

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

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

◆ getQueue()

std::map< unsigned int, LuaScript * > & BARE2D::LuaScriptQueue::getQueue ( )

Returns the queue of scripts to activate.

Returns
A reference to m_scripts.

Definition at line 51 of file LuaScriptQueue.cpp.

References m_scripts.

Field Documentation

◆ m_instance

LuaScriptQueue * BARE2D::LuaScriptQueue::m_instance = nullptr
staticprivate

Definition at line 58 of file LuaScriptQueue.hpp.

Referenced by destroyInstance(), and getInstance().

◆ m_lastUUID

unsigned int BARE2D::LuaScriptQueue::m_lastUUID = -1
private

Definition at line 64 of file LuaScriptQueue.hpp.

Referenced by addLuaScript().

◆ m_scripts

std::map<unsigned int, LuaScript*> BARE2D::LuaScriptQueue::m_scripts
private

Definition at line 61 of file LuaScriptQueue.hpp.

Referenced by addLuaScript(), clearQueue(), and getQueue().


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