2012-04-10 02:12:46 -07:00
|
|
|
#include "Eobj.h"
|
2012-04-05 08:31:15 -07:00
|
|
|
#include "mixin.h"
|
|
|
|
#include "simple.h"
|
|
|
|
|
2012-04-12 06:52:13 -07:00
|
|
|
#include "config.h"
|
|
|
|
|
2012-04-05 08:31:15 -07:00
|
|
|
EAPI Eobj_Op MIXIN_BASE_ID = 0;
|
|
|
|
|
2012-04-17 03:27:25 -07:00
|
|
|
static const Eobj_Class *_my_class = NULL;
|
2012-04-05 08:31:15 -07:00
|
|
|
|
|
|
|
static void
|
2012-04-19 04:30:17 -07:00
|
|
|
_ab_sum_get(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
2012-04-05 08:31:15 -07:00
|
|
|
{
|
2012-04-19 01:52:11 -07:00
|
|
|
int a, b;
|
2012-04-05 08:31:15 -07:00
|
|
|
eobj_do(obj, SIMPLE_A_GET(&a), SIMPLE_B_GET(&b));
|
2012-04-19 01:52:11 -07:00
|
|
|
int *sum = va_arg(*list, int *);
|
|
|
|
if (sum)
|
|
|
|
*sum = a + b;
|
|
|
|
printf("%s %s\n", eobj_class_name_get(_my_class), __func__);
|
2012-04-05 08:31:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-04-19 04:30:17 -07:00
|
|
|
_constructor(Eobj *obj, void *class_data EINA_UNUSED)
|
2012-04-05 08:31:15 -07:00
|
|
|
{
|
|
|
|
eobj_constructor_super(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-04-19 04:30:17 -07:00
|
|
|
_destructor(Eobj *obj, void *class_data EINA_UNUSED)
|
2012-04-05 08:31:15 -07:00
|
|
|
{
|
|
|
|
eobj_destructor_super(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_class_constructor(Eobj_Class *klass)
|
|
|
|
{
|
|
|
|
const Eobj_Op_Func_Description func_desc[] = {
|
2012-04-19 01:52:11 -07:00
|
|
|
EOBJ_OP_FUNC(MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), _ab_sum_get),
|
2012-04-16 05:36:34 -07:00
|
|
|
EOBJ_OP_FUNC_SENTINEL
|
2012-04-05 08:31:15 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
eobj_class_funcs_set(klass, func_desc);
|
|
|
|
}
|
|
|
|
|
|
|
|
const Eobj_Class *
|
|
|
|
mixin_class_get(void)
|
|
|
|
{
|
|
|
|
if (_my_class) return _my_class;
|
|
|
|
|
|
|
|
static const Eobj_Op_Description op_desc[] = {
|
2012-04-19 01:52:11 -07:00
|
|
|
EOBJ_OP_DESCRIPTION(MIXIN_SUB_ID_AB_SUM_GET, "i", "Get the sum of a and b."),
|
2012-04-05 08:31:15 -07:00
|
|
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
|
|
|
};
|
|
|
|
|
|
|
|
static const Eobj_Class_Description class_desc = {
|
|
|
|
"Mixin",
|
|
|
|
EOBJ_CLASS_TYPE_MIXIN,
|
|
|
|
EOBJ_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST),
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
_constructor,
|
|
|
|
_destructor,
|
|
|
|
_class_constructor,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2012-04-17 03:27:37 -07:00
|
|
|
_my_class = eobj_class_new(&class_desc, NULL, NULL);
|
2012-04-05 08:31:15 -07:00
|
|
|
|
|
|
|
return _my_class;
|
|
|
|
}
|