5 #include "eina_model_04_child.h"
6 #include "eina_model_04_whistler.h"
8 static Eina_Bool initialized = EINA_FALSE;
11 _child_cry(Eina_Model *m)
13 printf("%s\t%s", eina_model_type_name_get(eina_model_type_get(m)),
15 printf("\t\t Cry Child\n");
19 _child_dive(Eina_Model *m)
21 printf("%s\t%s", eina_model_type_name_get(eina_model_type_get(m)),
23 printf("\t\t Dive Child\n");
26 const char *CHILD_MODEL_TYPE_NAME = NULL;
28 static Child_Type _CHILD_TYPE;
29 const Eina_Model_Type * const CHILD_TYPE = (Eina_Model_Type *) &_CHILD_TYPE;
31 static const Diver_Interface _DIVER_INTERFACE;
32 static const Eina_Model_Interface * const DIVER_INTERFACE =
33 (Eina_Model_Interface *) &_DIVER_INTERFACE;
35 static const Eina_Model_Interface * CLASS_INTERFACE_ARRAY[] =
36 { &_DIVER_INTERFACE.base_interface, NULL }; //this array is for model
41 Eina_Model_Type *type;
43 if (initialized) return;
44 initialized = EINA_TRUE;
48 //overriding Diver Interface
49 Eina_Model_Interface * iface = (Eina_Model_Interface *) &_DIVER_INTERFACE;
50 iface->version = EINA_MODEL_INTERFACE_VERSION;
51 iface->interface_size = sizeof(Diver_Interface);
52 iface->name = DIVER_INTERFACE_NAME;
53 DIVER_INTERFACE(iface)->dive = _child_dive;
55 //creating instance of Child type
56 CHILD_MODEL_TYPE_NAME = "Child_Model_Type";
58 type = (Eina_Model_Type *) &_CHILD_TYPE;
59 type->version = EINA_MODEL_TYPE_VERSION;
60 type->name = CHILD_MODEL_TYPE_NAME;
62 eina_model_type_subclass_setup(type, HUMAN_TYPE);
64 type->type_size = sizeof(Child_Type);
65 type->interfaces = CLASS_INTERFACE_ARRAY;
67 CHILD_TYPE(type)->cry = _child_cry;
70 //call for implemented Child Class function
72 child_cry(Eina_Model *m)
74 EINA_SAFETY_ON_FALSE_RETURN(eina_model_instance_check(m, CHILD_TYPE));
76 void (*pf)(Eina_Model *m);
77 pf = eina_model_method_resolve(m, Child_Type, cry);
78 EINA_SAFETY_ON_NULL_RETURN(pf);
79 printf("%s() \t\t", __func__);