Exposing Abstract Interface with luabind ?
Nicolas Goles <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
Hello!,
I'm want to expose an abstract interface with Luabind.
*//Interface*
class IAbstract
{
public:
virtual ~IAbstract() {}
virtual void method1(void) = 0;
virtual void method2(void) = 0;
};
*//Implementation A*
class A : public IAbstract
{
virtual void method1(void)
{
/ //Do some stuff/
}
virtual void method2(void)
{
///Do other stuff/
}
};
*//Implementation B*
class B : public IAbstract
{
virtual void method1(void)
{
///Do some stuff*/
}
virtual void method2(void)
{
/ //Do other stuff*/
}
};
What's the best way to expose this IAbstract using luabind ( I'm not
sure if I can expose abstract classes ) , in my code I have a
manager/factory which returns a pointer to an /IAbstract , /under the
hood it instantiates class A or B, and the idea is of course to only use
IAbstract methods to interact with class A or B.
So to the question,
Is there a way to only expose the IAbstract (abstract class) so that in
Lua I could do:
-- Lua code
abstract = manager:returnIAbstractReference()
abstract:method1()
abstract:method2()
Or I will have to expose /ImplementationA, ImplementationB ... etc /?
Thanks!
--
Nicolas Goles Domic
Founder & Lead Engineer
Gando Games <www.gandogames.com>
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user