Mercurial > almixer_isolated
comparison CircularQueue.h @ 55:8b4f80233969
merged
author | Eric Wing <ewing@anscamobile.com> |
---|---|
date | Tue, 29 May 2012 19:41:59 -0700 |
parents | 516da6d93534 |
children | 36644b1b940b |
comparison
equal
deleted
inserted
replaced
53:02a11507d65b | 55:8b4f80233969 |
---|---|
23 | 23 |
24 /* Set up for C function definitions, even when using C++ */ | 24 /* Set up for C function definitions, even when using C++ */ |
25 #ifdef __cplusplus | 25 #ifdef __cplusplus |
26 extern "C" { | 26 extern "C" { |
27 #endif | 27 #endif |
28 | |
29 #ifndef DOXYGEN_SHOULD_IGNORE_THIS | |
30 /** @cond DOXYGEN_SHOULD_IGNORE_THIS */ | |
31 | |
32 /* Note: For Doxygen to produce clean output, you should set the | |
33 * PREDEFINED option to remove C_CIRCULAR_QUEUE_DECLSPEC, C_CIRCULAR_QUEUE_CALL, and | |
34 * the DOXYGEN_SHOULD_IGNORE_THIS blocks. | |
35 * PREDEFINED = DOXYGEN_SHOULD_IGNORE_THIS=1 C_CIRCULAR_QUEUE_DECLSPEC= C_CIRCULAR_QUEUE_CALL= | |
36 */ | |
37 | |
38 /** Windows needs to know explicitly which functions to export in a DLL. */ | |
39 #if defined(_WIN32) | |
40 #if defined(C_CIRCULAR_QUEUE_BUILD_LIBRARY) | |
41 #define C_CIRCULAR_QUEUE_DECLSPEC __declspec(dllexport) | |
42 #else | |
43 #define C_CIRCULAR_QUEUE_DECLSPEC __declspec(dllimport) | |
44 #endif | |
45 #else | |
46 #if defined(C_CIRCULAR_QUEUE_BUILD_LIBRARY) | |
47 #if defined (__GNUC__) && __GNUC__ >= 4 | |
48 #define C_CIRCULAR_QUEUE_DECLSPEC __attribute__((visibility("default"))) | |
49 #else | |
50 #define C_CIRCULAR_QUEUE_DECLSPEC | |
51 #endif | |
52 #else | |
53 #define C_CIRCULAR_QUEUE_DECLSPEC | |
54 #endif | |
55 #endif | |
56 | |
57 /* For Windows, by default, use the C calling convention */ | |
58 #if defined(_WIN32) | |
59 #define C_CIRCULAR_QUEUE_CALL __cdecl | |
60 #else | |
61 #define C_CIRCULAR_QUEUE_CALL | |
62 #endif | |
63 | |
64 /** @endcond DOXYGEN_SHOULD_IGNORE_THIS */ | |
65 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ | |
28 | 66 |
29 /** | 67 /** |
30 * @file | 68 * @file |
31 * This is a C-based Circular queue class. | 69 * This is a C-based Circular queue class. |
32 * This class provides very simple circular queue functionality, | 70 * This class provides very simple circular queue functionality, |
131 * @return Returns a pointer to a CircularQueue which is the | 169 * @return Returns a pointer to a CircularQueue which is the |
132 * instance variable (if successful) or NULL on failure. | 170 * instance variable (if successful) or NULL on failure. |
133 * | 171 * |
134 * @see CircularQueueUnsignedInt_FreeQueue | 172 * @see CircularQueueUnsignedInt_FreeQueue |
135 */ | 173 */ |
136 CircularQueueUnsignedInt* CircularQueueUnsignedInt_CreateQueue(unsigned int max_size); | 174 extern C_CIRCULAR_QUEUE_DECLSPEC CircularQueueUnsignedInt* C_CIRCULAR_QUEUE_CALL CircularQueueUnsignedInt_CreateQueue(unsigned int max_size); |
137 | 175 |
138 /** | 176 /** |
139 * This destroys a CircularQueue instance. | 177 * This destroys a CircularQueue instance. |
140 * This will destroy the memory associated with the circular queue instance. | 178 * This will destroy the memory associated with the circular queue instance. |
141 * Whenever you create a CircularQueue instance, you should always to | 179 * Whenever you create a CircularQueue instance, you should always to |
143 * | 181 * |
144 * @param queue The pointer to the CircularQueue instance. | 182 * @param queue The pointer to the CircularQueue instance. |
145 * | 183 * |
146 * @see CircularQueueUnsignedInt_CreateQueue | 184 * @see CircularQueueUnsignedInt_CreateQueue |
147 */ | 185 */ |
148 void CircularQueueUnsignedInt_FreeQueue(CircularQueueUnsignedInt* queue); | 186 extern C_CIRCULAR_QUEUE_DECLSPEC void C_CIRCULAR_QUEUE_CALL CircularQueueUnsignedInt_FreeQueue(CircularQueueUnsignedInt* queue); |
149 | 187 |
150 /** | 188 /** |
151 * This pushes a new value into the back of the queue. | 189 * This pushes a new value into the back of the queue. |
152 * If the queue is full, the function will fail and return 0. | 190 * If the queue is full, the function will fail and return 0. |
153 * | 191 * |
154 * @param queue The pointer to the CircularQueue instance. | 192 * @param queue The pointer to the CircularQueue instance. |
155 * @param value The value you want to push into the queue. | 193 * @param value The value you want to push into the queue. |
156 * | 194 * |
157 * @return Returns 1 on success, or 0 on failure. | 195 * @return Returns 1 on success, or 0 on failure. |
158 */ | 196 */ |
159 unsigned int CircularQueueUnsignedInt_PushBack(CircularQueueUnsignedInt* queue, unsigned int value); | 197 extern C_CIRCULAR_QUEUE_DECLSPEC unsigned int C_CIRCULAR_QUEUE_CALL CircularQueueUnsignedInt_PushBack(CircularQueueUnsignedInt* queue, unsigned int value); |
160 | 198 |
161 /** | 199 /** |
162 * This pushes a new value into the front of the queue. | 200 * This pushes a new value into the front of the queue. |
163 * If the queue is full, the function will fail and return 0. | 201 * If the queue is full, the function will fail and return 0. |
164 * | 202 * |
165 * @param queue The pointer to the CircularQueue instance. | 203 * @param queue The pointer to the CircularQueue instance. |
166 * @param value The value you want to push into the queue. | 204 * @param value The value you want to push into the queue. |
167 * | 205 * |
168 * @return Returns 1 on success, or 0 on failure. | 206 * @return Returns 1 on success, or 0 on failure. |
169 */ | 207 */ |
170 unsigned int CircularQueueUnsignedInt_PushFront(CircularQueueUnsignedInt* queue, unsigned int value); | 208 extern C_CIRCULAR_QUEUE_DECLSPEC unsigned int C_CIRCULAR_QUEUE_CALL CircularQueueUnsignedInt_PushFront(CircularQueueUnsignedInt* queue, unsigned int value); |
171 | 209 |
172 /** | 210 /** |
173 * This removes the value at the front of the queue. | 211 * This removes the value at the front of the queue. |
174 * If the queue is empty, the function will return 0. | 212 * If the queue is empty, the function will return 0. |
175 * Note that this function does not return the value popped, but | 213 * Note that this function does not return the value popped, but |
179 * @param queue The pointer to the CircularQueue instance. | 217 * @param queue The pointer to the CircularQueue instance. |
180 * | 218 * |
181 * @return Returns 1 on success, or 0 on failure. | 219 * @return Returns 1 on success, or 0 on failure. |
182 * @see CircularQueueUnsignedInt_Front | 220 * @see CircularQueueUnsignedInt_Front |
183 */ | 221 */ |
184 unsigned int CircularQueueUnsignedInt_PopFront(CircularQueueUnsignedInt* queue); | 222 extern C_CIRCULAR_QUEUE_DECLSPEC unsigned int C_CIRCULAR_QUEUE_CALL CircularQueueUnsignedInt_PopFront(CircularQueueUnsignedInt* queue); |
185 | 223 |
186 /** | 224 /** |
187 * This removes the value at the back of the queue. | 225 * This removes the value at the back of the queue. |
188 * If the queue is empty, the function will return 0. | 226 * If the queue is empty, the function will return 0. |
189 * Note that this function does not return the value popped, but | 227 * Note that this function does not return the value popped, but |
193 * @param queue The pointer to the CircularQueue instance. | 231 * @param queue The pointer to the CircularQueue instance. |
194 * | 232 * |
195 * @return Returns 1 on success, or 0 on failure. | 233 * @return Returns 1 on success, or 0 on failure. |
196 * @see CircularQueueUnsignedInt_Back | 234 * @see CircularQueueUnsignedInt_Back |
197 */ | 235 */ |
198 unsigned int CircularQueueUnsignedInt_PopBack(CircularQueueUnsignedInt* queue); | 236 extern C_CIRCULAR_QUEUE_DECLSPEC unsigned int C_CIRCULAR_QUEUE_CALL CircularQueueUnsignedInt_PopBack(CircularQueueUnsignedInt* queue); |
199 | 237 |
200 /** | 238 /** |
201 * This gets the value at the front of the queue. | 239 * This gets the value at the front of the queue. |
202 * If the queue is empty, the value returned will be 0. | 240 * If the queue is empty, the value returned will be 0. |
203 * Because this 0 return value is ambiguous because it could also could | 241 * Because this 0 return value is ambiguous because it could also could |
210 * @return Returns the value stored at the queue or 0 if the queue is empty | 248 * @return Returns the value stored at the queue or 0 if the queue is empty |
211 * (or if there is an error). | 249 * (or if there is an error). |
212 * | 250 * |
213 * @see CircularQueueUnsignedInt_Size | 251 * @see CircularQueueUnsignedInt_Size |
214 */ | 252 */ |
215 unsigned int CircularQueueUnsignedInt_Front(CircularQueueUnsignedInt* queue); | 253 extern C_CIRCULAR_QUEUE_DECLSPEC unsigned int C_CIRCULAR_QUEUE_CALL CircularQueueUnsignedInt_Front(CircularQueueUnsignedInt* queue); |
216 | 254 |
217 /** | 255 /** |
218 * This gets the value at the back of the queue. | 256 * This gets the value at the back of the queue. |
219 * If the queue is empty, the value returned will be 0. | 257 * If the queue is empty, the value returned will be 0. |
220 * Because this 0 return value is ambiguous because it could also could | 258 * Because this 0 return value is ambiguous because it could also could |
227 * @return Returns the value stored at the queue or 0 if the queue is empty | 265 * @return Returns the value stored at the queue or 0 if the queue is empty |
228 * (or 0 if there is an error). | 266 * (or 0 if there is an error). |
229 * | 267 * |
230 * @see CircularQueueUnsignedInt_Size | 268 * @see CircularQueueUnsignedInt_Size |
231 */ | 269 */ |
232 unsigned int CircularQueueUnsignedInt_Back(CircularQueueUnsignedInt* queue); | 270 extern C_CIRCULAR_QUEUE_DECLSPEC unsigned int C_CIRCULAR_QUEUE_CALL CircularQueueUnsignedInt_Back(CircularQueueUnsignedInt* queue); |
233 | 271 |
234 /** | 272 /** |
235 * This gets the current number of entries that are in the queue. | 273 * This gets the current number of entries that are in the queue. |
236 * This is number is not to be confused with the MaxSize. | 274 * This is number is not to be confused with the MaxSize. |
237 * | 275 * |
239 * | 277 * |
240 * @return Returns the number of entries currently in queue, or 0 if | 278 * @return Returns the number of entries currently in queue, or 0 if |
241 * there is an error. | 279 * there is an error. |
242 * | 280 * |
243 */ | 281 */ |
244 unsigned int CircularQueueUnsignedInt_Size(CircularQueueUnsignedInt* queue); | 282 extern C_CIRCULAR_QUEUE_DECLSPEC unsigned int C_CIRCULAR_QUEUE_CALL CircularQueueUnsignedInt_Size(CircularQueueUnsignedInt* queue); |
245 | 283 |
246 /** | 284 /** |
247 * This gets the maximum number of entries that are allowed in the queue at | 285 * This gets the maximum number of entries that are allowed in the queue at |
248 * a given time. | 286 * a given time. |
249 * This is the number that you used in the CreateQueue function. | 287 * This is the number that you used in the CreateQueue function. |
250 * | 288 * |
251 * @param queue The pointer to the CircularQueue instance. | 289 * @param queue The pointer to the CircularQueue instance. |
252 * | 290 * |
253 * @return Returns the maximum number of entries allowed in the queue. | 291 * @return Returns the maximum number of entries allowed in the queue. |
254 */ | 292 */ |
255 unsigned int CircularQueueUnsignedInt_MaxSize(CircularQueueUnsignedInt* queue); | 293 extern C_CIRCULAR_QUEUE_DECLSPEC unsigned int C_CIRCULAR_QUEUE_CALL CircularQueueUnsignedInt_MaxSize(CircularQueueUnsignedInt* queue); |
256 /** | 294 /** |
257 * This empties the entire queue. | 295 * This empties the entire queue. |
258 * This will remove all entries that are in the queue. | 296 * This will remove all entries that are in the queue. |
259 * This does not destroy any memory. Use FreeQueue() to actually destroy | 297 * This does not destroy any memory. Use FreeQueue() to actually destroy |
260 * the queue. | 298 * the queue. |
261 * | 299 * |
262 * @param queue The pointer to the CircularQueue instance. | 300 * @param queue The pointer to the CircularQueue instance. |
263 */ | 301 */ |
264 void CircularQueueUnsignedInt_Clear(CircularQueueUnsignedInt* queue); | 302 extern C_CIRCULAR_QUEUE_DECLSPEC void C_CIRCULAR_QUEUE_CALL CircularQueueUnsignedInt_Clear(CircularQueueUnsignedInt* queue); |
265 | 303 |
266 /** | 304 /** |
267 * This is a debugging function that will print all the elements in the | 305 * This is a debugging function that will print all the elements in the |
268 * queue to stderr. | 306 * queue to stderr. |
269 * This function is provided as convenience, but should not be considered | 307 * This function is provided as convenience, but should not be considered |
270 * as part of the standard API. Treat this function as deprecated | 308 * as part of the standard API. Treat this function as deprecated |
271 * as it's implementation may change or be removed entirely. | 309 * as it's implementation may change or be removed entirely. |
272 * | 310 * |
273 * @param queue The pointer to the CircularQueue instance. | 311 * @param queue The pointer to the CircularQueue instance. |
274 */ | 312 */ |
275 void CircularQueueUnsignedInt_Print(CircularQueueUnsignedInt* queue); | 313 extern C_CIRCULAR_QUEUE_DECLSPEC void C_CIRCULAR_QUEUE_CALL CircularQueueUnsignedInt_Print(CircularQueueUnsignedInt* queue); |
276 | 314 |
277 /** | 315 /** |
278 * This returns the element located at the specified index, | 316 * This returns the element located at the specified index, |
279 * where index=0 represents the head/front of the queue. | 317 * where index=0 represents the head/front of the queue. |
280 * | 318 * |
302 * this may not be the speediest operation in a tight loop. | 340 * this may not be the speediest operation in a tight loop. |
303 * This implementation was not optimized for random access, though it still | 341 * This implementation was not optimized for random access, though it still |
304 * is technically O(1). | 342 * is technically O(1). |
305 * | 343 * |
306 */ | 344 */ |
307 unsigned int CircularQueueUnsignedInt_ValueAtIndex(CircularQueueUnsignedInt* queue, unsigned int the_index); | 345 extern C_CIRCULAR_QUEUE_DECLSPEC unsigned int C_CIRCULAR_QUEUE_CALL CircularQueueUnsignedInt_ValueAtIndex(CircularQueueUnsignedInt* queue, unsigned int the_index); |
308 | 346 |
309 | 347 |
310 /* This is a trick I picked up from Lua. Doing the typedef separately | 348 /* This is a trick I picked up from Lua. Doing the typedef separately |
311 * (and I guess before the definition) instead of a single | 349 * (and I guess before the definition) instead of a single |
312 * entry: typedef struct {...} YourName; seems to allow me | 350 * entry: typedef struct {...} YourName; seems to allow me |
345 * @return Returns a pointer to a CircularQueue which is the | 383 * @return Returns a pointer to a CircularQueue which is the |
346 * instance variable (if successful) or NULL on failure. | 384 * instance variable (if successful) or NULL on failure. |
347 * | 385 * |
348 * @see CircularQueueVoid_FreeQueue | 386 * @see CircularQueueVoid_FreeQueue |
349 */ | 387 */ |
350 CircularQueueVoid* CircularQueueVoid_CreateQueue(unsigned int max_size); | 388 extern C_CIRCULAR_QUEUE_DECLSPEC CircularQueueVoid* C_CIRCULAR_QUEUE_CALL CircularQueueVoid_CreateQueue(unsigned int max_size); |
351 | 389 |
352 /** | 390 /** |
353 * This destroys a CircularQueue instance. | 391 * This destroys a CircularQueue instance. |
354 * This will destroy the memory associated with the circular queue instance. | 392 * This will destroy the memory associated with the circular queue instance. |
355 * Whenever you create a CircularQueue instance, you should always to | 393 * Whenever you create a CircularQueue instance, you should always to |
357 * | 395 * |
358 * @param queue The pointer to the CircularQueue instance. | 396 * @param queue The pointer to the CircularQueue instance. |
359 * | 397 * |
360 * @see CircularQueueVoid_CreateQueue | 398 * @see CircularQueueVoid_CreateQueue |
361 */ | 399 */ |
362 void CircularQueueVoid_FreeQueue(CircularQueueVoid* queue); | 400 extern C_CIRCULAR_QUEUE_DECLSPEC void C_CIRCULAR_QUEUE_CALL CircularQueueVoid_FreeQueue(CircularQueueVoid* queue); |
363 | 401 |
364 /** | 402 /** |
365 * This pushes a new value into the back of the queue. | 403 * This pushes a new value into the back of the queue. |
366 * If the queue is full, the function will fail and return 0. | 404 * If the queue is full, the function will fail and return 0. |
367 * | 405 * |
368 * @param queue The pointer to the CircularQueue instance. | 406 * @param queue The pointer to the CircularQueue instance. |
369 * @param value The value you want to push into the queue. | 407 * @param value The value you want to push into the queue. |
370 * | 408 * |
371 * @return Returns 1 on success, or 0 on failure. | 409 * @return Returns 1 on success, or 0 on failure. |
372 */ | 410 */ |
373 unsigned int CircularQueueVoid_PushBack(CircularQueueVoid* queue, void* value); | 411 extern C_CIRCULAR_QUEUE_DECLSPEC unsigned int C_CIRCULAR_QUEUE_CALL CircularQueueVoid_PushBack(CircularQueueVoid* queue, void* value); |
374 | 412 |
375 /** | 413 /** |
376 * This pushes a new value into the front of the queue. | 414 * This pushes a new value into the front of the queue. |
377 * If the queue is full, the function will fail and return 0. | 415 * If the queue is full, the function will fail and return 0. |
378 * | 416 * |
379 * @param queue The pointer to the CircularQueue instance. | 417 * @param queue The pointer to the CircularQueue instance. |
380 * @param value The value you want to push into the queue. | 418 * @param value The value you want to push into the queue. |
381 * | 419 * |
382 * @return Returns 1 on success, or 0 on failure. | 420 * @return Returns 1 on success, or 0 on failure. |
383 */ | 421 */ |
384 unsigned int CircularQueueVoid_PushFront(CircularQueueVoid* queue, void* value); | 422 extern C_CIRCULAR_QUEUE_DECLSPEC unsigned int C_CIRCULAR_QUEUE_CALL CircularQueueVoid_PushFront(CircularQueueVoid* queue, void* value); |
385 | 423 |
386 /** | 424 /** |
387 * This removes the value at the front of the queue. | 425 * This removes the value at the front of the queue. |
388 * If the queue is empty, the function will return 0. | 426 * If the queue is empty, the function will return 0. |
389 * Note that this function does not return the value popped, but | 427 * Note that this function does not return the value popped, but |
393 * @param queue The pointer to the CircularQueue instance. | 431 * @param queue The pointer to the CircularQueue instance. |
394 * | 432 * |
395 * @return Returns 1 on success, or 0 on failure. | 433 * @return Returns 1 on success, or 0 on failure. |
396 * @see CircularQueueVoid_Front | 434 * @see CircularQueueVoid_Front |
397 */ | 435 */ |
398 unsigned int CircularQueueVoid_PopFront(CircularQueueVoid* queue); | 436 extern C_CIRCULAR_QUEUE_DECLSPEC unsigned int C_CIRCULAR_QUEUE_CALL CircularQueueVoid_PopFront(CircularQueueVoid* queue); |
399 | 437 |
400 /** | 438 /** |
401 * This removes the value at the back of the queue. | 439 * This removes the value at the back of the queue. |
402 * If the queue is empty, the function will return 0. | 440 * If the queue is empty, the function will return 0. |
403 * Note that this function does not return the value popped, but | 441 * Note that this function does not return the value popped, but |
407 * @param queue The pointer to the CircularQueue instance. | 445 * @param queue The pointer to the CircularQueue instance. |
408 * | 446 * |
409 * @return Returns 1 on success, or 0 on failure. | 447 * @return Returns 1 on success, or 0 on failure. |
410 * @see CircularQueueVoid_Back | 448 * @see CircularQueueVoid_Back |
411 */ | 449 */ |
412 unsigned int CircularQueueVoid_PopBack(CircularQueueVoid* queue); | 450 extern C_CIRCULAR_QUEUE_DECLSPEC unsigned int C_CIRCULAR_QUEUE_CALL CircularQueueVoid_PopBack(CircularQueueVoid* queue); |
413 | 451 |
414 /** | 452 /** |
415 * This gets the value at the front of the queue. | 453 * This gets the value at the front of the queue. |
416 * If the queue is empty, the value returned will be 0. | 454 * If the queue is empty, the value returned will be 0. |
417 * Because this 0 return value is ambiguous because it could also could | 455 * Because this 0 return value is ambiguous because it could also could |
424 * @return Returns the value stored at the queue or 0 if the queue is empty | 462 * @return Returns the value stored at the queue or 0 if the queue is empty |
425 * (or if there is an error). | 463 * (or if there is an error). |
426 * | 464 * |
427 * @see CircularQueueVoid_Size | 465 * @see CircularQueueVoid_Size |
428 */ | 466 */ |
429 void* CircularQueueVoid_Front(CircularQueueVoid* queue); | 467 extern C_CIRCULAR_QUEUE_DECLSPEC void* C_CIRCULAR_QUEUE_CALL CircularQueueVoid_Front(CircularQueueVoid* queue); |
430 | 468 |
431 /** | 469 /** |
432 * This gets the value at the back of the queue. | 470 * This gets the value at the back of the queue. |
433 * If the queue is empty, the value returned will be 0. | 471 * If the queue is empty, the value returned will be 0. |
434 * Because this 0 return value is ambiguous because it could also could | 472 * Because this 0 return value is ambiguous because it could also could |
441 * @return Returns the value stored at the queue or 0 if the queue is empty | 479 * @return Returns the value stored at the queue or 0 if the queue is empty |
442 * (or 0 if there is an error). | 480 * (or 0 if there is an error). |
443 * | 481 * |
444 * @see CircularQueueVoid_Size | 482 * @see CircularQueueVoid_Size |
445 */ | 483 */ |
446 void* CircularQueueVoid_Back(CircularQueueVoid* queue); | 484 extern C_CIRCULAR_QUEUE_DECLSPEC void* C_CIRCULAR_QUEUE_CALL CircularQueueVoid_Back(CircularQueueVoid* queue); |
447 | 485 |
448 /** | 486 /** |
449 * This gets the current number of entries that are in the queue. | 487 * This gets the current number of entries that are in the queue. |
450 * This is number is not to be confused with the MaxSize. | 488 * This is number is not to be confused with the MaxSize. |
451 * | 489 * |
453 * | 491 * |
454 * @return Returns the number of entries currently in queue, or 0 if | 492 * @return Returns the number of entries currently in queue, or 0 if |
455 * there is an error. | 493 * there is an error. |
456 * | 494 * |
457 */ | 495 */ |
458 unsigned int CircularQueueVoid_Size(CircularQueueVoid* queue); | 496 extern C_CIRCULAR_QUEUE_DECLSPEC unsigned int C_CIRCULAR_QUEUE_CALL CircularQueueVoid_Size(CircularQueueVoid* queue); |
459 | 497 |
460 /** | 498 /** |
461 * This gets the maximum number of entries that are allowed in the queue at | 499 * This gets the maximum number of entries that are allowed in the queue at |
462 * a given time. | 500 * a given time. |
463 * This is the number that you used in the CreateQueue function. | 501 * This is the number that you used in the CreateQueue function. |
464 * | 502 * |
465 * @param queue The pointer to the CircularQueue instance. | 503 * @param queue The pointer to the CircularQueue instance. |
466 * | 504 * |
467 * @return Returns the maximum number of entries allowed in the queue. | 505 * @return Returns the maximum number of entries allowed in the queue. |
468 */ | 506 */ |
469 unsigned int CircularQueueVoid_MaxSize(CircularQueueVoid* queue); | 507 extern C_CIRCULAR_QUEUE_DECLSPEC unsigned int C_CIRCULAR_QUEUE_CALL CircularQueueVoid_MaxSize(CircularQueueVoid* queue); |
470 /** | 508 /** |
471 * This empties the entire queue. | 509 * This empties the entire queue. |
472 * This will remove all entries that are in the queue. | 510 * This will remove all entries that are in the queue. |
473 * This does not destroy any memory. Use FreeQueue() to actually destroy | 511 * This does not destroy any memory. Use FreeQueue() to actually destroy |
474 * the queue. | 512 * the queue. |
475 * | 513 * |
476 * @param queue The pointer to the CircularQueue instance. | 514 * @param queue The pointer to the CircularQueue instance. |
477 */ | 515 */ |
478 void CircularQueueVoid_Clear(CircularQueueVoid* queue); | 516 extern C_CIRCULAR_QUEUE_DECLSPEC void C_CIRCULAR_QUEUE_CALL CircularQueueVoid_Clear(CircularQueueVoid* queue); |
479 | 517 |
480 /** | 518 /** |
481 * This is a debugging function that will print all the addresses | 519 * This is a debugging function that will print all the addresses |
482 * of elements in the queue to stderr. | 520 * of elements in the queue to stderr. |
483 * This function is provided as convenience, but should not be considered | 521 * This function is provided as convenience, but should not be considered |
484 * as part of the standard API. Treat this function as deprecated | 522 * as part of the standard API. Treat this function as deprecated |
485 * as it's implementation may change or be removed entirely. | 523 * as it's implementation may change or be removed entirely. |
486 * | 524 * |
487 * @param queue The pointer to the CircularQueue instance. | 525 * @param queue The pointer to the CircularQueue instance. |
488 */ | 526 */ |
489 void CircularQueueVoid_Print(CircularQueueVoid* queue); | 527 extern C_CIRCULAR_QUEUE_DECLSPEC void C_CIRCULAR_QUEUE_CALL CircularQueueVoid_Print(CircularQueueVoid* queue); |
490 | 528 |
491 /** | 529 /** |
492 * This returns the element located at the specified index, | 530 * This returns the element located at the specified index, |
493 * where index=0 represents the head/front of the queue. | 531 * where index=0 represents the head/front of the queue. |
494 * | 532 * |
515 * this may not be the speediest operation in a tight loop. | 553 * this may not be the speediest operation in a tight loop. |
516 * This implementation was not optimized for random access, though it still | 554 * This implementation was not optimized for random access, though it still |
517 * is technically O(1). | 555 * is technically O(1). |
518 * | 556 * |
519 */ | 557 */ |
520 void* CircularQueueVoid_ValueAtIndex(CircularQueueVoid* queue, unsigned int the_index); | 558 extern C_CIRCULAR_QUEUE_DECLSPEC void* C_CIRCULAR_QUEUE_CALL CircularQueueVoid_ValueAtIndex(CircularQueueVoid* queue, unsigned int the_index); |
521 | 559 |
522 | 560 |
523 | 561 |
524 | 562 |
525 /* Ends C function definitions when using C++ */ | 563 /* Ends C function definitions when using C++ */ |