Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualHodgman

Posted 09 August 2012 - 03:19 AM

I'm working on a similar system, so I hope it's feasible Posted Image

I manually reflect on my bindable classes like:
class Test1
{
public:
    eiBind(Test1);
    int DoStuff() { return 0; }
private:
    int m_stuff;
};
eiBindClass( Test1 )
  eiBeginMethods()
    eiBindMethod( DoStuff )
  eiEndMethods()
  eiBeginData()
    eiBindData( m_stuff )
  eiEndData()
eiEndBind();
And then to bind it to a specific scripting VM, I can fetch the above info with
const TypeBinding& b = ReflectTest1();
Which gives me structures like
typedef void (FnTask)( void* obj, void* args, uint argSize );
struct DataBinding
{
    const char* name;
    memptr memvar;
    uint offset, size;
    Type type;
};
struct MethodBinding
{
    const char* name;
    FnTask* task;
    const DataBinding* args;
    uint argCount;
};
struct TypeBinding
{
    const DataBinding* data;
    uint dataCount;
    const MethodBinding* method;
    uint methodCount;
};

#3Hodgman

Posted 09 August 2012 - 03:18 AM

I'm working on a similar system, so I hope it's feasible Posted Image

I manually reflect on my bindable classes like:
class Test1
{
public:
	eiBind(Test1);
	int DoStuff() { return 0; }
private:
	int m_stuff;
};

eiBindClass( Test1 )
  eiBeginMethods()
	eiBindMethod( DoStuff )
  eiEndMethods()
  eiBeginData()
	eiBindData( m_stuff )
  eiEndData()
eiEndBind();
And then to bind it to a specific scripting VM, I can fetch the above info with
const TypeBinding& b = ReflectTest1();
Which gives me structures like
typedef void (FnTask)( void* obj, void* args, uint argSize );
struct DataBinding
{
	const char* name;
	memptr memvar;
	uint offset, size;
	Type type;
};
struct MethodBinding
{
	const char* name;
	FnTask* task;
    const DataBinding* args;
    uint argCount;
};
struct TypeBinding
{
	const DataBinding* data;
	uint dataCount;
	const MethodBinding* method;
	uint methodCount;
};

#2Hodgman

Posted 09 August 2012 - 03:17 AM

I'm working on a similar system, so I hope it's feasible Posted Image

I manually reflect on my bindable classes like:
class Test1
{
public:
    eiBind(Test1);
    int DoStuff() { return 0; }
private:
    int m_stuff;
};

eiBindClass( Test1 )
  eiBeginMethods()
    eiBindMethod( DoStuff )
  eiEndMethods()
  eiBeginData()
    eiBindData( m_stuff )
  eiEndData()
eiEndBind();
And then to bind it to a specific scripting VM, I can fetch the above info with
const TypeBinding& b = ReflectTest1();
Which gives me structures like
typedef void (FnTask)( void* obj, void* args, uint argSize );
struct DataBinding
{
    const char* name;
    memptr memvar;
    uint offset, size;
    Type type;
};
struct MethodBinding
{
    const char* name;
    memfuncptr memfuncptr;
    FnTask* task;
};
struct TypeBinding
{
    const DataBinding*	 data;
    uint				   dataCount;
    const MethodBinding*   method;
    uint				   methodCount;
};

#1Hodgman

Posted 09 August 2012 - 03:16 AM

I'm working on a similar system, so I hope it's feasible Posted Image

I manually reflect on my bindable classes like:
class Test1
{
public:
eiBind(Test1);
int DoStuff() { return 0; }
private:
int m_stuff;
};


eiBindClass( Test1 )
eiBeginMethods()
  eiBindMethod( DoStuff )
eiEndMethods()
eiBeginData()
  eiBindData( m_stuff )
eiEndData()
eiEndBind();
And then to bind it to a specific scripting VM, I can fetch the above info with
const TypeBinding& b = ReflectTest1();
Which gives me structures like
typedef void (FnTask)( void* obj, void* args, uint argSize );
struct DataBinding
{
const char* name;
memptr memvar;
uint offset, size;
};
struct MethodBinding
{
const char* name;
memfuncptr memfuncptr;
FnTask* task;
};
struct TypeBinding
{
const DataBinding*	 data;
uint				   dataCount;
const MethodBinding*   method;
uint				   methodCount;
};

PARTNERS