My Project
|
00001 /* 00002 Copyright (c) 2012, Broadcom Europe Ltd 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions are met: 00007 * Redistributions of source code must retain the above copyright 00008 notice, this list of conditions and the following disclaimer. 00009 * Redistributions in binary form must reproduce the above copyright 00010 notice, this list of conditions and the following disclaimer in the 00011 documentation and/or other materials provided with the distribution. 00012 * Neither the name of the copyright holder nor the 00013 names of its contributors may be used to endorse or promote products 00014 derived from this software without specific prior written permission. 00015 00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00017 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00018 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 00020 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00021 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00022 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00023 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00025 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 */ 00027 00028 #ifndef MMAL_LIST_H 00029 #define MMAL_LIST_H 00030 00031 #ifdef __cplusplus 00032 extern "C" { 00033 #endif 00034 00038 /* @{ */ 00039 00041 typedef struct MMAL_LIST_ELEMENT_T 00042 { 00043 struct MMAL_LIST_ELEMENT_T *next; 00044 struct MMAL_LIST_ELEMENT_T *prev; 00045 } MMAL_LIST_ELEMENT_T; 00046 00051 typedef struct MMAL_LIST_T 00052 { 00053 unsigned int length; 00054 MMAL_LIST_ELEMENT_T *first; 00055 MMAL_LIST_ELEMENT_T *last; 00056 } MMAL_LIST_T; 00057 00062 MMAL_LIST_T* mmal_list_create(void); 00063 00068 void mmal_list_destroy(MMAL_LIST_T *list); 00069 00076 MMAL_LIST_ELEMENT_T* mmal_list_pop_back(MMAL_LIST_T *list); 00077 00084 MMAL_LIST_ELEMENT_T* mmal_list_pop_front(MMAL_LIST_T *list); 00085 00091 void mmal_list_push_front(MMAL_LIST_T *list, MMAL_LIST_ELEMENT_T *element); 00092 00098 void mmal_list_push_back(MMAL_LIST_T *list, MMAL_LIST_ELEMENT_T *element); 00099 00108 typedef int (*MMAL_LIST_COMPARE_T)(MMAL_LIST_ELEMENT_T *lhs, MMAL_LIST_ELEMENT_T *rhs); 00109 00119 void mmal_list_insert(MMAL_LIST_T *list, MMAL_LIST_ELEMENT_T *element, MMAL_LIST_COMPARE_T compare); 00120 00121 /* @} */ 00122 00123 #ifdef __cplusplus 00124 } 00125 #endif 00126 00127 #endif /* MMAL_LIST_H */