class
foo_t
{
public
:
foo_t(
int
v_):m_value(v_)
{
printf
(
"%s\n"
, __FUNCTION__);
}
virtual
~foo_t()
{
printf
(
"%s\n"
, __FUNCTION__);
}
int
get_value()
const
{
return
m_value; }
void
set_value(
int
v_) { m_value = v_; }
void
test_stl(map<string, list<
int
> >& v_)
{
printf
(
"%s\n"
, __FUNCTION__);
}
int
m_value;
};
class
dumy_t:
public
foo_t
{
public
:
dumy_t(
int
v_):foo_t(v_)
{
printf
(
"%s\n"
, __FUNCTION__);
}
~dumy_t()
{
printf
(
"%s\n"
, __FUNCTION__);
}
void
dump()
{
printf
(
"%s\n"
, __FUNCTION__);
}
};
static
foo_t* obj_test(dumy_t* p)
{
printf
(
"%s\n"
, __FUNCTION__);
return
p;
}
void
test_register_base_class(ffpython_t& ffpython)
{
ffpython.reg_class<foo_t, PYCTOR(
int
)>(
"foo_t"
)
.reg(&foo_t::get_value,
"get_value"
)
.reg(&foo_t::set_value,
"set_value"
)
.reg(&foo_t::test_stl,
"test_stl"
)
.reg_property(&foo_t::m_value,
"m_value"
);
ffpython.reg_class<dumy_t, PYCTOR(
int
)>(
"dumy_t"
,
"dumy_t class inherit foo_t ctor <int>"
,
"foo_t"
)
.reg(&dumy_t::dump,
"dump"
);
ffpython.reg(obj_test,
"obj_test"
);
ffpython.init();
ffpython.call<
void
>(
"fftest"
,
"test_register_base_class"
);
};