In order to reduce the coupling of lua script engine and native c++ engine. More...
#include <LuaScriptHandlerMgr.h>
Public Member Functions | |
ScriptHandlerMgr (void) | |
! More... | |
virtual | ~ScriptHandlerMgr (void) |
Destructor. More... | |
var | ~ScriptHandlerMgr () |
Destructor. More... | |
void | addObjectHandler (void *object, int handler, ScriptHandlerMgr::HandlerType handlerType) |
Construct or update the mapping relationship among c++ Ref object ,HandlerType and the refrence index corresponding to the pointer of Lua function. More... | |
void | removeObjectHandler (void *object, ScriptHandlerMgr::HandlerType handlerType) |
By the handlerType and object, find the correct refrence index corresponding to the pointer of Lua function. More... | |
int | getObjectHandler (void *object, ScriptHandlerMgr::HandlerType handlerType) |
By the handlerType and object, find the correct refrence index corresponding to the pointer of Lua function. More... | |
void | removeObjectAllHandlers (void *object) |
Remove the all relationship among the object, HandlerType and the refrence index corresponding to the pointer of Lua function. More... | |
ScriptHandlerMgr::HandlerType | addCustomHandler (void *object, int handler) |
Add customizable relationship among c++ Ref object, HandlerType and the refrence index corresponding to the pointer of Lua function. More... | |
local | addCustomHandler ( local object, local handler) |
Add customizable relationship among c++ Ref object, HandlerType and the refrence index corresponding to the pointer of Lua function. More... | |
Static Public Member Functions | |
static ScriptHandlerMgr * | getInstance (void) |
Get the instance of the ScriptHandlerMgr. More... | |
local | getInstance () |
Get the instance of the ScriptHandlerMgr. More... | |
static void | destroyInstance (void) |
Destroy the instance of the ScriptHandlerMgr. More... | |
var | destroyInstance () |
Destroy the instance of the ScriptHandlerMgr. More... | |
local | destroyInstance () |
Destroy the instance of the ScriptHandlerMgr. More... | |
In order to reduce the coupling of lua script engine and native c++ engine.
In the current mechanism, for the class derived frome the Ref, we constuct a mapping relationship among c++ Ref object ,HandlerType and the refrence index corresponding to the pointer of Lua function.Then, using the ScriptHandlerMgr to manager uniformly. By this mechanism,when native c++ Ref object wants to call the Lua function, we didn't insert the processing code in the native c++ class.
|
strong |
HandlerType enum.
This enum class represent the processing type for c++ call the Lua function.
|
strong |
HandlerType enum.
This enum class represent the processing type for c++ call the Lua function.
|
strong |
HandlerType enum.
This enum class represent the processing type for c++ call the Lua function.
ScriptHandlerMgr | ( | void | ) |
!
Default constructor.
var ScriptHandlerMgr | ( | ) |
!
Default constructor.
|
virtual |
Destructor.
|
virtual |
Destructor.
ScriptHandlerMgr::HandlerType addCustomHandler |
( | void * | object, |
int | handler | ||
) |
Add customizable relationship among c++ Ref object, HandlerType and the refrence index corresponding to the pointer of Lua function.
In the customizable relationship, we don't pass the HandlerType, it will obtain the HandlerType by auto-increasing. The HandlerTypes used to customizable relationship are between EVENT_CUSTOM_BEGAN(10000) and EVENT_CUSTOM_ENDED(11000). If the HandlerType increased more than 12,it would trigger assert.
object | the Ref object. |
handler | a refrence index corresponding to the pointer of Lua function. |
var addCustomHandler | ( | var | object, |
var | handler | ||
) |
Add customizable relationship among c++ Ref object, HandlerType and the refrence index corresponding to the pointer of Lua function.
In the customizable relationship, we don't pass the HandlerType, it will obtain the HandlerType by auto-increasing. The HandlerTypes used to customizable relationship are between EVENT_CUSTOM_BEGAN(10000) and EVENT_CUSTOM_ENDED(11000). If the HandlerType increased more than 12,it would trigger assert.
object | the Ref object. |
handler | a refrence index corresponding to the pointer of Lua function. |
local addCustomHandler | ( | local | object, |
local | handler | ||
) |
Add customizable relationship among c++ Ref object, HandlerType and the refrence index corresponding to the pointer of Lua function.
In the customizable relationship, we don't pass the HandlerType, it will obtain the HandlerType by auto-increasing. The HandlerTypes used to customizable relationship are between EVENT_CUSTOM_BEGAN(10000) and EVENT_CUSTOM_ENDED(11000). If the HandlerType increased more than 12,it would trigger assert.
object | the Ref object. |
handler | a refrence index corresponding to the pointer of Lua function. |
void addObjectHandler | ( | void * | object, |
int | handler, | ||
ScriptHandlerMgr::HandlerType | handlerType | ||
) |
Construct or update the mapping relationship among c++ Ref object ,HandlerType and the refrence index corresponding to the pointer of Lua function.
object | a Ref object. |
handler | a refrence index corresponding to the pointer of Lua function. |
handlerType | ScriptHandlerMgr::HandlerType. |
var addObjectHandler | ( | var | object, |
var | handler, | ||
var | handlerType | ||
) |
Construct or update the mapping relationship among c++ Ref object ,HandlerType and the refrence index corresponding to the pointer of Lua function.
object | a Ref object. |
handler | a refrence index corresponding to the pointer of Lua function. |
handlerType | ScriptHandlerMgr::HandlerType. |
local addObjectHandler | ( | local | object, |
local | handler, | ||
local | handlerType | ||
) |
Construct or update the mapping relationship among c++ Ref object ,HandlerType and the refrence index corresponding to the pointer of Lua function.
object | a Ref object. |
handler | a refrence index corresponding to the pointer of Lua function. |
handlerType | ScriptHandlerMgr::HandlerType. |
|
static |
Destroy the instance of the ScriptHandlerMgr.
|
static |
Destroy the instance of the ScriptHandlerMgr.
|
static |
Destroy the instance of the ScriptHandlerMgr.
|
static |
Get the instance of the ScriptHandlerMgr.
|
static |
Get the instance of the ScriptHandlerMgr.
|
static |
Get the instance of the ScriptHandlerMgr.
int getObjectHandler | ( | void * | object, |
ScriptHandlerMgr::HandlerType | handlerType | ||
) |
By the handlerType and object, find the correct refrence index corresponding to the pointer of Lua function.
object | a Ref object. |
handlerType | ScriptHandlerMgr::HandlerType. |
var getObjectHandler | ( | var | object, |
var | handlerType | ||
) |
By the handlerType and object, find the correct refrence index corresponding to the pointer of Lua function.
object | a Ref object. |
handlerType | ScriptHandlerMgr::HandlerType. |
local getObjectHandler | ( | local | object, |
local | handlerType | ||
) |
By the handlerType and object, find the correct refrence index corresponding to the pointer of Lua function.
object | a Ref object. |
handlerType | ScriptHandlerMgr::HandlerType. |
void removeObjectAllHandlers | ( | void * | object | ) |
Remove the all relationship among the object, HandlerType and the refrence index corresponding to the pointer of Lua function.
Meanwhile, remove the refrence of Lua function corresponding to the indexs the object has in the 'toluafix_refid_function_mapping' table.
object | the Ref object. |
var removeObjectAllHandlers | ( | var | object | ) |
Remove the all relationship among the object, HandlerType and the refrence index corresponding to the pointer of Lua function.
Meanwhile, remove the refrence of Lua function corresponding to the indexs the object has in the 'toluafix_refid_function_mapping' table.
object | the Ref object. |
local removeObjectAllHandlers | ( | local | object | ) |
Remove the all relationship among the object, HandlerType and the refrence index corresponding to the pointer of Lua function.
Meanwhile, remove the refrence of Lua function corresponding to the indexs the object has in the 'toluafix_refid_function_mapping' table.
object | the Ref object. |
void removeObjectHandler | ( | void * | object, |
ScriptHandlerMgr::HandlerType | handlerType | ||
) |
By the handlerType and object, find the correct refrence index corresponding to the pointer of Lua function.
If found, remove the refrence of Lua function corresponding to this index in the 'toluafix_refid_function_mapping' table.
object | a Ref object. |
handlerType | ScriptHandlerMgr::HandlerType. |
var removeObjectHandler | ( | var | object, |
var | handlerType | ||
) |
By the handlerType and object, find the correct refrence index corresponding to the pointer of Lua function.
If found, remove the refrence of Lua function corresponding to this index in the 'toluafix_refid_function_mapping' table.
object | a Ref object. |
handlerType | ScriptHandlerMgr::HandlerType. |
local removeObjectHandler | ( | local | object, |
local | handlerType | ||
) |
By the handlerType and object, find the correct refrence index corresponding to the pointer of Lua function.
If found, remove the refrence of Lua function corresponding to this index in the 'toluafix_refid_function_mapping' table.
object | a Ref object. |
handlerType | ScriptHandlerMgr::HandlerType. |