UniMRCP  1.7.0
apt_obj_list.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2015 Arsen Chaloyan
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef APT_OBJ_LIST_H
18 #define APT_OBJ_LIST_H
19 
20 /**
21  * @file apt_obj_list.h
22  * @brief List of Opaque void* Objects
23  */
24 
25 #include "apt.h"
26 
28 
29 
30 /** Opaque list declaration */
32 /** Opaque list element declaration */
34 
35 /**
36  * Create list.
37  * @param pool the pool to allocate list from
38  * @return the created list
39  */
40 APT_DECLARE(apt_obj_list_t*) apt_list_create(apr_pool_t *pool);
41 
42 /**
43  * Destroy list.
44  * @param list the list to destroy
45  */
47 
48 /**
49  * Push object to the list as first in, first out.
50  * @param list the list to push object to
51  * @param obj the object to push
52  * @param pool the pool to allocate list element from
53  * @return the inserted element
54  */
55 APT_DECLARE(apt_list_elem_t*) apt_list_push_back(apt_obj_list_t *list, void *obj, apr_pool_t *pool);
56 
57 /**
58  * Pop object from the list as first in, first out.
59  * @param list the list to pop message from
60  * @return the popped object (if any)
61  */
63 
64 /**
65  * Retrieve object of the first element in the list.
66  * @param list the list to retrieve from
67  */
68 APT_DECLARE(void*) apt_list_head(const apt_obj_list_t *list);
69 
70 /**
71  * Retrieve object of the last element in the list.
72  * @param list the list to retrieve from
73  */
74 APT_DECLARE(void*) apt_obj_list_tail(const apt_obj_list_t *list);
75 
76 
77 /**
78  * Retrieve the first element of the list.
79  * @param list the list to retrieve from
80  */
82 
83 /**
84  * Retrieve the last element of the list.
85  * @param list the list to retrieve from
86  */
88 
89 /**
90  * Retrieve the next element of the list.
91  * @param list the list to retrieve from
92  * @param elem the element to retrieve next element from
93  */
95 
96 /**
97  * Retrieve the prev element of the list.
98  * @param list the list to retrieve from
99  * @param elem the element to retrieve prev element from
100  */
102 
103 /**
104  * Insert element to the list.
105  * @param list the list to insert element to
106  * @param elem the element to insert before
107  * @param obj the object to insert
108  * @param pool the pool to allocate list element from
109  * @return the inserted element
110  */
111 APT_DECLARE(apt_list_elem_t*) apt_list_elem_insert(apt_obj_list_t *list, apt_list_elem_t *elem, void *obj, apr_pool_t *pool);
112 
113 /**
114  * Remove element from the list.
115  * @param list the list to remove element from
116  * @param elem the element to remove
117  * @return the next element (if any)
118  */
120 
121 /**
122  * Query whether the list is empty.
123  * @param list the list to query
124  * @return TRUE if empty, otherwise FALSE
125  */
127 
128 /**
129  * Retrieve the object associated with element.
130  * @param elem the element to retrieve object from
131  */
133 
134 
136 
137 #endif /* APT_OBJ_LIST_H */
typedefAPT_BEGIN_EXTERN_C struct apt_obj_list_t apt_obj_list_t
Definition: apt_obj_list.h:31
#define APT_END_EXTERN_C
Definition: apt.h:38
int apt_bool_t
Definition: apt.h:57
apt_list_elem_t * apt_list_push_back(apt_obj_list_t *list, void *obj, apr_pool_t *pool)
void * apt_list_pop_front(apt_obj_list_t *list)
struct apt_list_elem_t apt_list_elem_t
Definition: apt_obj_list.h:33
#define APT_BEGIN_EXTERN_C
Definition: apt.h:36
#define APT_DECLARE(type)
Definition: apt.h:53
APR Toolkit Definitions.
apt_list_elem_t * apt_list_last_elem_get(const apt_obj_list_t *list)
apt_bool_t apt_list_is_empty(const apt_obj_list_t *list)
void * apt_obj_list_tail(const apt_obj_list_t *list)
apt_list_elem_t * apt_list_prev_elem_get(const apt_obj_list_t *list, apt_list_elem_t *elem)
apt_list_elem_t * apt_list_elem_remove(apt_obj_list_t *list, apt_list_elem_t *elem)
void apt_list_destroy(apt_obj_list_t *list)
apt_list_elem_t * apt_list_elem_insert(apt_obj_list_t *list, apt_list_elem_t *elem, void *obj, apr_pool_t *pool)
apt_list_elem_t * apt_list_first_elem_get(const apt_obj_list_t *list)
void * apt_list_head(const apt_obj_list_t *list)
void * apt_list_elem_object_get(const apt_list_elem_t *elem)
apt_obj_list_t * apt_list_create(apr_pool_t *pool)
apt_list_elem_t * apt_list_next_elem_get(const apt_obj_list_t *list, apt_list_elem_t *elem)