111 * @endcode |
111 * @endcode |
112 */ |
112 */ |
113 #define CX_COLLECTION_BASE struct cx_collection_s collection |
113 #define CX_COLLECTION_BASE struct cx_collection_s collection |
114 |
114 |
115 /** |
115 /** |
|
116 * Returns the number of elements currently stored. |
|
117 * |
|
118 * @param c a pointer to a struct that contains #CX_COLLECTION_BASE |
|
119 * @return (@c size_t) the number of currently stored elements |
|
120 */ |
|
121 #define cxCollectionSize(c) ((c)->collection.size) |
|
122 |
|
123 /** |
|
124 * Returns the size of one element. |
|
125 * |
|
126 * If #cxCollectionStoresPointers() returns true, this is the size of a pointer. |
|
127 * |
|
128 * @param c a pointer to a struct that contains #CX_COLLECTION_BASE |
|
129 * @return (@c size_t) the size of one element in bytes |
|
130 */ |
|
131 #define cxCollectionElementSize(c) ((c)->collection.elem_size) |
|
132 |
|
133 /** |
|
134 * Indicates whether this collection only stores pointers instead of the actual data. |
|
135 * |
|
136 * @param c a pointer to a struct that contains #CX_COLLECTION_BASE |
|
137 * @retval true if this collection stores only pointers to data |
|
138 * @retval false if this collection stores the actual element's data |
|
139 */ |
|
140 #define cxCollectionStoresPointers(c) ((c)->collection.store_pointer) |
|
141 |
|
142 /** |
|
143 * Indicates whether the collection can guarantee that the stored elements are currently sorted. |
|
144 * |
|
145 * This may return false even when the elements are sorted. |
|
146 * It is totally up to the implementation of the collection whether it keeps track of the order of its elements. |
|
147 * |
|
148 * @param c a pointer to a struct that contains #CX_COLLECTION_BASE |
|
149 * @retval true if the elements are currently sorted wrt. the collection's compare function |
|
150 * @retval false if the order of elements is unknown |
|
151 */ |
|
152 #define cxCollectionSorted(c) ((c)->collection.sorted) |
|
153 |
|
154 /** |
116 * Sets a simple destructor function for this collection. |
155 * Sets a simple destructor function for this collection. |
117 * |
156 * |
118 * @param c a pointer to a struct that contains #CX_COLLECTION_BASE |
157 * @param c a pointer to a struct that contains #CX_COLLECTION_BASE |
119 * @param destr the destructor function |
158 * @param destr the destructor function |
120 */ |
159 */ |