VR-Forces 4.2 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
include
vrfmodel
bindableLuaComponent.h
Go to the documentation of this file.
1
/*******************************************************************************
2
** Copyright (c) 2013 MAK Technologies, Inc.
3
** All rights reserved.
4
*******************************************************************************/
5
8
10
11
#pragma once
12
13
#include "
vrfmodel/vrfmodelDefines.h
"
14
#include "
vrfLua/luaScriptInterfaceImpl.h
"
15
#include <luabind/detail/make_instance.hpp>
16
#include <luabind/detail/class_rep.hpp>
17
18
class
DtBindableLuaComponentExtension
;
19
21
class
DT_DLL_vrfmodel
DtBindableLuaComponentInterface
22
{
23
public
:
26
DtBindableLuaComponentInterface
(
const
DtVrfObject
* entity,
const
DtString
& componentName,
const
DtString
& componentType);
27
29
virtual
~
DtBindableLuaComponentInterface
();
30
32
virtual
void
bindLuaFunctions(lua_State*) = 0;
33
35
virtual
void
bindLuaGlobals(lua_State*) = 0;
36
38
virtual
void
bind(
DtVrfObject
*,
const
DtString
& scriptId, lua_State*);
39
41
virtual
DtString
bindableName(
const
DtString
&)
const
;
42
43
protected
:
44
virtual
bool
shouldBind(lua_State*)
const
= 0;
45
46
protected
:
47
const
DtVrfObject
*
myBoundEntity
;
48
lua_State*
myBoundForState
;
49
DtString
myType
;
50
};
51
52
template
<
typename
T>
53
class
DtBindableLuaComponent
:
public
DtBindableLuaComponentInterface
54
{
55
public
:
56
DtBindableLuaComponent
(
const
DtVrfObject
* entity,
57
const
DtString
& componentName,
const
DtString
& componentType) :
DtBindableLuaComponentInterface
(entity, componentName, componentType)
58
{
59
}
60
61
virtual
~DtBindableLuaComponent
()
62
{
63
}
64
65
bool
shouldBind
(lua_State* L)
const
66
{
67
std::pair<luabind::detail::class_id, void*> dynamic = luabind::detail::get_dynamic_class(L,
68
luabind::get_pointer(dynamic_cast<const T*>(
this
)));
69
70
luabind::detail::class_rep* cls = luabind::detail::get_pointee_class(L, dynamic_cast<const T*>(
this
), dynamic.first);
71
72
return
(cls == 0);
73
}
74
};
75
78
class
DT_DLL_vrfmodel
DtBindableLuaComponentExtension
:
public
DtLuaScriptInterfaceExtension
79
{
80
public
:
82
DtBindableLuaComponentExtension
(
DtBindableLuaComponentInterface
*);
83
85
virtual
~
DtBindableLuaComponentExtension
();
86
89
static
DtLuaScriptInterfaceExtension
* create(
void
* usr);
90
91
protected
:
95
virtual
void
bindLuaFunctions
(
DtVrfObject
* entity,
const
DtString
& scriptId,
96
lua_State* L);
97
98
protected
:
99
DtBindableLuaComponentInterface
*
myExtension
;
100
};
Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (
www.mak.com
)