Languages

Menu
Sites
Language
Native data structure for FIFO

Hello,

I want to have a data structure which will be accessible across the project and will work as FIFO.

I tried array EINA_ARRAY but it is not FIFO. 

dlog_print(DLOG_ERROR, LOG_TAG, "array count: %d\n",
            eina_array_count(outPutFileNameArray));
    char *filename = (char*) eina_array_pop(outPutFileNameArray);

 

But this pop will give me last element. I want the 0th element. Is there any idea to modify array behaviour to give me required functionality?

 

Regards,

Shraddha

Responses

3 Replies
Shaswati Saha

You may try using List instead of Array. According to this link, it works very well as a queue. Please go through the link below:

https://developer.tizen.org/dev-guide/native/2.3.0/org.tizen.mobile.native.apireference/group__Eina__List__Group.html

Shraddha Shravagi

I am getting error for list for eina_init() when using in service.

Shaswati Saha

You don't need to call eina_init() to use Eina_List. You can simply insert data and retrieve it from the list as below. Please have a look.

Eina_List *list = NULL;
list = eina_list_append(list, "First item");
dlog_print(DLOG_DEBUG, "test", "%s", eina_list_nth(list, 0));