_Eina_Model_Type Struct Reference
[Data Model Type management]
API to access models.
More...
Data Fields | |
unsigned int | version |
must be EINA_MODEL_TYPE_VERSION | |
unsigned int | private_size |
used to allocate type private data | |
unsigned int | type_size |
used to know sizeof(Eina_Model_Type) or subtypes (which may be bigger, by including Eina_Model_Type as a header | |
const char * | name |
name for debug and introspection | |
const Eina_Model_Type * | parent |
parent type, must be EINA_MODEL_TYPE_BASE or a child of | |
const Eina_Model_Interface ** | interfaces |
null terminated array of interfaces | |
const Eina_Model_Event_Description * | events |
null terminated array of events | |
Eina_Bool(* | setup )(Eina_Model *model) |
setup type private data, do not call parent type setup! | |
Eina_Bool(* | flush )(Eina_Model *model) |
flush type private data, do not call parent type flush! | |
Eina_Bool(* | constructor )(Eina_Model *model) |
construct type instance, setup was already called. | |
Eina_Bool(* | destructor )(Eina_Model *model) |
destruct type instance, flush will be called after it. | |
Eina_Bool(* | copy )(const Eina_Model *src, Eina_Model *dst) |
copy type private data, do not call parent type copy! | |
Eina_Bool(* | deep_copy )(const Eina_Model *src, Eina_Model *dst) |
deep copy type private data, do not call parent type deep copy! | |
Eina_Bool(* | compare )(const Eina_Model *a, const Eina_Model *b, int *cmp) |
Eina_Bool(* | load )(Eina_Model *model) |
Eina_Bool(* | unload )(Eina_Model *model) |
Eina_Bool(* | property_get )(const Eina_Model *model, const char *name, Eina_Value *value) |
Eina_Bool(* | property_set )(Eina_Model *model, const char *name, const Eina_Value *value) |
Eina_Bool(* | property_del )(Eina_Model *model, const char *name) |
Eina_List *(* | properties_names_list_get )(const Eina_Model *model) |
list of stringshare | |
int(* | child_count )(const Eina_Model *model) |
Eina_Model *(* | child_get )(const Eina_Model *model, unsigned int position) |
Eina_Bool(* | child_set )(Eina_Model *model, unsigned int position, Eina_Model *child) |
Eina_Bool(* | child_del )(Eina_Model *model, unsigned int position) |
Eina_Bool(* | child_insert_at )(Eina_Model *model, unsigned int position, Eina_Model *child) |
int(* | child_find )(const Eina_Model *model, unsigned int start_position, const Eina_Model *other) |
int(* | child_criteria_match )(const Eina_Model *model, unsigned int start_position, Eina_Each_Cb match, const void *data) |
void(* | child_sort )(Eina_Model *model, Eina_Compare_Cb compare) |
Eina_Iterator *(* | child_iterator_get )(Eina_Model *model, unsigned int start, unsigned int count) |
Eina_Iterator *(* | child_reversed_iterator_get )(Eina_Model *model, unsigned int start, unsigned int count) |
Eina_Iterator *(* | child_sorted_iterator_get )(Eina_Model *model, unsigned int start, unsigned int count, Eina_Compare_Cb compare) |
Eina_Iterator *(* | child_filtered_iterator_get )(Eina_Model *model, unsigned int start, unsigned int count, Eina_Each_Cb match, const void *data) |
char *(* | to_string )(const Eina_Model *model) |
used to represent model as string, usually for debug purposes or user convenience | |
void * | __extension_ptr0 |
not to be used | |
void * | __extension_ptr1 |
not to be used | |
void * | __extension_ptr2 |
not to be used | |
void * | __extension_ptr3 |
not to be used |
Detailed Description
API to access models.
Each type of the hierarchy and each interface will get its own private data of size private_size
(defined at each subtype or interface), this can be retrieved with eina_model_type_private_data_get() and eina_model_interface_private_data_get().
Private are created automatically and should be setup with setup
and flushed with flush
. All types (or interfaces) functions that exist are called! Don't call your parent's setup
or flush!
The setup is done from parent to child. Flush is done from child to parent.
After memory setup was done, constructor
of the toplevel type defining it is called. If desired it may call parent's constructor in whatever order is desired. This may be used to create properties, children and may use parent's data if needed. The only constructor caled is that of the most specialized type, if interface constructors should be called, do them in the desired order from the type constructor.
When the model is deleted, explicitly with eina_model_del() or implicitly with eina_model_unref() on the last reference, the destructor
is called. It must release references to other models. When the last reference is dropped, every flush
is called from child to parent, then memory is freed. The only destructor caled is that of the most specialized type, if interface destructors should be called, do them in the desired order from the type destructor.
- Note:
- The methods
setup
andflush
should exist if there is private data, otherwise memory may be uninitialized or leaks.It is recommended that
constructor
anddestructor
exist to correctly do their roles and call parents in the correct order. Whenever they do not exist, their parent pointer is called.a runtime check will enforce just types with ABI version EINA_MODEL_TYPE_VERSION are used by comparing with the
version
member.
- Since:
- 1.2
Field Documentation
Eina_Bool(* _Eina_Model_Type::constructor)(Eina_Model *model) |
construct type instance, setup was already called.
Should call parent's or interfaces' constructor if needed
Referenced by eina_model_type_subclass_setup().
Eina_Bool(* _Eina_Model_Type::destructor)(Eina_Model *model) |
destruct type instance, flush will be called after it.
Should call parent's or interfaces' destructor if needed. Release reference to other models here.
Referenced by eina_model_type_subclass_setup().