diff options
Diffstat (limited to 'libraries/eina/src/examples/eina_model_04_animal.c')
-rw-r--r-- | libraries/eina/src/examples/eina_model_04_animal.c | 76 |
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 | |||
7 | static Eina_Bool initialized = EINA_FALSE; | ||
8 | |||
9 | static 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 | |||
17 | static 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 | |||
25 | const char *ANIMAL_MODEL_TYPE_NAME = NULL; | ||
26 | static Animal_Type _ANIMAL_TYPE; | ||
27 | |||
28 | const Eina_Model_Type * const ANIMAL_TYPE = (Eina_Model_Type *) &_ANIMAL_TYPE; | ||
29 | |||
30 | void | ||
31 | animal_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 | |||
54 | void | ||
55 | animal_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 | |||
66 | void | ||
67 | animal_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 | } | ||