aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/examples/eina_model_04_animal.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/eina/src/examples/eina_model_04_animal.c')
-rw-r--r--libraries/eina/src/examples/eina_model_04_animal.c76
1 files changed, 0 insertions, 76 deletions
diff --git a/libraries/eina/src/examples/eina_model_04_animal.c b/libraries/eina/src/examples/eina_model_04_animal.c
deleted file mode 100644
index bc9f06b..0000000
--- a/libraries/eina/src/examples/eina_model_04_animal.c
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * animal.c
3 */
4
5#include "eina_model_04_animal.h"
6
7static Eina_Bool initialized = EINA_FALSE;
8
9static void
10_animal_eat(Eina_Model *m)
11{
12 printf("%s\t%s", eina_model_type_name_get(eina_model_type_get(m)),
13 __func__);
14 printf("\t\t Eat Animal\n");
15}
16
17static void
18_animal_breathe(Eina_Model *m)
19{
20 printf("%s\t%s", eina_model_type_name_get(eina_model_type_get(m)),
21 __func__);
22 printf("\t\t Breathe Animal\n");
23}
24
25const char *ANIMAL_MODEL_TYPE_NAME = NULL;
26static Animal_Type _ANIMAL_TYPE;
27
28const Eina_Model_Type * const ANIMAL_TYPE = (Eina_Model_Type *) &_ANIMAL_TYPE;
29
30void
31animal_init(void)
32{
33 Eina_Model_Type *type;
34
35 if (initialized) return;
36 initialized = EINA_TRUE;
37
38 ANIMAL_MODEL_TYPE_NAME = "Animal_Model_Type";
39
40 type = (Eina_Model_Type *)&_ANIMAL_TYPE;
41 type->version = EINA_MODEL_TYPE_VERSION;
42 type->name = ANIMAL_MODEL_TYPE_NAME;
43 type->private_size = 0;
44
45 eina_model_type_subclass_setup(type, EINA_MODEL_TYPE_GENERIC);
46
47 /* define extra methods */
48
49 type->type_size = sizeof(Animal_Type);
50 ANIMAL_TYPE(type)->breathe = _animal_breathe;
51 ANIMAL_TYPE(type)->eat = _animal_eat;
52}
53
54void
55animal_breathe(Eina_Model *m)
56{
57 EINA_SAFETY_ON_FALSE_RETURN(eina_model_instance_check(m, ANIMAL_TYPE));
58
59 void (*pf)(Eina_Model *m);
60 pf = eina_model_method_resolve(m, Animal_Type, breathe);
61 EINA_SAFETY_ON_NULL_RETURN(pf);
62 printf("%s() \t", __func__);
63 pf(m);
64}
65
66void
67animal_eat(Eina_Model *m)
68{
69 EINA_SAFETY_ON_FALSE_RETURN(eina_model_instance_check(m, ANIMAL_TYPE));
70
71 void (*pf)(Eina_Model *m);
72 pf = eina_model_method_resolve(m, Animal_Type, eat);
73 EINA_SAFETY_ON_NULL_RETURN(pf);
74 printf("%s() \t", __func__);
75 pf(m);
76}